diff options
author | hunt <hunt> | 2005-03-29 18:07:58 +0000 |
---|---|---|
committer | hunt <hunt> | 2005-03-29 18:07:58 +0000 |
commit | e32551b18f4560056d2d482f5e1505b1b98fa82a (patch) | |
tree | 4e9e07a9b46a4fd5dea27732571cbb04c0ef5dee /runtime/docs/html/map_8h-source.html | |
parent | 13b35bb112459702e7371ecc89d7deb789818a86 (diff) | |
download | systemtap-steved-e32551b18f4560056d2d482f5e1505b1b98fa82a.tar.gz systemtap-steved-e32551b18f4560056d2d482f5e1505b1b98fa82a.tar.xz systemtap-steved-e32551b18f4560056d2d482f5e1505b1b98fa82a.zip |
*** empty log message ***
Diffstat (limited to 'runtime/docs/html/map_8h-source.html')
-rw-r--r-- | runtime/docs/html/map_8h-source.html | 350 |
1 files changed, 179 insertions, 171 deletions
diff --git a/runtime/docs/html/map_8h-source.html b/runtime/docs/html/map_8h-source.html index 26b210d2..94c29074 100644 --- a/runtime/docs/html/map_8h-source.html +++ b/runtime/docs/html/map_8h-source.html @@ -4,186 +4,194 @@ <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.4.1 --> -<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> -<h1>map.h</h1><a href="map_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/* -*- linux-c -*- */</span><span class="comment"></span> -00002 <span class="comment">/** @file map.h</span> -00003 <span class="comment"> * @brief Header file for maps and lists</span> -00004 <span class="comment"> */</span> -00005 -00006 <span class="preprocessor">#include <linux/types.h></span> -00007 <span class="comment"></span> -00008 <span class="comment">/** Statistics are stored in this struct */</span> -<a name="l00009"></a><a class="code" href="structstat.html">00009</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ -00010 int64_t count; -00011 int64_t sum; -00012 int64_t min, max; -00013 int64_t histogram[BUCKETS]; -00014 } <a class="code" href="structstat.html">stat</a>; -00015 <span class="comment"></span> -00016 <span class="comment">/** Keys are either longs or char * */</span> -<a name="l00017"></a><a class="code" href="unionkey__data.html">00017</a> <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> { -00018 <span class="keywordtype">long</span> val; -00019 <span class="keywordtype">char</span> *str; -00020 }; +<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related Pages</a></div> +<h1>map.h</h1><a href="map_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="preprocessor">#ifndef _MAP_H_</span> +00002 <span class="preprocessor"></span><span class="preprocessor">#define _MAP_H_</span> +00003 <span class="preprocessor"></span><span class="comment">/* -*- linux-c -*- */</span> +00004 <span class="comment"></span> +00005 <span class="comment">/** @file map.h</span> +00006 <span class="comment"> * @brief Header file for maps and lists </span> +00007 <span class="comment"> */</span><span class="comment"></span> +00008 <span class="comment">/** @addtogroup maps </span> +00009 <span class="comment"> * @{ </span> +00010 <span class="comment"> */</span> +00011 +00012 <span class="preprocessor">#include <linux/types.h></span> +00013 <span class="comment"></span> +00014 <span class="comment">/** Statistics are stored in this struct */</span> +<a name="l00015"></a><a class="code" href="structstat.html">00015</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{ +00016 int64_t count; +00017 int64_t sum; +00018 int64_t min, max; +00019 int64_t histogram[BUCKETS]; +00020 } <a class="code" href="structstat.html">stat</a>; 00021 <span class="comment"></span> -00022 <span class="comment">/** keys can be longs or strings */</span> -<a name="l00023"></a><a class="code" href="map_8h.html#a18">00023</a> <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> { NONE, LONG, STR } __attribute__ ((packed));<span class="comment"></span> -00024 <span class="comment">/** values can be either int64, stats or strings */</span> -<a name="l00025"></a><a class="code" href="map_8h.html#a19">00025</a> <span class="keyword">enum</span> <a class="code" href="map_8h.html#a19">valtype</a> { INT64, STAT, STRING, END }; -00026 +00022 <span class="comment">/** Keys are either longs or char * */</span> +<a name="l00023"></a><a class="code" href="unionkey__data.html">00023</a> <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> { +00024 <span class="keywordtype">long</span> val; +00025 <span class="keywordtype">char</span> *str; +00026 }; 00027 <span class="comment"></span> -00028 <span class="comment">/** basic map element */</span> -<a name="l00029"></a><a class="code" href="structmap__node.html">00029</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> {<span class="comment"></span> -00030 <span class="comment"> /** list of other nodes in the map */</span> -<a name="l00031"></a><a class="code" href="structmap__node.html#o0">00031</a> <span class="keyword">struct </span>list_head lnode;<span class="comment"></span> -00032 <span class="comment"> /** list of nodes with the same hash value */</span> -<a name="l00033"></a><a class="code" href="structmap__node.html#o1">00033</a> <span class="keyword">struct </span>hlist_node hnode; -00034 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> key1; -00035 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> key2; -00036 <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> key1type; -00037 <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> key2type; -00038 }; -00039 <span class="comment"></span> -00040 <span class="comment">/** map element containing int64 */</span> -<a name="l00041"></a><a class="code" href="structmap__node__int64.html">00041</a> <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> { -00042 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n; -00043 int64_t val; +00028 <span class="comment">/** keys can be longs or strings */</span> +<a name="l00029"></a><a class="code" href="group__maps.html#ga32">00029</a> <span class="keyword">enum</span> <a class="code" href="group__maps.html#ga32">keytype</a> { NONE, LONG, STR } __attribute__ ((packed));<span class="comment"></span> +00030 <span class="comment">/** values can be either int64, stats or strings */</span> +<a name="l00031"></a><a class="code" href="group__maps.html#ga33">00031</a> <span class="keyword">enum</span> <a class="code" href="group__maps.html#ga33">valtype</a> { INT64, STAT, STRING, END }; +00032 +00033 <span class="comment"></span> +00034 <span class="comment">/** basic map element */</span> +<a name="l00035"></a><a class="code" href="structmap__node.html">00035</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> {<span class="comment"></span> +00036 <span class="comment"> /** list of other nodes in the map */</span> +<a name="l00037"></a><a class="code" href="structmap__node.html#o0">00037</a> <span class="keyword">struct </span>list_head lnode;<span class="comment"></span> +00038 <span class="comment"> /** list of nodes with the same hash value */</span> +<a name="l00039"></a><a class="code" href="structmap__node.html#o1">00039</a> <span class="keyword">struct </span>hlist_node hnode; +00040 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> key1; +00041 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> key2; +00042 <span class="keyword">enum</span> <a class="code" href="group__maps.html#ga32">keytype</a> key1type; +00043 <span class="keyword">enum</span> <a class="code" href="group__maps.html#ga32">keytype</a> key2type; 00044 }; 00045 <span class="comment"></span> -00046 <span class="comment">/** map element containing string */</span> -<a name="l00047"></a><a class="code" href="structmap__node__str.html">00047</a> <span class="keyword">struct </span><a class="code" href="structmap__node__str.html">map_node_str</a> { +00046 <span class="comment">/** map element containing int64 */</span> +<a name="l00047"></a><a class="code" href="structmap__node__int64.html">00047</a> <span class="keyword">struct </span><a class="code" href="structmap__node__int64.html">map_node_int64</a> { 00048 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n; -00049 <span class="keywordtype">char</span> *str; +00049 int64_t val; 00050 }; 00051 <span class="comment"></span> -00052 <span class="comment">/** map element containing stats */</span> -<a name="l00053"></a><a class="code" href="structmap__node__stat.html">00053</a> <span class="keyword">struct </span><a class="code" href="structmap__node__stat.html">map_node_stat</a> { +00052 <span class="comment">/** map element containing string */</span> +<a name="l00053"></a><a class="code" href="structmap__node__str.html">00053</a> <span class="keyword">struct </span><a class="code" href="structmap__node__str.html">map_node_str</a> { 00054 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n; -00055 <a class="code" href="structstat.html">stat</a> stats; +00055 <span class="keywordtype">char</span> *str; 00056 }; 00057 <span class="comment"></span> -00058 <span class="comment">/** This structure contains all information about a map.</span> -00059 <span class="comment"> * It is allocated once when _stp_map_new() is called. </span> -00060 <span class="comment"> */</span> -<a name="l00061"></a><a class="code" href="structmap__root.html">00061</a> <span class="keyword">struct </span><a class="code" href="structmap__root.html">map_root</a> {<span class="comment"></span> -00062 <span class="comment"> /** type of the values stored in the array */</span> -<a name="l00063"></a><a class="code" href="structmap__root.html#o0">00063</a> <span class="keyword">enum</span> <a class="code" href="map_8h.html#a19">valtype</a> <a class="code" href="structmap__root.html#o0">type</a>; -00064 <span class="comment"></span> -00065 <span class="comment"> /** maximum number of elements allowed in the array. */</span> -<a name="l00066"></a><a class="code" href="structmap__root.html#o1">00066</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o1">maxnum</a>; -00067 <span class="comment"></span> -00068 <span class="comment"> /** current number of used elements */</span> -<a name="l00069"></a><a class="code" href="structmap__root.html#o2">00069</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o2">num</a>; -00070 <span class="comment"></span> -00071 <span class="comment"> /** when more than maxnum elements, wrap or discard? */</span> -<a name="l00072"></a><a class="code" href="structmap__root.html#o3">00072</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o3">no_wrap</a>; +00058 <span class="comment">/** map element containing stats */</span> +<a name="l00059"></a><a class="code" href="structmap__node__stat.html">00059</a> <span class="keyword">struct </span><a class="code" href="structmap__node__stat.html">map_node_stat</a> { +00060 <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> n; +00061 <a class="code" href="structstat.html">stat</a> stats; +00062 }; +00063 <span class="comment"></span> +00064 <span class="comment">/** This structure contains all information about a map.</span> +00065 <span class="comment"> * It is allocated once when _stp_map_new() is called. </span> +00066 <span class="comment"> */</span> +<a name="l00067"></a><a class="code" href="structmap__root.html">00067</a> <span class="keyword">struct </span><a class="code" href="structmap__root.html">map_root</a> {<span class="comment"></span> +00068 <span class="comment"> /** type of the values stored in the array */</span> +<a name="l00069"></a><a class="code" href="structmap__root.html#o0">00069</a> <span class="keyword">enum</span> <a class="code" href="group__maps.html#ga33">valtype</a> <a class="code" href="structmap__root.html#o0">type</a>; +00070 <span class="comment"></span> +00071 <span class="comment"> /** maximum number of elements allowed in the array. */</span> +<a name="l00072"></a><a class="code" href="structmap__root.html#o1">00072</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o1">maxnum</a>; 00073 <span class="comment"></span> -00074 <span class="comment"> /** linked list of current entries */</span> -<a name="l00075"></a><a class="code" href="structmap__root.html#o4">00075</a> <span class="keyword">struct </span>list_head head; +00074 <span class="comment"> /** current number of used elements */</span> +<a name="l00075"></a><a class="code" href="structmap__root.html#o2">00075</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o2">num</a>; 00076 <span class="comment"></span> -00077 <span class="comment"> /** pool of unused entries. Used only when entries are statically allocated</span> -00078 <span class="comment"> at startup. */</span> -<a name="l00079"></a><a class="code" href="structmap__root.html#o5">00079</a> <span class="keyword">struct </span>list_head pool; -00080 <span class="comment"></span> -00081 <span class="comment"> /** saved key entry for lookups */</span> -<a name="l00082"></a><a class="code" href="structmap__root.html#o6">00082</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="structmap__root.html#o6">key</a>; -00083 <span class="comment"></span> -00084 <span class="comment"> /** this is the creation data saved between the key functions and the</span> -00085 <span class="comment"> set/get functions </span> -00086 <span class="comment"> @todo Needs to be per-cpu data for SMP support */</span> -<a name="l00087"></a><a class="code" href="structmap__root.html#o7">00087</a> u_int8_t <a class="code" href="structmap__root.html#o7">create</a>; -00088 <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> c_key1type; -00089 <span class="keyword">enum</span> <a class="code" href="map_8h.html#a18">keytype</a> c_key2type; -00090 <span class="keyword">struct </span>hlist_head *c_keyhead; -00091 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> c_key1; -00092 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> c_key2; -00093 <span class="comment"></span> -00094 <span class="comment"> /** the hash table for this array */</span> -<a name="l00095"></a><a class="code" href="structmap__root.html#o13">00095</a> <span class="keyword">struct </span>hlist_head hashes[HASH_TABLE_SIZE]; -00096 <span class="comment"></span> -00097 <span class="comment"> /** pointer to allocated memory space. Used for freeing memory. */</span> -<a name="l00098"></a><a class="code" href="structmap__root.html#o14">00098</a> <span class="keywordtype">void</span> *<a class="code" href="structmap__root.html#o14">membuf</a>; -00099 }; -00100 <span class="comment"></span> -00101 <span class="comment">/** All maps are of this type. */</span> -<a name="l00102"></a><a class="code" href="map_8h.html#a10">00102</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structmap__root.html">map_root</a> *<a class="code" href="structmap__root.html">MAP</a>; -00103 <span class="comment"></span> -00104 <span class="comment">/** Extracts string from key1 union */</span> -<a name="l00105"></a><a class="code" href="map_8h.html#a0">00105</a> <span class="preprocessor">#define key1str(ptr) (ptr->n.key1.str)</span> -00106 <span class="preprocessor"></span><span class="comment">/** Extracts string from key2 union */</span> -<a name="l00107"></a><a class="code" href="map_8h.html#a1">00107</a> <span class="preprocessor">#define key2str(ptr) (ptr->n.key2.str)</span> -00108 <span class="preprocessor"></span><span class="comment">/** Extracts int from key1 union */</span> -<a name="l00109"></a><a class="code" href="map_8h.html#a2">00109</a> <span class="preprocessor">#define key1int(ptr) (ptr->n.key1.val)</span> -00110 <span class="preprocessor"></span><span class="comment">/** Extracts int from key2 union */</span> -<a name="l00111"></a><a class="code" href="map_8h.html#a3">00111</a> <span class="preprocessor">#define key2int(ptr) (ptr->n.key2.val)</span> -00112 <span class="preprocessor"></span><span class="comment"></span> -00113 <span class="comment">/** Macro to call the proper _stp_map_key functions based on the</span> -00114 <span class="comment"> * types of the arguments. </span> -00115 <span class="comment"> * @note May cause compiler warning on some GCCs </span> -00116 <span class="comment"> */</span> -<a name="l00117"></a><a class="code" href="map_8h.html#a4">00117</a> <span class="preprocessor">#define _stp_map_key2(map, key1, key2) \</span> -00118 <span class="preprocessor"> ({ \</span> -00119 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key1), char[])) \</span> -00120 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key2), char[])) \</span> -00121 <span class="preprocessor"> _stp_map_key_str_str (map, (char *)(key1), (char *)(key2)); \</span> -00122 <span class="preprocessor"> else \</span> -00123 <span class="preprocessor"> _stp_map_key_str_long (map, (char *)(key1), (long)(key2)); \</span> -00124 <span class="preprocessor"> else \</span> -00125 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key2), char[])) \</span> -00126 <span class="preprocessor"> _stp_map_key_long_str (map, (long)(key1), (char *)(key2)); \</span> -00127 <span class="preprocessor"> else \</span> -00128 <span class="preprocessor"> _stp_map_key_long_long (map, (long)(key1), (long)(key2)); \</span> -00129 <span class="preprocessor"> })</span> -00130 <span class="preprocessor"></span><span class="comment"></span> -00131 <span class="comment">/** Macro to call the proper _stp_map_key function based on the</span> -00132 <span class="comment"> * type of the argument. </span> -00133 <span class="comment"> * @note May cause compiler warning on some GCCs </span> -00134 <span class="comment"> */</span> -<a name="l00135"></a><a class="code" href="map_8h.html#a5">00135</a> <span class="preprocessor">#define _stp_map_key(map, key) \</span> -00136 <span class="preprocessor"> ({ \</span> -00137 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key), char[])) \</span> -00138 <span class="preprocessor"> _stp_map_key_str (map, (char *)(key)); \</span> -00139 <span class="preprocessor"> else \</span> -00140 <span class="preprocessor"> _stp_map_key_long (map, (long)(key)); \</span> -00141 <span class="preprocessor"> })</span> -00142 <span class="preprocessor"></span><span class="comment"></span> -00143 <span class="comment">/** Macro to call the proper _stp_map_set function based on the</span> -00144 <span class="comment"> * type of the argument. </span> -00145 <span class="comment"> * @note May cause compiler warning on some GCCs </span> -00146 <span class="comment"> */</span> -<a name="l00147"></a><a class="code" href="map_8h.html#a6">00147</a> <span class="preprocessor">#define _stp_map_set(map, val) \</span> -00148 <span class="preprocessor"> ({ \</span> -00149 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (val), char[])) \</span> -00150 <span class="preprocessor"> _stp_map_set_str (map, (char *)(val)); \</span> -00151 <span class="preprocessor"> else \</span> -00152 <span class="preprocessor"> _stp_map_set_int64 (map, (int64_t)(val)); \</span> -00153 <span class="preprocessor"> })</span> -00154 <span class="preprocessor"></span><span class="comment"></span> -00155 <span class="comment">/** Macro to call the proper _stp_list_add function based on the</span> -00156 <span class="comment"> * types of the argument. </span> -00157 <span class="comment"> * @note May cause compiler warning on some GCCs </span> -00158 <span class="comment"> */</span> -<a name="l00159"></a><a class="code" href="map_8h.html#a7">00159</a> <span class="preprocessor">#define _stp_list_add(map, val) \</span> -00160 <span class="preprocessor"> ({ \</span> -00161 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (val), char[])) \</span> -00162 <span class="preprocessor"> _stp_list_add_str (map, (char *)(val)); \</span> -00163 <span class="preprocessor"> else \</span> -00164 <span class="preprocessor"> _stp_list_add_int64 (map, (int64_t)(val)); \</span> -00165 <span class="preprocessor"> })</span> -00166 <span class="preprocessor"></span> -00167 <span class="comment"></span> -00168 <span class="comment">/** Loop through all elements of a map.</span> -00169 <span class="comment"> * @param map </span> -00170 <span class="comment"> * @param ptr pointer to a map_node_stat, map_node_int64 or map_node_str</span> -00171 <span class="comment"> *</span> -00172 <span class="comment"> * @b Example:</span> -00173 <span class="comment"> * @include foreach.c</span> -00174 <span class="comment"> */</span> -00175 -<a name="l00176"></a><a class="code" href="map_8h.html#a8">00176</a> <span class="preprocessor">#define foreach(map, ptr) \</span> -00177 <span class="preprocessor"> for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \</span> -00178 <span class="preprocessor"> ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))</span> -00179 <span class="preprocessor"></span> -</pre></div><hr size="1"><address style="align: right;"><small> -Generated on Tue Mar 22 10:27:36 2005 for SystemTap.</small></body> -</html> +00077 <span class="comment"> /** when more than maxnum elements, wrap or discard? */</span> +<a name="l00078"></a><a class="code" href="structmap__root.html#o3">00078</a> <span class="keywordtype">int</span> <a class="code" href="structmap__root.html#o3">no_wrap</a>; +00079 <span class="comment"></span> +00080 <span class="comment"> /** linked list of current entries */</span> +<a name="l00081"></a><a class="code" href="structmap__root.html#o4">00081</a> <span class="keyword">struct </span>list_head head; +00082 <span class="comment"></span> +00083 <span class="comment"> /** pool of unused entries. Used only when entries are statically allocated</span> +00084 <span class="comment"> at startup. */</span> +<a name="l00085"></a><a class="code" href="structmap__root.html#o5">00085</a> <span class="keyword">struct </span>list_head pool; +00086 <span class="comment"></span> +00087 <span class="comment"> /** saved key entry for lookups */</span> +<a name="l00088"></a><a class="code" href="structmap__root.html#o6">00088</a> <span class="keyword">struct </span><a class="code" href="structmap__node.html">map_node</a> *<a class="code" href="structmap__root.html#o6">key</a>; +00089 <span class="comment"></span> +00090 <span class="comment"> /** this is the creation data saved between the key functions and the</span> +00091 <span class="comment"> set/get functions </span> +00092 <span class="comment"> @todo Needs to be per-cpu data for SMP support */</span> +<a name="l00093"></a><a class="code" href="structmap__root.html#o7">00093</a> u_int8_t <a class="code" href="structmap__root.html#o7">create</a>; +00094 <span class="keyword">enum</span> <a class="code" href="group__maps.html#ga32">keytype</a> c_key1type; +00095 <span class="keyword">enum</span> <a class="code" href="group__maps.html#ga32">keytype</a> c_key2type; +00096 <span class="keyword">struct </span>hlist_head *c_keyhead; +00097 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> c_key1; +00098 <span class="keyword">union </span><a class="code" href="unionkey__data.html">key_data</a> c_key2; +00099 <span class="comment"></span> +00100 <span class="comment"> /** the hash table for this array */</span> +<a name="l00101"></a><a class="code" href="structmap__root.html#o13">00101</a> <span class="keyword">struct </span>hlist_head hashes[HASH_TABLE_SIZE]; +00102 <span class="comment"></span> +00103 <span class="comment"> /** pointer to allocated memory space. Used for freeing memory. */</span> +<a name="l00104"></a><a class="code" href="structmap__root.html#o14">00104</a> <span class="keywordtype">void</span> *<a class="code" href="structmap__root.html#o14">membuf</a>; +00105 }; +00106 <span class="comment"></span> +00107 <span class="comment">/** All maps are of this type. */</span> +<a name="l00108"></a><a class="code" href="group__maps.html#ga1">00108</a> <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="structmap__root.html">map_root</a> *<a class="code" href="structmap__root.html">MAP</a>; +00109 <span class="comment"></span> +00110 <span class="comment">/** Extracts string from key1 union */</span> +<a name="l00111"></a><a class="code" href="group__maps.html#ga24">00111</a> <span class="preprocessor">#define key1str(ptr) (ptr->n.key1.str)</span> +00112 <span class="preprocessor"></span><span class="comment">/** Extracts string from key2 union */</span> +<a name="l00113"></a><a class="code" href="group__maps.html#ga25">00113</a> <span class="preprocessor">#define key2str(ptr) (ptr->n.key2.str)</span> +00114 <span class="preprocessor"></span><span class="comment">/** Extracts int from key1 union */</span> +<a name="l00115"></a><a class="code" href="group__maps.html#ga26">00115</a> <span class="preprocessor">#define key1int(ptr) (ptr->n.key1.val)</span> +00116 <span class="preprocessor"></span><span class="comment">/** Extracts int from key2 union */</span> +<a name="l00117"></a><a class="code" href="group__maps.html#ga27">00117</a> <span class="preprocessor">#define key2int(ptr) (ptr->n.key2.val)</span> +00118 <span class="preprocessor"></span><span class="comment"></span> +00119 <span class="comment">/** Macro to call the proper _stp_map_key functions based on the</span> +00120 <span class="comment"> * types of the arguments. </span> +00121 <span class="comment"> * @note May cause compiler warning on some GCCs </span> +00122 <span class="comment"> */</span> +<a name="l00123"></a><a class="code" href="group__maps.html#ga28">00123</a> <span class="preprocessor">#define _stp_map_key2(map, key1, key2) \</span> +00124 <span class="preprocessor"> ({ \</span> +00125 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key1), char[])) \</span> +00126 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key2), char[])) \</span> +00127 <span class="preprocessor"> _stp_map_key_str_str (map, (char *)(key1), (char *)(key2)); \</span> +00128 <span class="preprocessor"> else \</span> +00129 <span class="preprocessor"> _stp_map_key_str_long (map, (char *)(key1), (long)(key2)); \</span> +00130 <span class="preprocessor"> else \</span> +00131 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key2), char[])) \</span> +00132 <span class="preprocessor"> _stp_map_key_long_str (map, (long)(key1), (char *)(key2)); \</span> +00133 <span class="preprocessor"> else \</span> +00134 <span class="preprocessor"> _stp_map_key_long_long (map, (long)(key1), (long)(key2)); \</span> +00135 <span class="preprocessor"> })</span> +00136 <span class="preprocessor"></span><span class="comment"></span> +00137 <span class="comment">/** Macro to call the proper _stp_map_key function based on the</span> +00138 <span class="comment"> * type of the argument. </span> +00139 <span class="comment"> * @note May cause compiler warning on some GCCs </span> +00140 <span class="comment"> */</span> +<a name="l00141"></a><a class="code" href="group__maps.html#ga29">00141</a> <span class="preprocessor">#define _stp_map_key(map, key) \</span> +00142 <span class="preprocessor"> ({ \</span> +00143 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (key), char[])) \</span> +00144 <span class="preprocessor"> _stp_map_key_str (map, (char *)(key)); \</span> +00145 <span class="preprocessor"> else \</span> +00146 <span class="preprocessor"> _stp_map_key_long (map, (long)(key)); \</span> +00147 <span class="preprocessor"> })</span> +00148 <span class="preprocessor"></span><span class="comment"></span> +00149 <span class="comment">/** Macro to call the proper _stp_map_set function based on the</span> +00150 <span class="comment"> * type of the argument. </span> +00151 <span class="comment"> * @note May cause compiler warning on some GCCs </span> +00152 <span class="comment"> */</span> +<a name="l00153"></a><a class="code" href="group__maps.html#ga30">00153</a> <span class="preprocessor">#define _stp_map_set(map, val) \</span> +00154 <span class="preprocessor"> ({ \</span> +00155 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (val), char[])) \</span> +00156 <span class="preprocessor"> _stp_map_set_str (map, (char *)(val)); \</span> +00157 <span class="preprocessor"> else \</span> +00158 <span class="preprocessor"> _stp_map_set_int64 (map, (int64_t)(val)); \</span> +00159 <span class="preprocessor"> })</span> +00160 <span class="preprocessor"></span><span class="comment"></span> +00161 <span class="comment">/** Loop through all elements of a map or list.</span> +00162 <span class="comment"> * @param map </span> +00163 <span class="comment"> * @param ptr pointer to a map_node_stat, map_node_int64 or map_node_str</span> +00164 <span class="comment"> *</span> +00165 <span class="comment"> * @b Example:</span> +00166 <span class="comment"> * @include foreach.c</span> +00167 <span class="comment"> */</span> +00168 +<a name="l00169"></a><a class="code" href="group__maps.html#ga31">00169</a> <span class="preprocessor">#define foreach(map, ptr) \</span> +00170 <span class="preprocessor"> for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \</span> +00171 <span class="preprocessor"> ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))</span> +00172 <span class="preprocessor"></span><span class="comment"></span> +00173 <span class="comment">/** @} */</span> +00174 <span class="comment"></span> +00175 <span class="comment">/** @ingroup lists</span> +00176 <span class="comment"> * @brief Macro to call the proper _stp_list_add function based on the</span> +00177 <span class="comment"> * types of the argument. </span> +00178 <span class="comment"> *</span> +00179 <span class="comment"> * @note May cause compiler warning on some GCCs </span> +00180 <span class="comment"> */</span> +<a name="l00181"></a><a class="code" href="group__lists.html#ga5">00181</a> <span class="preprocessor">#define _stp_list_add(map, val) \</span> +00182 <span class="preprocessor"> ({ \</span> +00183 <span class="preprocessor"> if (__builtin_types_compatible_p (typeof (val), char[])) \</span> +00184 <span class="preprocessor"> _stp_list_add_str (map, (char *)(val)); \</span> +00185 <span class="preprocessor"> else \</span> +00186 <span class="preprocessor"> _stp_list_add_int64 (map, (int64_t)(val)); \</span> +00187 <span class="preprocessor"> })</span> +00188 <span class="preprocessor"></span> +00189 <span class="preprocessor">#endif </span><span class="comment">/* _MAP_H_ */</span> +</pre></div></body></html> |