libyasm
valparam.h
Go to the documentation of this file.
1 
30 #ifndef YASM_VALPARAM_H
31 #define YASM_VALPARAM_H
32 
33 #ifndef YASM_LIB_DECL
34 #define YASM_LIB_DECL
35 #endif
36 
38 struct yasm_valparam {
39  /*@reldef@*/ STAILQ_ENTRY(yasm_valparam) link;
40  /*@owned@*/ /*@null@*/ char *val;
47  } type;
50  union yasm_param {
51  /*@owned@*/ char *id;
52  /*@owned@*/ char *str;
53  /*@owned@*/ yasm_expr *e;
54  } param;
62  char id_prefix;
63 };
64 
67 
74  /*@null@*/ const char *name;
75 
76  const char *parser;
84  void (*handler) (yasm_object *object, yasm_valparamhead *valparams,
85  yasm_valparamhead *objext_valparams, unsigned long line);
86 
92  } flags;
93 };
94 
104 YASM_LIB_DECL
105 void yasm_call_directive(const yasm_directive *directive, yasm_object *object,
106  yasm_valparamhead *valparams,
107  yasm_valparamhead *objext_valparams,
108  unsigned long line);
109 
116 YASM_LIB_DECL
117 yasm_valparam *yasm_vp_create_id(/*@keep@*/ char *v, /*@keep@*/ char *p,
118  int id_prefix);
119 
125 YASM_LIB_DECL
126 yasm_valparam *yasm_vp_create_string(/*@keep@*/ char *v, /*@keep@*/ char *p);
127 
133 YASM_LIB_DECL
134 yasm_valparam *yasm_vp_create_expr(/*@keep@*/ char *v,
135  /*@keep@*/ yasm_expr *p);
136 
145 YASM_LIB_DECL
146 /*@null@*/ /*@only@*/ yasm_expr *yasm_vp_expr
147  (const yasm_valparam *vp, yasm_symtab *symtab, unsigned long line);
148 
155 YASM_LIB_DECL
156 /*@null@*/ /*@dependent@*/ const char *yasm_vp_string(const yasm_valparam *vp);
157 
163 YASM_LIB_DECL
164 /*@null@*/ /*@dependent@*/ const char *yasm_vp_id(const yasm_valparam *vp);
165 
169 YASM_LIB_DECL
171 
175 YASM_LIB_DECL
177 
181 void yasm_vps_initialize(/*@out@*/ yasm_valparamhead *headp);
182 #ifndef YASM_DOXYGEN
183 #define yasm_vps_initialize(headp) STAILQ_INIT(headp)
184 #endif
185 
191 YASM_LIB_DECL
193 
198 void yasm_vps_append(yasm_valparamhead *headp, /*@keep@*/ yasm_valparam *vp);
199 #ifndef YASM_DOXYGEN
200 #define yasm_vps_append(headp, vp) do { \
201  if (vp) \
202  STAILQ_INSERT_TAIL(headp, vp, link); \
203  } while(0)
204 #endif
205 
210 /*@null@*/ /*@dependent@*/ yasm_valparam *yasm_vps_first
211  (yasm_valparamhead *headp);
212 #ifndef YASM_DOXYGEN
213 #define yasm_vps_first(headp) STAILQ_FIRST(headp)
214 #endif
215 
220 /*@null@*/ /*@dependent@*/ yasm_valparam *yasm_vps_next(yasm_valparam *cur);
221 #ifndef YASM_DOXYGEN
222 #define yasm_vps_next(cur) STAILQ_NEXT(cur, link)
223 #endif
224 
230 #ifndef YASM_DOXYGEN
231 #define yasm_vps_foreach(iter, headp) STAILQ_FOREACH(iter, headp, link)
232 #endif
233 
238 YASM_LIB_DECL
239 void yasm_vps_print(/*@null@*/ const yasm_valparamhead *headp, FILE *f);
240 
242 typedef struct yasm_dir_help {
246  const char *name;
247 
250 
260  int (*helper) (void *obj, yasm_valparam *vp, unsigned long line,
261  void *data, uintptr_t arg);
262 
269  size_t off;
270 
273  uintptr_t arg;
274 } yasm_dir_help;
275 
294 YASM_LIB_DECL
295 int yasm_dir_helper(void *obj, yasm_valparam *vp_first, unsigned long line,
296  const yasm_dir_help *help, size_t nhelp, void *data,
297  int (*helper_valparam) (void *object,
298  yasm_valparam *vp,
299  unsigned long line,
300  void *data));
301 
312 YASM_LIB_DECL
313 int yasm_dir_helper_flag_set(void *obj, yasm_valparam *vp, unsigned long line,
314  void *data, uintptr_t arg);
315 
326 YASM_LIB_DECL
327 int yasm_dir_helper_flag_or(void *obj, yasm_valparam *vp, unsigned long line,
328  void *data, uintptr_t arg);
329 
340 YASM_LIB_DECL
341 int yasm_dir_helper_flag_and(void *obj, yasm_valparam *vp, unsigned long line,
342  void *data, uintptr_t arg);
343 
358 YASM_LIB_DECL
359 int yasm_dir_helper_expr(void *obj, yasm_valparam *vp, unsigned long line,
360  void *data, uintptr_t arg);
361 
376 YASM_LIB_DECL
377 int yasm_dir_helper_intn(void *obj, yasm_valparam *vp, unsigned long line,
378  void *data, uintptr_t arg);
379 
393 YASM_LIB_DECL
394 int yasm_dir_helper_string(void *obj, yasm_valparam *vp, unsigned long line,
395  void *data, uintptr_t arg);
396 
405 YASM_LIB_DECL
407  unsigned long line, void *data);
408 #endif