<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>lomoco: iniparser/src/dictionary.h Source File</title> <style type="text/css"> .cp-doNotDisplay { display: none; } @media aural, braille, handheld, tty { .cp-doNotDisplay { display: inline; speak: normal; }} .cp-edit { text-align: right; } @media print, embossed { .cp-edit { display: none; }} </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <link rel="stylesheet" type="text/css" href="doxygen.css" /> <link rel="stylesheet" media="screen" type="text/css" href="csync.css" /> <link rel="stylesheet" media="print, embossed" type="text/css" href="print.css" /> </head> <body> <ul class="cp-doNotDisplay"> <li><a href="#cp-content" accesskey="2">Skip to content</a></li> <li><a href="#cp-menu" accesskey="5">Skip to link menu</a></li> </ul> <div id="container"> <div id="header"> <div id="header_top"><div><div style="padding: 10px 30px;"> <!-- <img alt ="" src="top-kde.jpg"/> --> csync API Reference </div></div></div> <div id="header_bottom"> <div id="location"> <ul> <li><a href="index.html">csync</a></li> </ul> </div> <div id="menu"> <ul><li><a href="http://www.csync.org/">Sitemap</a></li> <li><a href="http://www.csync.org/">Contact Us</a></li> </ul> </div> </div> </div> <!-- End page header --> <div id="body_wrapper"> <div id="body"> <!-- begin main content --> <div id="right"> <div class="content"> <div id="main"> <div class="clearer"> </div> <!-- <h2><a name="content"></a>lomoco</h2> --> <!-- BC --> <!-- Generated by Doxygen 1.5.9 --> <div class="navpath"><a class="el" href="dir_83899319ec122a03d431d68c45b0dd06.html">iniparser</a> » <a class="el" href="dir_78cebf553df91c53d1da58b5e3c2bd5d.html">src</a> </div> <div class="contents"> <h1>dictionary.h</h1><a href="dictionary_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <a name="l00002"></a>00002 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00003"></a>00003 <span class="comment">/**</span> <a name="l00004"></a>00004 <span class="comment"> @file dictionary.h</span> <a name="l00005"></a>00005 <span class="comment"> @author N. Devillard</span> <a name="l00006"></a>00006 <span class="comment"> @date Aug 2000</span> <a name="l00007"></a>00007 <span class="comment"> @version $Revision: 1.11 $</span> <a name="l00008"></a>00008 <span class="comment"> @brief Implements a dictionary for string variables.</span> <a name="l00009"></a>00009 <span class="comment"></span> <a name="l00010"></a>00010 <span class="comment"> This module implements a simple dictionary object, i.e. a list</span> <a name="l00011"></a>00011 <span class="comment"> of string/string associations. This object is useful to store e.g.</span> <a name="l00012"></a>00012 <span class="comment"> informations retrieved from a configuration file (ini files).</span> <a name="l00013"></a>00013 <span class="comment">*/</span> <a name="l00014"></a>00014 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00015"></a>00015 <a name="l00016"></a>00016 <span class="comment">/*</span> <a name="l00017"></a>00017 <span class="comment"> $Id: dictionary.h,v 1.11 2002-06-17 09:30:46 ndevilla Exp $</span> <a name="l00018"></a>00018 <span class="comment"> $Author: ndevilla $</span> <a name="l00019"></a>00019 <span class="comment"> $Date: 2002-06-17 09:30:46 $</span> <a name="l00020"></a>00020 <span class="comment"> $Revision: 1.11 $</span> <a name="l00021"></a>00021 <span class="comment">*/</span> <a name="l00022"></a>00022 <a name="l00023"></a>00023 <span class="preprocessor">#ifndef _DICTIONARY_H_</span> <a name="l00024"></a>00024 <span class="preprocessor"></span><span class="preprocessor">#define _DICTIONARY_H_</span> <a name="l00025"></a>00025 <span class="preprocessor"></span> <a name="l00026"></a>00026 <span class="comment">/*---------------------------------------------------------------------------</span> <a name="l00027"></a>00027 <span class="comment"> Includes</span> <a name="l00028"></a>00028 <span class="comment"> ---------------------------------------------------------------------------*/</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="preprocessor">#include <stdio.h></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <stdlib.h></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <string.h></span> <a name="l00033"></a>00033 <span class="preprocessor">#include <unistd.h></span> <a name="l00034"></a>00034 <a name="l00035"></a>00035 <span class="comment">/*---------------------------------------------------------------------------</span> <a name="l00036"></a>00036 <span class="comment"> New types</span> <a name="l00037"></a>00037 <span class="comment"> ---------------------------------------------------------------------------*/</span> <a name="l00038"></a>00038 <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00041"></a>00041 <span class="comment">/**</span> <a name="l00042"></a>00042 <span class="comment"> @brief Dictionary object</span> <a name="l00043"></a>00043 <span class="comment"></span> <a name="l00044"></a>00044 <span class="comment"> This object contains a list of string/string associations. Each</span> <a name="l00045"></a>00045 <span class="comment"> association is identified by a unique string key. Looking up values</span> <a name="l00046"></a>00046 <span class="comment"> in the dictionary is speeded up by the use of a (hopefully collision-free)</span> <a name="l00047"></a>00047 <span class="comment"> hash function.</span> <a name="l00048"></a>00048 <span class="comment"> */</span> <a name="l00049"></a>00049 <span class="comment">/*-------------------------------------------------------------------------*/</span> <a name="l00050"></a><a class="code" href="struct__dictionary__.html">00050</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="struct__dictionary__.html" title="Dictionary object.">_dictionary_</a> { <a name="l00051"></a><a class="code" href="struct__dictionary__.html#c93e659a505b71aa87b8b558b55ee872">00051</a> <span class="keywordtype">int</span> <a class="code" href="struct__dictionary__.html#c93e659a505b71aa87b8b558b55ee872">n</a> ; <span class="comment">/** Number of entries in dictionary */</span> <a name="l00052"></a><a class="code" href="struct__dictionary__.html#2d90a3894737abd3270d8b9aefaac5ef">00052</a> <span class="keywordtype">int</span> <a class="code" href="struct__dictionary__.html#2d90a3894737abd3270d8b9aefaac5ef" title="Number of entries in dictionary.">size</a> ; <span class="comment">/** Storage size */</span> <a name="l00053"></a><a class="code" href="struct__dictionary__.html#7a89c8fb24cb365745431d881f8f0afd">00053</a> <span class="keywordtype">char</span> ** <a class="code" href="struct__dictionary__.html#7a89c8fb24cb365745431d881f8f0afd" title="Storage size.">val</a> ; <span class="comment">/** List of string values */</span> <a name="l00054"></a><a class="code" href="struct__dictionary__.html#3c962bd7edff49be125396596d1bec75">00054</a> <span class="keywordtype">char</span> ** <a class="code" href="struct__dictionary__.html#3c962bd7edff49be125396596d1bec75" title="List of string values.">key</a> ; <span class="comment">/** List of string keys */</span> <a name="l00055"></a><a class="code" href="struct__dictionary__.html#017aee3083b2fc453bcf2d7b5b51af86">00055</a> <span class="keywordtype">unsigned</span> * <a class="code" href="struct__dictionary__.html#017aee3083b2fc453bcf2d7b5b51af86" title="List of string keys.">hash</a> ; <span class="comment">/** List of hash values for keys */</span> <a name="l00056"></a>00056 } <a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> ; <a name="l00057"></a>00057 <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="comment">/*---------------------------------------------------------------------------</span> <a name="l00060"></a>00060 <span class="comment"> Function prototypes</span> <a name="l00061"></a>00061 <span class="comment"> ---------------------------------------------------------------------------*/</span> <a name="l00062"></a>00062 <a name="l00063"></a>00063 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00064"></a>00064 <span class="comment">/**</span> <a name="l00065"></a>00065 <span class="comment"> @brief Compute the hash key for a string.</span> <a name="l00066"></a>00066 <span class="comment"> @param key Character string to use for key.</span> <a name="l00067"></a>00067 <span class="comment"> @return 1 unsigned int on at least 32 bits.</span> <a name="l00068"></a>00068 <span class="comment"></span> <a name="l00069"></a>00069 <span class="comment"> This hash function has been taken from an Article in Dr Dobbs Journal.</span> <a name="l00070"></a>00070 <span class="comment"> This is normally a collision-free function, distributing keys evenly.</span> <a name="l00071"></a>00071 <span class="comment"> The key is stored anyway in the struct so that collision can be avoided</span> <a name="l00072"></a>00072 <span class="comment"> by comparing the key itself in last resort.</span> <a name="l00073"></a>00073 <span class="comment"> */</span> <a name="l00074"></a>00074 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00075"></a>00075 <span class="keywordtype">unsigned</span> <a class="code" href="dictionary_8h.html#9ad99578040354d12ba4cc518c1c18d8" title="Compute the hash key for a string.">dictionary_hash</a>(<span class="keywordtype">char</span> * key); <a name="l00076"></a>00076 <a name="l00077"></a>00077 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00078"></a>00078 <span class="comment">/**</span> <a name="l00079"></a>00079 <span class="comment"> @brief Create a new dictionary object.</span> <a name="l00080"></a>00080 <span class="comment"> @param size Optional initial size of the dictionary.</span> <a name="l00081"></a>00081 <span class="comment"> @return 1 newly allocated dictionary objet.</span> <a name="l00082"></a>00082 <span class="comment"></span> <a name="l00083"></a>00083 <span class="comment"> This function allocates a new dictionary object of given size and returns</span> <a name="l00084"></a>00084 <span class="comment"> it. If you do not know in advance (roughly) the number of entries in the</span> <a name="l00085"></a>00085 <span class="comment"> dictionary, give size=0.</span> <a name="l00086"></a>00086 <span class="comment"> */</span> <a name="l00087"></a>00087 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00088"></a>00088 <a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * <a class="code" href="dictionary_8h.html#9f584d70e3559fe6fe5f62a112bc7b17" title="Create a new dictionary object.">dictionary_new</a>(<span class="keywordtype">int</span> size); <a name="l00089"></a>00089 <a name="l00090"></a>00090 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00091"></a>00091 <span class="comment">/**</span> <a name="l00092"></a>00092 <span class="comment"> @brief Delete a dictionary object</span> <a name="l00093"></a>00093 <span class="comment"> @param d dictionary object to deallocate.</span> <a name="l00094"></a>00094 <span class="comment"> @return void</span> <a name="l00095"></a>00095 <span class="comment"></span> <a name="l00096"></a>00096 <span class="comment"> Deallocate a dictionary object and all memory associated to it.</span> <a name="l00097"></a>00097 <span class="comment"> */</span> <a name="l00098"></a>00098 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00099"></a>00099 <span class="keywordtype">void</span> <a class="code" href="dictionary_8h.html#9d792f2544cf674a371663e2f32128fa" title="Delete a dictionary object.">dictionary_del</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * vd); <a name="l00100"></a>00100 <a name="l00101"></a>00101 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00102"></a>00102 <span class="comment">/**</span> <a name="l00103"></a>00103 <span class="comment"> @brief Get a value from a dictionary.</span> <a name="l00104"></a>00104 <span class="comment"> @param d dictionary object to search.</span> <a name="l00105"></a>00105 <span class="comment"> @param key Key to look for in the dictionary.</span> <a name="l00106"></a>00106 <span class="comment"> @param def Default value to return if key not found.</span> <a name="l00107"></a>00107 <span class="comment"> @return 1 pointer to internally allocated character string.</span> <a name="l00108"></a>00108 <span class="comment"></span> <a name="l00109"></a>00109 <span class="comment"> This function locates a key in a dictionary and returns a pointer to its</span> <a name="l00110"></a>00110 <span class="comment"> value, or the passed 'def' pointer if no such key can be found in</span> <a name="l00111"></a>00111 <span class="comment"> dictionary. The returned character pointer points to data internal to the</span> <a name="l00112"></a>00112 <span class="comment"> dictionary object, you should not try to free it or modify it.</span> <a name="l00113"></a>00113 <span class="comment"> */</span> <a name="l00114"></a>00114 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00115"></a>00115 <span class="keywordtype">char</span> * <a class="code" href="dictionary_8h.html#c9d0e02363aa4220eef57a72949e1693" title="Get a value from a dictionary.">dictionary_get</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * d, <span class="keywordtype">char</span> * key, <span class="keywordtype">char</span> * def); <a name="l00116"></a>00116 <a name="l00117"></a>00117 <a name="l00118"></a>00118 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00119"></a>00119 <span class="comment">/**</span> <a name="l00120"></a>00120 <span class="comment"> @brief Get a value from a dictionary, as a char.</span> <a name="l00121"></a>00121 <span class="comment"> @param d dictionary object to search.</span> <a name="l00122"></a>00122 <span class="comment"> @param key Key to look for in the dictionary.</span> <a name="l00123"></a>00123 <span class="comment"> @param def Default value for the key if not found.</span> <a name="l00124"></a>00124 <span class="comment"> @return char </span> <a name="l00125"></a>00125 <span class="comment"></span> <a name="l00126"></a>00126 <span class="comment"> This function locates a key in a dictionary using dictionary_get,</span> <a name="l00127"></a>00127 <span class="comment"> and returns the first char of the found string.</span> <a name="l00128"></a>00128 <span class="comment"> */</span> <a name="l00129"></a>00129 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00130"></a>00130 <span class="keywordtype">char</span> <a class="code" href="dictionary_8h.html#2db28d75446968beb2b3f7332a01addf" title="Get a value from a dictionary, as a char.">dictionary_getchar</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * d, <span class="keywordtype">char</span> * key, <span class="keywordtype">char</span> def) ; <a name="l00131"></a>00131 <a name="l00132"></a>00132 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00133"></a>00133 <span class="comment">/**</span> <a name="l00134"></a>00134 <span class="comment"> @brief Get a value from a dictionary, as an int.</span> <a name="l00135"></a>00135 <span class="comment"> @param d dictionary object to search.</span> <a name="l00136"></a>00136 <span class="comment"> @param key Key to look for in the dictionary.</span> <a name="l00137"></a>00137 <span class="comment"> @param def Default value for the key if not found.</span> <a name="l00138"></a>00138 <span class="comment"> @return int</span> <a name="l00139"></a>00139 <span class="comment"></span> <a name="l00140"></a>00140 <span class="comment"> This function locates a key in a dictionary using dictionary_get,</span> <a name="l00141"></a>00141 <span class="comment"> and applies atoi on it to return an int. If the value cannot be found</span> <a name="l00142"></a>00142 <span class="comment"> in the dictionary, the default is returned.</span> <a name="l00143"></a>00143 <span class="comment"> */</span> <a name="l00144"></a>00144 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00145"></a>00145 <span class="keywordtype">int</span> <a class="code" href="dictionary_8h.html#025d09dfaf59bec27c5477040bb0d8bc" title="Get a value from a dictionary, as an int.">dictionary_getint</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * d, <span class="keywordtype">char</span> * key, <span class="keywordtype">int</span> def); <a name="l00146"></a>00146 <a name="l00147"></a>00147 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00148"></a>00148 <span class="comment">/**</span> <a name="l00149"></a>00149 <span class="comment"> @brief Get a value from a dictionary, as a double.</span> <a name="l00150"></a>00150 <span class="comment"> @param d dictionary object to search.</span> <a name="l00151"></a>00151 <span class="comment"> @param key Key to look for in the dictionary.</span> <a name="l00152"></a>00152 <span class="comment"> @param def Default value for the key if not found.</span> <a name="l00153"></a>00153 <span class="comment"> @return double</span> <a name="l00154"></a>00154 <span class="comment"></span> <a name="l00155"></a>00155 <span class="comment"> This function locates a key in a dictionary using dictionary_get,</span> <a name="l00156"></a>00156 <span class="comment"> and applies atof on it to return a double. If the value cannot be found</span> <a name="l00157"></a>00157 <span class="comment"> in the dictionary, the default is returned.</span> <a name="l00158"></a>00158 <span class="comment"> */</span> <a name="l00159"></a>00159 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00160"></a>00160 <span class="keywordtype">double</span> <a class="code" href="dictionary_8h.html#7e9beef3b2d71e071246ab0483376240" title="Get a value from a dictionary, as a double.">dictionary_getdouble</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * d, <span class="keywordtype">char</span> * key, <span class="keywordtype">double</span> def); <a name="l00161"></a>00161 <a name="l00162"></a>00162 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00163"></a>00163 <span class="comment">/**</span> <a name="l00164"></a>00164 <span class="comment"> @brief Set a value in a dictionary.</span> <a name="l00165"></a>00165 <span class="comment"> @param d dictionary object to modify.</span> <a name="l00166"></a>00166 <span class="comment"> @param key Key to modify or add.</span> <a name="l00167"></a>00167 <span class="comment"> @param val Value to add.</span> <a name="l00168"></a>00168 <span class="comment"> @return void</span> <a name="l00169"></a>00169 <span class="comment"></span> <a name="l00170"></a>00170 <span class="comment"> If the given key is found in the dictionary, the associated value is</span> <a name="l00171"></a>00171 <span class="comment"> replaced by the provided one. If the key cannot be found in the</span> <a name="l00172"></a>00172 <span class="comment"> dictionary, it is added to it.</span> <a name="l00173"></a>00173 <span class="comment"></span> <a name="l00174"></a>00174 <span class="comment"> It is Ok to provide a NULL value for val, but NULL values for the dictionary</span> <a name="l00175"></a>00175 <span class="comment"> or the key are considered as errors: the function will return immediately</span> <a name="l00176"></a>00176 <span class="comment"> in such a case.</span> <a name="l00177"></a>00177 <span class="comment"></span> <a name="l00178"></a>00178 <span class="comment"> Notice that if you dictionary_set a variable to NULL, a call to</span> <a name="l00179"></a>00179 <span class="comment"> dictionary_get will return a NULL value: the variable will be found, and</span> <a name="l00180"></a>00180 <span class="comment"> its value (NULL) is returned. In other words, setting the variable</span> <a name="l00181"></a>00181 <span class="comment"> content to NULL is equivalent to deleting the variable from the</span> <a name="l00182"></a>00182 <span class="comment"> dictionary. It is not possible (in this implementation) to have a key in</span> <a name="l00183"></a>00183 <span class="comment"> the dictionary without value.</span> <a name="l00184"></a>00184 <span class="comment"> */</span> <a name="l00185"></a>00185 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00186"></a>00186 <span class="keywordtype">void</span> <a class="code" href="dictionary_8h.html#00cabef11d2e6c50767c878567e96c1b" title="Set a value in a dictionary.">dictionary_set</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * vd, <span class="keywordtype">char</span> * key, <span class="keywordtype">char</span> * val); <a name="l00187"></a>00187 <a name="l00188"></a>00188 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00189"></a>00189 <span class="comment">/**</span> <a name="l00190"></a>00190 <span class="comment"> @brief Delete a key in a dictionary</span> <a name="l00191"></a>00191 <span class="comment"> @param d dictionary object to modify.</span> <a name="l00192"></a>00192 <span class="comment"> @param key Key to remove.</span> <a name="l00193"></a>00193 <span class="comment"> @return void</span> <a name="l00194"></a>00194 <span class="comment"></span> <a name="l00195"></a>00195 <span class="comment"> This function deletes a key in a dictionary. Nothing is done if the</span> <a name="l00196"></a>00196 <span class="comment"> key cannot be found.</span> <a name="l00197"></a>00197 <span class="comment"> */</span> <a name="l00198"></a>00198 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00199"></a>00199 <span class="keywordtype">void</span> <a class="code" href="dictionary_8h.html#108b89bce8d154d4a9f489cbc89f8b9e" title="Delete a key in a dictionary.">dictionary_unset</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * d, <span class="keywordtype">char</span> * key); <a name="l00200"></a>00200 <a name="l00201"></a>00201 <a name="l00202"></a>00202 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00203"></a>00203 <span class="comment">/**</span> <a name="l00204"></a>00204 <span class="comment"> @brief Set a key in a dictionary, providing an int.</span> <a name="l00205"></a>00205 <span class="comment"> @param d Dictionary to update.</span> <a name="l00206"></a>00206 <span class="comment"> @param key Key to modify or add</span> <a name="l00207"></a>00207 <span class="comment"> @param val Integer value to store (will be stored as a string).</span> <a name="l00208"></a>00208 <span class="comment"> @return void</span> <a name="l00209"></a>00209 <span class="comment"></span> <a name="l00210"></a>00210 <span class="comment"> This helper function calls dictionary_set() with the provided integer</span> <a name="l00211"></a>00211 <span class="comment"> converted to a string using %d.</span> <a name="l00212"></a>00212 <span class="comment"> */</span> <a name="l00213"></a>00213 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00214"></a>00214 <span class="keywordtype">void</span> <a class="code" href="dictionary_8h.html#3f4376e98032e94d25a1e970b11443e6" title="Set a key in a dictionary, providing an int.">dictionary_setint</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * d, <span class="keywordtype">char</span> * key, <span class="keywordtype">int</span> val); <a name="l00215"></a>00215 <a name="l00216"></a>00216 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00217"></a>00217 <span class="comment">/**</span> <a name="l00218"></a>00218 <span class="comment"> @brief Set a key in a dictionary, providing a double.</span> <a name="l00219"></a>00219 <span class="comment"> @param d Dictionary to update.</span> <a name="l00220"></a>00220 <span class="comment"> @param key Key to modify or add</span> <a name="l00221"></a>00221 <span class="comment"> @param val Double value to store (will be stored as a string).</span> <a name="l00222"></a>00222 <span class="comment"> @return void</span> <a name="l00223"></a>00223 <span class="comment"></span> <a name="l00224"></a>00224 <span class="comment"> This helper function calls dictionary_set() with the provided double</span> <a name="l00225"></a>00225 <span class="comment"> converted to a string using %g.</span> <a name="l00226"></a>00226 <span class="comment"> */</span> <a name="l00227"></a>00227 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00228"></a>00228 <span class="keywordtype">void</span> <a class="code" href="dictionary_8h.html#e284ec91570369462870627492dfbc28" title="Set a key in a dictionary, providing a double.">dictionary_setdouble</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * d, <span class="keywordtype">char</span> * key, <span class="keywordtype">double</span> val); <a name="l00229"></a>00229 <a name="l00230"></a>00230 <span class="comment">/*-------------------------------------------------------------------------*/</span><span class="comment"></span> <a name="l00231"></a>00231 <span class="comment">/**</span> <a name="l00232"></a>00232 <span class="comment"> @brief Dump a dictionary to an opened file pointer.</span> <a name="l00233"></a>00233 <span class="comment"> @param d Dictionary to dump</span> <a name="l00234"></a>00234 <span class="comment"> @param f Opened file pointer.</span> <a name="l00235"></a>00235 <span class="comment"> @return void</span> <a name="l00236"></a>00236 <span class="comment"></span> <a name="l00237"></a>00237 <span class="comment"> Dumps a dictionary onto an opened file pointer. Key pairs are printed out</span> <a name="l00238"></a>00238 <span class="comment"> as @c [Key]=[Value], one per line. It is Ok to provide stdout or stderr as</span> <a name="l00239"></a>00239 <span class="comment"> output file pointers.</span> <a name="l00240"></a>00240 <span class="comment"> */</span> <a name="l00241"></a>00241 <span class="comment">/*--------------------------------------------------------------------------*/</span> <a name="l00242"></a>00242 <span class="keywordtype">void</span> <a class="code" href="dictionary_8h.html#6e29ecf9c79331b1c6c26cd662cba042" title="Dump a dictionary to an opened file pointer.">dictionary_dump</a>(<a class="code" href="struct__dictionary__.html" title="Dictionary object.">dictionary</a> * d, FILE * out); <a name="l00243"></a>00243 <a name="l00244"></a>00244 <span class="preprocessor">#endif</span> </pre></div></div> </div> </div> </div> <div id="left"> <div class="menu_box"> <a name="cp-menu" /><div class="menutitle"><div> <h2 id="cp-menu-project">lomoco</h2> <a href="#cp-skip-project" class="cp-doNotDisplay">Skip menu "lomoco"</a> </div></div> <!-- menu --> <div class="menu_box"> <a name="cp-menu" /><div class="menutitle"><div> <h2 id="cp-menu-project">API Documentation</h2> <a href="#cp-skip-project" class="cp-doNotDisplay">Skip menu "@topname@"</a> </div></div> <div class="nav_list"> <ul> <!-- gmenu --> </ul></div></div> </div> </div> <div class="clearer"></div> </div> <div class="clearer"></div> </div> <div id="end_body"></div> <div id="footer"><div id="footer_text"> Generated with <a href="http://www.stack.nl/~dimitri/doxygen/" target="_blank">Doxygen</a> </div></div> </div> </body> </html>