hoclist.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #ifndef hoc_list_h
00047 #define hoc_list_h
00048
00049 #if HOC_L_LIST
00050 #define stralloc hoc_l_stralloc
00051 #define newitem hoc_l_newitem
00052 #define newlist hoc_l_newlist
00053 #define freelist hoc_l_freelist
00054 #define next hoc_l_next
00055 #define prev hoc_l_prev
00056 #define insertstr hoc_l_insertstr
00057 #define insertitem hoc_l_insertitem
00058 #define insertlist hoc_l_insertlist
00059 #define insertsym hoc_l_insertsym
00060 #define insertsec hoc_l_insertsec
00061 #define insertobj hoc_l_insertobj
00062 #define insertvoid hoc_l_insertvoid
00063 #define linsertsym hoc_l_linsertsym
00064 #define linsertstr hoc_l_linsertstr
00065 #define lappendsym hoc_l_lappendsym
00066 #define lappendstr hoc_l_lappendstr
00067 #define lappenditem hoc_l_lappenditem
00068 #define lappendlst hoc_l_lappendlst
00069 #define lappendsec hoc_l_lappendsec
00070 #define lappendobj hoc_l_lappendobj
00071 #define lappendvoid hoc_l_lappendvoid
00072 #define delete hoc_l_delete
00073 #define delitems hoc_l_delitems
00074 #define move hoc_l_move
00075 #define movelist hoc_l_movelist
00076 #define replacstr hoc_l_replacstr
00077 #define Item hoc_Item
00078 #define List hoc_List
00079
00080 typedef struct hoc_Item hoc_List;
00081 #else
00082 #define hoc_List struct hoc_Item
00083 #endif
00084
00085 typedef struct hoc_Item {
00086 union {
00087 struct hoc_Item *itm;
00088 hoc_List *lst;
00089 char *str;
00090 struct Symbol *sym;
00091 struct Section* sec;
00092 struct Object* obj;
00093 void* vd;
00094 } element;
00095 struct hoc_Item *next;
00096 struct hoc_Item *prev;
00097 short itemtype;
00098 } hoc_Item;
00099 #define ITEM0 (hoc_Item *)0
00100 #define LIST0 (hoc_List *)0
00101
00102 #define ITERATE(itm,lst) for (itm = (lst)->next; itm != (lst); itm = itm->next)
00103
00104
00105
00106
00107 #define SYM(q) ((q)->element.sym)
00108 #define STR(q) ((q)->element.str)
00109 #define ITM(q) ((q)->element.itm)
00110 #define LST(q) ((q)->element.lst)
00111 #define hocSEC(q) ((q)->element.sec)
00112 #define OBJ(q) ((q)->element.obj)
00113 #define VOIDITM(q) ((q)->element.vd)
00114
00115
00116 #define ITEM 2
00117 #define LIST 3
00118 #define VOIDPOINTER 4
00119
00120
00121
00122
00123 #ifdef __cplusplus
00124
00125 extern char* hoc_l_stralloc(char*, char* release=nil);
00126 extern hoc_List* hoc_l_newlist();
00127 extern hoc_Item* hoc_l_insertstr(hoc_Item*, char*);
00128 extern hoc_Item* hoc_l_insertsym(hoc_Item*, Symbol*);
00129 extern hoc_Item* hoc_l_insertitem(hoc_Item*, hoc_Item*);
00130 extern hoc_Item* hoc_l_insertlist(hoc_Item*, hoc_List*);
00131 extern hoc_Item* hoc_l_insertsec(hoc_Item*, Section*);
00132 extern hoc_Item* hoc_l_insertvoid(hoc_Item*, void*);
00133
00134 extern hoc_Item* hoc_l_linsertstr(hoc_List*, char*);
00135 extern hoc_Item* hoc_l_linsertsym(hoc_List*, Symbol*);
00136
00137 extern hoc_Item* hoc_l_lappendstr(hoc_List*, char*);
00138 extern hoc_Item* hoc_l_lappendsym(hoc_List*, Symbol*);
00139 extern hoc_Item* hoc_l_lappenditem(hoc_List*, hoc_Item*);
00140 extern hoc_Item* hoc_l_lappendlst(hoc_List*, hoc_List*);
00141 extern hoc_Item* hoc_l_lappendsec(hoc_List*, Section*);
00142 extern hoc_Item* hoc_l_lappendvoid(hoc_List*, void*);
00143 extern hoc_Item* hoc_l_lappendobj(hoc_List*, Object*);
00144
00145 extern void hoc_l_freelist(hoc_List**);
00146 extern hoc_Item* hoc_l_next(hoc_Item*);
00147 extern hoc_Item* hoc_l_prev(hoc_Item*);
00148 extern void hoc_l_delete(hoc_Item*);
00149 extern void hoc_l_move(hoc_Item*, hoc_Item*, hoc_Item*);
00150 extern void hoc_l_movelist(hoc_Item*, hoc_Item*, hoc_List*);
00151 extern void hoc_l_replacstr(hoc_Item*, char*);
00152
00153 #else
00154 extern char
00155 *hoc_l_stralloc();
00156
00157 extern hoc_List
00158 *hoc_l_newlist();
00159 extern hoc_Item
00160 *hoc_l_insertstr(),
00161 *hoc_l_insertsym(),
00162 *hoc_l_insertsec(),
00163 *hoc_l_insertobj(),
00164 *hoc_l_insertvoid(),
00165 *hoc_l_linsertstr(),
00166 *hoc_l_lappendstr(),
00167 *hoc_l_linsertsym(),
00168 *hoc_l_lappendsym(),
00169 *hoc_l_lappenditem(),
00170 *hoc_l_lappendlst(),
00171 *hoc_l_lappendsec(),
00172 *hoc_l_lappendobj(),
00173 *hoc_l_lappendvoid(),
00174 *hoc_l_next(),
00175 *hoc_l_prev();
00176
00177
00178 #if LINT
00179 #undef assert
00180 #define assert(arg) {if (arg) ;}
00181 extern char *clint;
00182 extern int ilint;
00183 extern hoc_Item *qlint;
00184 #define Insertstr qlint = insertstr
00185 #define Insertsym qlint = insertsym
00186 #define Insertsec qlint = insertsec
00187 #define Linsertsym qlint = linsertsym
00188 #define Linsertstr qlint = linsertstr
00189 #define Lappendsym qlint = lappendsym
00190 #define Lappendstr qlint = lappendstr
00191 #define Lappenditem qlint = lappenditem
00192 #define Lappendlst qlint = lappendlst
00193 #define Lappendsec qlint = lappendsec
00194 #else
00195 #define Insertstr insertstr
00196 #define Insertsym insertsym
00197 #define Insertsec insertsec
00198 #define Linsertsym linsertsym
00199 #define Linsertstr linsertstr
00200 #define Lappendsym lappendsym
00201 #define Lappendstr lappendstr
00202 #define Lappenditem lappenditem
00203 #define Lappendlst lappendlst
00204 #define Lappendsec lappendsec
00205 #endif
00206 #endif
00207 #endif