NEURON
hoclist.h
Go to the documentation of this file.
1 #ifndef hoc_list_h
2 #define hoc_list_h
3 
4 #if HOC_L_LIST
5 #define stralloc hoc_l_stralloc
6 #define newitem hoc_l_newitem
7 #define newlist hoc_l_newlist
8 #define freelist hoc_l_freelist
9 #define next hoc_l_next
10 #define prev hoc_l_prev
11 #define insertstr hoc_l_insertstr
12 #define insertitem hoc_l_insertitem
13 #define insertlist hoc_l_insertlist
14 #define insertsym hoc_l_insertsym
15 #define insertsec hoc_l_insertsec
16 #define insertobj hoc_l_insertobj
17 #define insertvoid hoc_l_insertvoid
18 #define linsertsym hoc_l_linsertsym
19 #define linsertstr hoc_l_linsertstr
20 #define lappendsym hoc_l_lappendsym
21 #define lappendstr hoc_l_lappendstr
22 #define lappenditem hoc_l_lappenditem
23 #define lappendlst hoc_l_lappendlst
24 #define lappendsec hoc_l_lappendsec
25 #define lappendobj hoc_l_lappendobj
26 #define lappendvoid hoc_l_lappendvoid
27 #define delete hoc_l_delete
28 #define delitems hoc_l_delitems
29 #define move hoc_l_move
30 #define movelist hoc_l_movelist
31 #define replacstr hoc_l_replacstr
32 #define Item hoc_Item
33 #define List hoc_List
34 
35 typedef struct hoc_Item hoc_List; /* list of mixed items */
36 #else
37 #define hoc_List struct hoc_Item
38 #endif
39 
40 typedef struct hoc_Item {
41  union {
42  struct hoc_Item *itm;
44  char *str;
45  struct Symbol *sym;
46  struct Section* sec;
47  struct Object* obj;
48  void* vd;
49  } element; /* pointer to the actual item */
50  struct hoc_Item *next;
51  struct hoc_Item *prev;
52  short itemtype;
53 } hoc_Item;
54 #define ITEM0 (hoc_Item *)0
55 #define LIST0 (hoc_List *)0
56 
57 #define ITERATE(itm,lst) for (itm = (lst)->next; itm != (lst); itm = itm->next)
58 /*
59  * this is convenient way to get the element pointer if you know what type
60  * the item is
61  */
62 #define SYM(q) ((q)->element.sym)
63 #define STR(q) ((q)->element.str)
64 #define ITM(q) ((q)->element.itm)
65 #define LST(q) ((q)->element.lst)
66 #define hocSEC(q) ((q)->element.sec)
67 #define OBJ(q) ((q)->element.obj)
68 #define VOIDITM(q) ((q)->element.vd)
69 
70 /* types not defined in parser */
71 #define ITEM 2
72 #define LIST 3
73 #define VOIDPOINTER 4
74 /*
75  * An item type, STRING is also used as an item type
76  */
77 
78 extern char *hoc_l_stralloc(const char *, char *release);
79 extern hoc_List *hoc_l_newlist();
80 extern hoc_Item *hoc_l_insertstr(hoc_Item *, const char *);
81 extern hoc_Item *hoc_l_insertsym(hoc_Item *, struct Symbol *);
84 extern hoc_Item *hoc_l_insertsec(hoc_Item *, struct Section *);
85 extern hoc_Item *hoc_l_insertvoid(hoc_Item *, void *);
86 extern hoc_Item *hoc_l_linsertstr(hoc_List *, const char *);
87 extern hoc_Item *hoc_l_linsertsym(hoc_List *, struct Symbol *);
88 extern hoc_Item *hoc_l_lappendstr(hoc_List *, const char *);
89 extern hoc_Item *hoc_l_lappendsym(hoc_List *, struct Symbol *);
92 extern hoc_Item *hoc_l_lappendsec(hoc_List *, struct Section *);
93 extern hoc_Item *hoc_l_lappendvoid(hoc_List *, void *);
94 extern hoc_Item *hoc_l_lappendobj(hoc_List *, struct Object *);
95 extern void hoc_l_freelist(hoc_List **);
96 extern hoc_Item *hoc_l_next(hoc_Item *);
97 extern hoc_Item *hoc_l_prev(hoc_Item *);
98 extern void hoc_l_delete(hoc_Item *);
99 extern void hoc_l_move(hoc_Item *, hoc_Item *, hoc_Item *);
100 extern void hoc_l_movelist(hoc_Item *, hoc_Item *, hoc_List *);
101 extern void hoc_l_replacstr(hoc_Item *, const char *);
102 
103 #define Insertstr insertstr
104 #define Insertsym insertsym
105 #define Insertsec insertsec
106 #define Linsertsym linsertsym
107 #define Linsertstr linsertstr
108 #define Lappendsym lappendsym
109 #define Lappendstr lappendstr
110 #define Lappenditem lappenditem
111 #define Lappendlst lappendlst
112 #define Lappendsec lappendsec
113 
114 
115 #endif
struct hoc_Item hoc_Item
hoc_Item * hoc_l_linsertstr(hoc_List *, const char *)
hoc_List * hoc_l_newlist()
hoc_Item * hoc_l_insertlist(hoc_Item *, hoc_List *)
struct Section * sec
Definition: hoclist.h:46
hoc_Item * hoc_l_linsertsym(hoc_List *, struct Symbol *)
void hoc_l_move(hoc_Item *, hoc_Item *, hoc_Item *)
short itemtype
Definition: hoclist.h:52
char * hoc_l_stralloc(const char *, char *release)
void hoc_l_delete(hoc_Item *)
struct Object * obj
Definition: hoclist.h:47
void hoc_l_freelist(hoc_List **)
hoc_Item * hoc_l_lappendobj(hoc_List *, struct Object *)
hoc_Item * hoc_l_prev(hoc_Item *)
void hoc_l_replacstr(hoc_Item *, const char *)
char * str
Definition: hoclist.h:44
hoc_Item * hoc_l_lappendstr(hoc_List *, const char *)
hoc_Item * hoc_l_insertsec(hoc_Item *, struct Section *)
hoc_Item * hoc_l_lappendvoid(hoc_List *, void *)
void hoc_l_movelist(hoc_Item *, hoc_Item *, hoc_List *)
hoc_List * lst
Definition: hoclist.h:43
struct Symbol * sym
Definition: hoclist.h:45
Definition: model.h:57
hoc_Item * hoc_l_lappenditem(hoc_List *, hoc_Item *)
struct hoc_Item * itm
Definition: hoclist.h:42
virtual void release(const Event &e)
Definition: ocinput.h:22
hoc_Item * hoc_l_lappendsym(hoc_List *, struct Symbol *)
struct hoc_Item * next
Definition: hoclist.h:50
Definition: hocdec.h:226
void * vd
Definition: hoclist.h:48
hoc_Item * hoc_l_lappendlst(hoc_List *, hoc_List *)
hoc_Item * hoc_l_insertvoid(hoc_Item *, void *)
hoc_Item * hoc_l_insertitem(hoc_Item *, hoc_Item *)
hoc_Item * hoc_l_insertsym(hoc_Item *, struct Symbol *)
hoc_Item * hoc_l_insertstr(hoc_Item *, const char *)
union hoc_Item::@55 element
struct hoc_Item * prev
Definition: hoclist.h:51
hoc_Item * hoc_l_lappendsec(hoc_List *, struct Section *)
hoc_Item * hoc_l_next(hoc_Item *)