gwenhywfar  4.99.8beta
typemaker/main.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Mon Mar 01 2004
3  copyright : (C) 2004-2010 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * Please see toplevel file COPYING for license details *
8  ***************************************************************************/
9 
10 #ifdef HAVE_CONFIG_H
11 # include <config.h>
12 #endif
13 
14 /* Internationalization */
15 #ifdef ENABLE_NLS
16 # include <libintl.h>
17 # include <locale.h>
18 # define I18N(m) dgettext("gwenhywfar", m)
19 # define I18S(m) m
20 #else
21 # define I18N(m) m
22 # define I18S(m) m
23 #endif
24 
25 
26 #include "args.h"
27 #include "typemaker_p.h"
28 #include <gwenhywfar/debug.h>
29 #include <gwenhywfar/logger.h>
30 #include <gwenhywfar/xml.h>
31 
32 #include <stdlib.h>
33 #include <assert.h>
34 
35 #include <sys/types.h>
36 #include <sys/stat.h>
37 #include <fcntl.h>
38 #include <errno.h>
39 #include <string.h>
40 #include <ctype.h>
41 
42 
43 
44 int write_xml_to_bio(GWEN_XMLNODE *n, GWEN_SYNCIO *sio, uint32_t flags) {
45  GWEN_BUFFER *buf;
46  int rv;
47 
48  buf=GWEN_Buffer_new(0, 256, 0, 1);
49  rv=GWEN_XMLNode_toBuffer(n, buf, flags);
50  if (rv) {
51  GWEN_Buffer_free(buf);
52  return rv;
53  }
54 
55  rv=GWEN_SyncIo_WriteForced(sio, (const uint8_t*) GWEN_Buffer_GetStart(buf), GWEN_Buffer_GetUsedBytes(buf));
56  GWEN_Buffer_free(buf);
57  if (rv<0) {
58  DBG_INFO(0, "here (%d)", rv);
59  return rv;
60  }
61  return 0;
62 }
63 
64 
65 
67  GWEN_SYNCIO *sio,
68  const char *where) {
69  int isSys;
70  int err;
71  const char *d;
72  GWEN_XMLNODE *dn;
73  /*const char *nwhere;*/
74 
75  /*nwhere=GWEN_XMLNode_GetProperty(node, "out", "header");
76  if (strcasecmp(nwhere, where)==0) {*/
78  if (!dn) {
79  DBG_ERROR(0, "Empty <header>");
80  return -1;
81  }
83  if (!d) {
84  DBG_ERROR(0, "Empty <header>");
85  return -1;
86  }
87  isSys=(strcasecmp(GWEN_XMLNode_GetProperty(node, "type", ""),
88  "sys")==0);
89 
90  err=GWEN_SyncIo_WriteString(sio, "#include ");
91  if (err) { DBG_ERROR_ERR(0, err); return -1;}
92  if (isSys) {
93  err=GWEN_SyncIo_WriteString(sio, "<");
94  if (err) { DBG_ERROR_ERR(0, err); return -1;}
95  }
96  else {
97  err=GWEN_SyncIo_WriteString(sio, "\"");
98  if (err) { DBG_ERROR_ERR(0, err); return -1;}
99  }
100  err=GWEN_SyncIo_WriteString(sio, d);
101  if (err) { DBG_ERROR_ERR(0, err); return -1;}
102  if (isSys) {
103  err=GWEN_SyncIo_WriteLine(sio, ">");
104  if (err) { DBG_ERROR_ERR(0, err); return -1;}
105  }
106  else {
107  err=GWEN_SyncIo_WriteLine(sio, "\"");
108  if (err) { DBG_ERROR_ERR(0, err); return -1;}
109  }
110  /*} */
111 
112  return 0;
113 }
114 
115 
116 void write_if_nonnull(GWEN_SYNCIO *sio, const char *str) {
117  if (str) {
118  GWEN_SyncIo_WriteString(sio, str);
119  GWEN_SyncIo_WriteString(sio, " ");
120  }
121 }
122 
123 
125  GWEN_XMLNODE *node,
126  GWEN_SYNCIO *sio,
127  const char *acc) {
128  GWEN_XMLNODE *n;
129  int rv;
130  const char *prefix;
131  const char *styp;
132  const char *sacc;
133 
134  sacc=get_struct_property(node, "access", "public");
135  prefix=get_struct_property(node, "prefix", 0);
136  if (!prefix) {
137  DBG_ERROR(0, "No prefix in struct");
138  return -1;
139  }
140  styp=get_struct_property(node, "id", 0);
141  if (!styp) {
142  DBG_ERROR(0, "No id in struct");
143  return -1;
144  }
145  n=GWEN_XMLNode_GetFirstTag(node);
146  while(n) {
148  if (strcasecmp(GWEN_XMLNode_GetData(n), "group")==0) {
149  const char *name;
150  int hasDoc;
151  GWEN_XMLNODE *dn;
152 
153  hasDoc=0;
154  name=GWEN_XMLNode_GetProperty(n, "name", 0);
155  if (name) {
156  hasDoc=1;
157  GWEN_SyncIo_WriteString(sio, "/** @name ");
158  GWEN_SyncIo_WriteLine(sio, name);
159  dn=GWEN_XMLNode_FindFirstTag(n, "descr", 0, 0);
160  if (dn) {
161  GWEN_SyncIo_WriteLine(sio, " *");
162  if (write_xml_to_bio(dn, sio,
165  return -1;
166  }
167  GWEN_SyncIo_WriteLine(sio, "*/");
168  GWEN_SyncIo_WriteLine(sio, "/*@{*/");
169  }
170 
171  rv=write_h_setget_c(args, n, sio, acc);
172  if (rv)
173  return rv;
174 
175  if (hasDoc) {
176  GWEN_SyncIo_WriteLine(sio, "/*@}*/");
177  }
178 
179  }
180  else if (strcasecmp(GWEN_XMLNode_GetData(n), "elem")==0) {
181  if (strcasecmp(GWEN_XMLNode_GetProperty(n, "access", sacc),
182  acc)==0) {
183  int isPtr;
184  const char *typ;
185  const char *name;
186  const char *mode;
187  const char *tmode;
188  int isConst;
189  int doCopy;
190  GWEN_XMLNODE *tnode;
191 
192  name=GWEN_XMLNode_GetProperty(n, "name", 0);
193  if (!name) {
194  DBG_ERROR(0, "No name for element");
195  return -1;
196  }
197 
198  typ=GWEN_XMLNode_GetProperty(n, "type", 0);
199  if (!typ) {
200  DBG_ERROR(0, "No type for element");
201  return -1;
202  }
203 
204  isPtr=atoi(get_property(n, "ptr", "0"));
205  isConst=atoi(get_property(n, "const", "1"));
206  doCopy=atoi(get_property(n, "copy", "1"));
207  mode=GWEN_XMLNode_GetProperty(n, "mode", "single");
208  if (strcasecmp(mode, "single")!=0)
209  isPtr=1;
210 
211  tnode=get_typedef(node, typ);
212  if (tnode)
213  tmode=GWEN_XMLNode_GetProperty(tnode, "mode", "single");
214  else
215  tmode=mode;
216 
217  /* getter */
218  GWEN_SyncIo_WriteLine(sio, "/**");
219  GWEN_SyncIo_WriteString(sio, "* Returns the property @ref ");
220  GWEN_SyncIo_WriteString(sio, styp);
221  GWEN_SyncIo_WriteString(sio, "_");
222  GWEN_SyncIo_WriteChar(sio, toupper(*name));
223  GWEN_SyncIo_WriteLine(sio, name+1);
224  GWEN_SyncIo_WriteLine(sio, "*/");
225  write_if_nonnull(sio, args->domain);
226  if (isPtr &&
227  (/*strcasecmp(mode, "single")==0 ||*/ isConst)) {
228  GWEN_SyncIo_WriteString(sio, "const ");
229  }
230  if (strcasecmp(tmode, "enum")!=0)
231  GWEN_SyncIo_WriteString(sio, typ);
232  else {
233  GWEN_BUFFER *tid;
234  const char *s;
235 
236  tid=GWEN_Buffer_new(0, 64, 0, 1);
237  s=get_struct_property(node, "id", 0);
238  assert(s);
239  GWEN_Buffer_AppendString(tid, s);
240  GWEN_Buffer_AppendString(tid, "_");
241  GWEN_Buffer_AppendString(tid, typ);
243  GWEN_Buffer_free(tid);
244  }
245  if (isPtr) {
246  GWEN_SyncIo_WriteString(sio, " *");
247  }
248  else {
249  GWEN_SyncIo_WriteString(sio, " ");
250  }
251  GWEN_SyncIo_WriteString(sio, prefix);
252  GWEN_SyncIo_WriteString(sio, "_Get");
253  GWEN_SyncIo_WriteChar(sio, toupper(*name));;
254  GWEN_SyncIo_WriteString(sio, name+1);
255  GWEN_SyncIo_WriteString(sio, "(const ");
256  GWEN_SyncIo_WriteString(sio, styp);
257  GWEN_SyncIo_WriteLine(sio, " *el);");
258 
259  /* setter */
260  GWEN_SyncIo_WriteLine(sio, "/**");
261  GWEN_SyncIo_WriteString(sio, "* Set the property @ref ");
262  GWEN_SyncIo_WriteString(sio, styp);
263  GWEN_SyncIo_WriteString(sio, "_");
264  GWEN_SyncIo_WriteChar(sio, toupper(*name));
265  GWEN_SyncIo_WriteLine(sio, name+1);
266  GWEN_SyncIo_WriteLine(sio, "*/");
267  write_if_nonnull(sio, args->domain);
268  GWEN_SyncIo_WriteString(sio, "void ");
269  GWEN_SyncIo_WriteString(sio, prefix);
270  GWEN_SyncIo_WriteString(sio, "_Set");
271  GWEN_SyncIo_WriteChar(sio, toupper(*name));;
272  GWEN_SyncIo_WriteString(sio, name+1);
273  GWEN_SyncIo_WriteString(sio, "(");
274 
275  GWEN_SyncIo_WriteString(sio, styp);
276  GWEN_SyncIo_WriteString(sio, " *el, ");
277  if (isPtr && isConst) {
278  GWEN_SyncIo_WriteString(sio, "const ");
279  }
280  if (strcasecmp(tmode, "enum")!=0)
281  GWEN_SyncIo_WriteString(sio, typ);
282  else {
283  GWEN_BUFFER *tid;
284  const char *s;
285 
286  tid=GWEN_Buffer_new(0, 64, 0, 1);
287  s=get_struct_property(node, "id", 0);
288  assert(s);
289  GWEN_Buffer_AppendString(tid, s);
290  GWEN_Buffer_AppendString(tid, "_");
291  GWEN_Buffer_AppendString(tid, typ);
293  GWEN_Buffer_free(tid);
294  }
295 
296  if (isPtr) {
297  GWEN_SyncIo_WriteString(sio, " *");
298  }
299  else {
300  GWEN_SyncIo_WriteString(sio, " ");
301  }
302  GWEN_SyncIo_WriteLine(sio, "d);");
303 
304  if (strcasecmp(typ, "GWEN_STRINGLIST")==0) {
305  /* special functions for string lists */
306  write_if_nonnull(sio, args->domain);
307  GWEN_SyncIo_WriteString(sio, "void ");
308  GWEN_SyncIo_WriteString(sio, prefix);
309  GWEN_SyncIo_WriteString(sio, "_Add");
310  GWEN_SyncIo_WriteChar(sio, toupper(*name));
311  GWEN_SyncIo_WriteString(sio, name+1);
312  GWEN_SyncIo_WriteString(sio, "(");
313  GWEN_SyncIo_WriteString(sio, styp);
314  GWEN_SyncIo_WriteLine(sio, " *st, const char *d, int chk);");
315 
316  write_if_nonnull(sio, args->domain);
317  GWEN_SyncIo_WriteString(sio, "void ");
318  GWEN_SyncIo_WriteString(sio, prefix);
319  GWEN_SyncIo_WriteString(sio, "_Remove");
320  GWEN_SyncIo_WriteChar(sio, toupper(*name));
321  GWEN_SyncIo_WriteString(sio, name+1);
322  GWEN_SyncIo_WriteString(sio, "(");
323  GWEN_SyncIo_WriteString(sio, styp);
324  GWEN_SyncIo_WriteLine(sio, " *st, const char *d);");
325 
326  write_if_nonnull(sio, args->domain);
327  GWEN_SyncIo_WriteString(sio, "void ");
328  GWEN_SyncIo_WriteString(sio, prefix);
329  GWEN_SyncIo_WriteString(sio, "_Clear");
330  GWEN_SyncIo_WriteChar(sio, toupper(*name));;
331  GWEN_SyncIo_WriteString(sio, name+1);
332  GWEN_SyncIo_WriteString(sio, "(");
333  GWEN_SyncIo_WriteString(sio, styp);
334  GWEN_SyncIo_WriteLine(sio, " *st);");
335 
336  write_if_nonnull(sio, args->domain);
337  GWEN_SyncIo_WriteString(sio, "int ");
338  GWEN_SyncIo_WriteString(sio, prefix);
339  GWEN_SyncIo_WriteString(sio, "_Has");
340  GWEN_SyncIo_WriteChar(sio, toupper(*name));;
341  GWEN_SyncIo_WriteString(sio, name+1);
342  GWEN_SyncIo_WriteString(sio, "(const ");
343  GWEN_SyncIo_WriteString(sio, styp);
344  GWEN_SyncIo_WriteLine(sio, " *st, const char *d);");
345  }
346 
347  }
348  }
349  else if (strcasecmp(GWEN_XMLNode_GetData(n), "func")==0) {
350  if (strcasecmp(GWEN_XMLNode_GetProperty(n, "access", sacc),
351  acc)==0) {
352  const char *typ;
353  const char *name;
354  const char *rettype;
355  GWEN_XMLNODE *anode;
356  int isPtr;
357  int isVoid;
358  int idx;
359 
360  name=GWEN_XMLNode_GetProperty(n, "name", 0);
361  if (!name) {
362  DBG_ERROR(0, "No name for element");
363  return -1;
364  }
365 
366  typ=GWEN_XMLNode_GetProperty(n, "type", 0);
367  if (!typ) {
368  DBG_ERROR(0, "No type for element");
369  return -1;
370  }
371 
372  rettype=GWEN_XMLNode_GetProperty(n, "return", 0);
373  if (!rettype) {
374  DBG_ERROR(0, "No return type for function");
375  return -1;
376  }
377 
378  isPtr=atoi(get_property(n, "ptr", "0"));
379  isVoid=(!isPtr && strcasecmp(rettype, "void")==0);
380 
381  /* getter */
382  GWEN_SyncIo_WriteLine(sio, "/**");
383  GWEN_SyncIo_WriteString(sio, "* Returns the property @ref ");
384  GWEN_SyncIo_WriteString(sio, styp);
385  GWEN_SyncIo_WriteString(sio, "_");
386  GWEN_SyncIo_WriteChar(sio, toupper(*name));
387  GWEN_SyncIo_WriteLine(sio, name+1);
388  GWEN_SyncIo_WriteLine(sio, "*/");
389  write_if_nonnull(sio, args->domain);
390 
391  GWEN_SyncIo_WriteString(sio, styp);
392  GWEN_SyncIo_WriteString(sio, "_");
393  GWEN_SyncIo_WriteString(sio, typ);
394  GWEN_SyncIo_WriteString(sio, " ");
395  GWEN_SyncIo_WriteString(sio, prefix);
396  GWEN_SyncIo_WriteString(sio, "_Get");
397  GWEN_SyncIo_WriteChar(sio, toupper(*name));;
398  GWEN_SyncIo_WriteString(sio, name+1);
399  GWEN_SyncIo_WriteString(sio, "(const ");
400  GWEN_SyncIo_WriteString(sio, styp);
401  GWEN_SyncIo_WriteLine(sio, " *st);");
402 
403  /* setter */
404  GWEN_SyncIo_WriteLine(sio, "/**");
405  GWEN_SyncIo_WriteString(sio, "* Set the property @ref ");
406  GWEN_SyncIo_WriteString(sio, styp);
407  GWEN_SyncIo_WriteString(sio, "_");
408  GWEN_SyncIo_WriteChar(sio, toupper(*name));
409  GWEN_SyncIo_WriteLine(sio, name+1);
410  GWEN_SyncIo_WriteLine(sio, "*/");
411  write_if_nonnull(sio, args->domain);
412  GWEN_SyncIo_WriteString(sio, "void ");
413  GWEN_SyncIo_WriteString(sio, prefix);
414  GWEN_SyncIo_WriteString(sio, "_Set");
415  GWEN_SyncIo_WriteChar(sio, toupper(*name));;
416  GWEN_SyncIo_WriteString(sio, name+1);
417  GWEN_SyncIo_WriteString(sio, "(");
418 
419  GWEN_SyncIo_WriteString(sio, styp);
420  GWEN_SyncIo_WriteString(sio, " *st, ");
421  GWEN_SyncIo_WriteString(sio, styp);
422  GWEN_SyncIo_WriteString(sio, "_");
423  GWEN_SyncIo_WriteString(sio, typ);
424  GWEN_SyncIo_WriteLine(sio, " d);");
425 
426  /* function call */
427  GWEN_SyncIo_WriteLine(sio, "/**");
428  /* TODO: Write API doc for this function */
429  GWEN_SyncIo_WriteLine(sio, "*/");
430  write_if_nonnull(sio, args->domain);
431  GWEN_SyncIo_WriteString(sio, rettype);
432  if (isPtr)
433  GWEN_SyncIo_WriteString(sio, "*");
434  GWEN_SyncIo_WriteString(sio, " ");
435  GWEN_SyncIo_WriteString(sio, prefix);
436  GWEN_SyncIo_WriteString(sio, "_");
437  GWEN_SyncIo_WriteChar(sio, toupper(*name));
438  GWEN_SyncIo_WriteString(sio, name+1);
439  GWEN_SyncIo_WriteString(sio, "(");
440 
441  GWEN_SyncIo_WriteString(sio, styp);
442  GWEN_SyncIo_WriteString(sio, " *st");
443 
444  anode=GWEN_XMLNode_FindFirstTag(n, "arg", 0, 0);
445  idx=0;
446  while(anode) {
447  const char *aname;
448  const char *atype;
449  int aisPtr;
450 
451  GWEN_SyncIo_WriteString(sio, ", ");
452 
453  aisPtr=atoi(GWEN_XMLNode_GetProperty(anode, "ptr", "0"));
454  aname=GWEN_XMLNode_GetProperty(anode, "name", 0);
455  if (!aname || !*aname) {
456  DBG_ERROR(0, "No name for argument %d in function %s", idx, name);
457  return -1;
458  }
459  atype=GWEN_XMLNode_GetProperty(anode, "type", 0);
460  if (!atype || !*atype) {
461  DBG_ERROR(0, "No type for argument %d in function %s", idx, name);
462  return -1;
463  }
464 
465  GWEN_SyncIo_WriteString(sio, atype);
466  if (aisPtr)
467  GWEN_SyncIo_WriteString(sio, "*");
468  GWEN_SyncIo_WriteString(sio, " ");
469  GWEN_SyncIo_WriteString(sio, aname);
470 
471  idx++;
472  anode=GWEN_XMLNode_FindNextTag(anode, "arg", 0, 0);
473  }
474 
475  GWEN_SyncIo_WriteLine(sio, ");");
476 
477  }
478  }
479  }
480  GWEN_SyncIo_WriteLine(sio, "");
482  }
483  return 0;
484 }
485 
486 
487 
489  GWEN_SYNCIO *sio,
490  const char *acc) {
491  GWEN_XMLNODE *n;
492 
493  n=GWEN_XMLNode_FindFirstTag(node, "subtypes", 0, 0);
494  if (n)
495  n=GWEN_XMLNode_FindFirstTag(n, "type", "mode", "enum");
496  if (n) {
497  GWEN_BUFFER *tprefix;
498  GWEN_BUFFER *tid;
499  uint32_t ppos;
500  uint32_t tpos;
501  const char *s;
502 
503  tprefix=GWEN_Buffer_new(0, 64, 0, 1);
504  tid=GWEN_Buffer_new(0, 64, 0, 1);
505 
506  s=get_struct_property(node, "prefix", 0);
507  assert(s);
508  GWEN_Buffer_AppendString(tprefix, s);
509  GWEN_Buffer_AppendString(tprefix, "_");
510  ppos=GWEN_Buffer_GetPos(tprefix);
511 
512  s=get_struct_property(node, "id", 0);
513  assert(s);
514  GWEN_Buffer_AppendString(tid, s);
515  GWEN_Buffer_AppendString(tid, "_");
516  tpos=GWEN_Buffer_GetPos(tid);
517 
518  while(n) {
519  s=GWEN_XMLNode_GetProperty(n, "access", "public");
520  if (strcasecmp(s, acc)==0) {
521  GWEN_XMLNODE *nn;
522 
523  s=GWEN_XMLNode_GetProperty(n, "id", 0);
524  assert(s);
525  GWEN_Buffer_AppendString(tid, s);
526  s=GWEN_XMLNode_GetProperty(n, "prefix", 0);
527  assert(s);
528  GWEN_Buffer_AppendString(tprefix, s);
529 
530  GWEN_SyncIo_WriteLine(sio, "typedef enum {");
531  GWEN_SyncIo_WriteString(sio, " ");
533  GWEN_SyncIo_WriteString(sio, "Unknown=-1");
534 
535  nn=GWEN_XMLNode_FindFirstTag(n, "values", 0, 0);
536  if (nn)
537  nn=GWEN_XMLNode_FindFirstTag(nn, "value", 0, 0);
538  if (nn) {
539  uint32_t vpos;
540 
541  vpos=GWEN_Buffer_GetPos(tprefix);
542  while(nn) {
543  GWEN_XMLNODE *nnn;
544  GWEN_XMLNODE *dn;
545 
547  if (!nnn) {
548  DBG_ERROR(0, "No values in enum description for \"%s\"",
549  GWEN_Buffer_GetStart(tid));
550  GWEN_Buffer_free(tid);
551  GWEN_Buffer_free(tprefix);
552  return -1;
553  }
554  GWEN_SyncIo_WriteLine(sio, ",");
555 
556  dn=GWEN_XMLNode_FindFirstTag(nn, "descr", 0, 0);
557  if (dn) {
558  GWEN_SyncIo_WriteString(sio, " /** ");
559  if (write_xml_to_bio(dn, sio,
562  return -1;
563  GWEN_SyncIo_WriteLine(sio, " */");
564  }
565 
566  GWEN_SyncIo_WriteString(sio, " ");
567  s=GWEN_XMLNode_GetData(nnn);
568  assert(s);
569  GWEN_Buffer_AppendByte(tprefix, toupper(*s));
570  GWEN_Buffer_AppendString(tprefix, s+1);
572  s=GWEN_XMLNode_GetProperty(nn, "value", 0);
573  if (s) {
574  GWEN_SyncIo_WriteString(sio, "=");
575  GWEN_SyncIo_WriteString(sio, s);
576  }
577 
578  GWEN_Buffer_Crop(tprefix, 0, vpos);
579  nn=GWEN_XMLNode_FindNextTag(nn, "value", 0, 0);
580  }
581  }
582 
583  GWEN_SyncIo_WriteLine(sio, "");
584  GWEN_SyncIo_WriteString(sio, "} ");
586  GWEN_SyncIo_WriteLine(sio, ";");
587  GWEN_SyncIo_WriteLine(sio, "");
588 
589  write_if_nonnull(sio, args->domain);
591  GWEN_SyncIo_WriteString(sio, " ");
593  GWEN_SyncIo_WriteLine(sio, "_fromString(const char *s);");
594 
595  write_if_nonnull(sio, args->domain);
596  GWEN_SyncIo_WriteString(sio, "const char *");
598  GWEN_SyncIo_WriteString(sio, "_toString(");
600  GWEN_SyncIo_WriteLine(sio, " v);");
601 
602  GWEN_Buffer_Crop(tprefix, 0, ppos);
603  GWEN_Buffer_Crop(tid, 0, tpos);
604  GWEN_SyncIo_WriteLine(sio, "");
605  } /* if access type matches */
606  n=GWEN_XMLNode_FindNextTag(n, "type", "mode", "enum");
607  } /* while n */
608  GWEN_Buffer_free(tid);
609  GWEN_Buffer_free(tprefix);
610  } /* if enum types found */
611 
612  return 0;
613 }
614 
615 
616 
618  GWEN_SYNCIO *sio,
619  const char *acc) {
620  GWEN_XMLNODE *n;
621  const char *styp;
622 
623  styp=get_struct_property(node, "id", 0);
624  if (!styp) {
625  DBG_ERROR(0, "No id in struct");
626  return -1;
627  }
628 
629  n=GWEN_XMLNode_FindFirstTag(node, "func", 0, 0);
630  while(n) {
631  const char *sacc;
632 
633  sacc=get_struct_property(n, "access", "public");
634  assert(sacc);
635  if (strcasecmp(sacc, acc)==0) {
636  const char *prefix;
637  const char *name;
638  const char *rettype;
639  const char *typ;
640  GWEN_XMLNODE *anode;
641  int isPtr;
642  int idx;
643 
644  name=GWEN_XMLNode_GetProperty(n, "name", 0);
645  if (!name) {
646  DBG_ERROR(0, "No name for function");
647  return -1;
648  }
649 
650  rettype=GWEN_XMLNode_GetProperty(n, "return", 0);
651  if (!rettype) {
652  DBG_ERROR(0, "No return type for function");
653  return -1;
654  }
655 
656  prefix=get_struct_property(n, "prefix", 0);
657  if (!prefix) {
658  DBG_ERROR(0, "No prefix in struct");
659  return -1;
660  }
661 
662  isPtr=atoi(get_property(n, "ptr", "0"));
663 
664  typ=GWEN_XMLNode_GetProperty(n, "type", 0);
665  if (!typ) {
666  DBG_ERROR(0, "No type for function");
667  return -1;
668  }
669 
670  /* typdef rettype (*typ)(args) */
671  GWEN_SyncIo_WriteString(sio, "typedef ");
672  GWEN_SyncIo_WriteString(sio, rettype);
673  if (isPtr)
674  GWEN_SyncIo_WriteString(sio, "*");
675  GWEN_SyncIo_WriteString(sio, " (*");
676  GWEN_SyncIo_WriteString(sio, styp);
677  GWEN_SyncIo_WriteString(sio, "_");
678  GWEN_SyncIo_WriteString(sio, typ);
679  GWEN_SyncIo_WriteString(sio, ")(");
680 
681  GWEN_SyncIo_WriteString(sio, styp);
682  GWEN_SyncIo_WriteString(sio, " *st");
683 
684  anode=GWEN_XMLNode_FindFirstTag(n, "arg", 0, 0);
685  idx=0;
686  while(anode) {
687  const char *aname;
688  const char *atype;
689  int aisPtr;
690 
691  GWEN_SyncIo_WriteString(sio, ", ");
692 
693  aisPtr=atoi(GWEN_XMLNode_GetProperty(anode, "ptr", "0"));
694  aname=GWEN_XMLNode_GetProperty(anode, "name", 0);
695  if (!aname || !*aname) {
696  DBG_ERROR(0, "No name for argument %d in function %s", idx, name);
697  return -1;
698  }
699  atype=GWEN_XMLNode_GetProperty(anode, "type", 0);
700  if (!atype || !*atype) {
701  DBG_ERROR(0, "No type for argument %d in function %s", idx, name);
702  return -1;
703  }
704 
705  GWEN_SyncIo_WriteString(sio, atype);
706  GWEN_SyncIo_WriteString(sio, " ");
707  if (aisPtr)
708  GWEN_SyncIo_WriteString(sio, "*");
709  GWEN_SyncIo_WriteString(sio, aname);
710 
711  idx++;
712  anode=GWEN_XMLNode_FindNextTag(anode, "arg", 0, 0);
713  }
714 
715  GWEN_SyncIo_WriteLine(sio, ");");
716  }
717 
718  n=GWEN_XMLNode_FindNextTag(n, "func", 0, 0);
719  } /* while functions */
720 
721  GWEN_SyncIo_WriteLine(sio, "");
722 
723  return 0;
724 }
725 
726 
727 
728 
730  GWEN_XMLNODE *node,
731  GWEN_SYNCIO *sio,
732  const char *acc,
733  int level) {
734  GWEN_XMLNODE *n;
735  int rv;
736  const char *prefix;
737  const char *styp;
738 
739  prefix=get_struct_property(node, "prefix", 0);
740  if (!prefix) {
741  DBG_ERROR(0, "No prefix in struct");
742  return -1;
743  }
744  styp=get_struct_property(node, "id", 0);
745  if (!styp) {
746  DBG_ERROR(0, "No id in struct");
747  return -1;
748  }
749  n=GWEN_XMLNode_GetFirstTag(node);
750  while(n) {
752  if (strcasecmp(GWEN_XMLNode_GetData(n), "group")==0) {
753  const char *name;
754  GWEN_XMLNODE *dn;
755  char numbuf[16];
756 
757  name=GWEN_XMLNode_GetProperty(n, "name", 0);
758  if (!name) {
759  DBG_ERROR(0, "No name for element");
760  return -1;
761  }
762 
763  snprintf(numbuf, sizeof(numbuf), "%d", level);
764  GWEN_SyncIo_WriteString(sio, "<h");
765  GWEN_SyncIo_WriteString(sio, numbuf);
766  GWEN_SyncIo_WriteString(sio, ">");
767  GWEN_SyncIo_WriteChar(sio, toupper(*name));
768  GWEN_SyncIo_WriteString(sio, name+1);
769  GWEN_SyncIo_WriteString(sio, "</h");
770  GWEN_SyncIo_WriteString(sio, numbuf);
771  GWEN_SyncIo_WriteLine(sio, ">");
772 
773  GWEN_SyncIo_WriteLine(sio, "<p>");
774  dn=GWEN_XMLNode_FindFirstTag(n, "descr", 0, 0);
775  if (dn) {
776  if (write_xml_to_bio(dn, sio,
779  DBG_INFO(0, "here");
780  return -1;
781  }
782  }
783  GWEN_SyncIo_WriteLine(sio, "</p>");
784 
785  rv=write_apidocrec_c(args, n, sio, acc, level+1);
786  if (rv) {
787  DBG_INFO(0, "here (%d)", rv);
788  return rv;
789  }
790  }
791  else if (strcasecmp(GWEN_XMLNode_GetData(n), "elem")==0) {
792  if (strcasecmp(GWEN_XMLNode_GetProperty(n, "access", "public"),
793  acc)==0) {
794  const char *typ;
795  const char *name;
796  GWEN_XMLNODE *dn;
797  char numbuf[16];
798 
799  name=GWEN_XMLNode_GetProperty(n, "name", 0);
800  if (!name) {
801  DBG_ERROR(0, "No name for element");
802  return -1;
803  }
804 
805  typ=GWEN_XMLNode_GetProperty(n, "type", 0);
806  if (!typ) {
807  DBG_ERROR(0, "No type for element");
808  return -1;
809  }
810 
811  snprintf(numbuf, sizeof(numbuf), "%d", level);
812  GWEN_SyncIo_WriteString(sio, "@anchor ");
813  GWEN_SyncIo_WriteString(sio, styp);
814  GWEN_SyncIo_WriteString(sio, "_");
815  GWEN_SyncIo_WriteChar(sio, toupper(*name));
816  GWEN_SyncIo_WriteLine(sio, name+1);
817 
818  GWEN_SyncIo_WriteString(sio, "<h");
819  GWEN_SyncIo_WriteString(sio, numbuf);
820  GWEN_SyncIo_WriteString(sio, ">");
821  GWEN_SyncIo_WriteChar(sio, toupper(*name));
822  GWEN_SyncIo_WriteString(sio, name+1);
823  GWEN_SyncIo_WriteString(sio, "</h");
824  GWEN_SyncIo_WriteString(sio, numbuf);
825  GWEN_SyncIo_WriteLine(sio, ">");
826 
827  dn=GWEN_XMLNode_FindFirstTag(n, "brief", 0, 0);
828  if (dn) {
829  GWEN_SyncIo_WriteString(sio, "@short ");
830  if (write_xml_to_bio(dn, sio,
833  DBG_INFO(0, "here");
834  return -1;
835  }
836  GWEN_SyncIo_WriteLine(sio, "");
837  GWEN_SyncIo_WriteLine(sio, "");
838  }
839 
840  GWEN_SyncIo_WriteLine(sio, "<p>");
841  dn=GWEN_XMLNode_FindFirstTag(n, "descr", 0, 0);
842  if (dn) {
843  rv=write_xml_to_bio(dn, sio,
846  if (rv) {
847  DBG_INFO(0, "here (%d)", rv);
848  return -1;
849  }
850  }
851  GWEN_SyncIo_WriteLine(sio, "</p>");
852 
853  GWEN_SyncIo_WriteLine(sio, "<p>");
854  GWEN_SyncIo_WriteString(sio, "Set this property with @ref ");
855  GWEN_SyncIo_WriteString(sio, prefix);
856  GWEN_SyncIo_WriteString(sio, "_Set");
857  GWEN_SyncIo_WriteChar(sio, toupper(*name));
858  GWEN_SyncIo_WriteString(sio, name+1);
859  GWEN_SyncIo_WriteLine(sio, ", ");
860  GWEN_SyncIo_WriteString(sio, "get it with @ref ");
861  GWEN_SyncIo_WriteString(sio, prefix);
862  GWEN_SyncIo_WriteString(sio, "_Get");
863  GWEN_SyncIo_WriteChar(sio, toupper(*name));
864  GWEN_SyncIo_WriteLine(sio, name+1);
865  GWEN_SyncIo_WriteLine(sio, "</p>");
866  GWEN_SyncIo_WriteLine(sio, "");
867  }
868  }
869  }
871  }
872  return 0;
873 }
874 
875 
876 
878  GWEN_XMLNODE *node,
879  GWEN_SYNCIO *sio,
880  const char *acc) {
881  const char *prefix;
882  const char *styp;
883  GWEN_XMLNODE *dn;
884  const char *brief;
885  const char *s;
886  int rv;
887 
888  prefix=get_struct_property(node, "prefix", 0);
889  if (!prefix) {
890  DBG_ERROR(0, "No prefix in struct");
891  return -1;
892  }
893  styp=get_struct_property(node, "id", 0);
894  if (!styp) {
895  DBG_ERROR(0, "No id in struct");
896  return -1;
897  }
898 
899  GWEN_SyncIo_WriteString(sio, "/** @page P_");
900  GWEN_SyncIo_WriteString(sio, styp);
901  GWEN_SyncIo_WriteString(sio, "_");
902  s=acc;
903  while(*s) {
904  GWEN_SyncIo_WriteChar(sio, toupper(*s));
905  s++;
906  }
907  brief=GWEN_XMLNode_GetProperty(node, "name", prefix);
908  GWEN_SyncIo_WriteString(sio, " ");
909  GWEN_SyncIo_WriteString(sio, brief);
910  GWEN_SyncIo_WriteString(sio, " (");
911  GWEN_SyncIo_WriteString(sio, acc);
912  GWEN_SyncIo_WriteLine(sio, ")");
913 
914  GWEN_SyncIo_WriteString(sio, "This page describes the properties of ");
915  GWEN_SyncIo_WriteLine(sio, styp);
916 
917  dn=GWEN_XMLNode_FindFirstTag(node, "descr", 0, 0);
918  if (dn) {
919  if (write_xml_to_bio(dn, sio,
922  DBG_INFO(0, "here");
923  return -1;
924  }
925  }
926 
927  rv=write_apidocrec_c(args, node, sio, acc, 3);
928  if (rv) {
929  DBG_INFO(0, "here (%d)", rv);
930  return rv;
931  }
932 
933  GWEN_SyncIo_WriteLine(sio, "*/");
934 
935  return 0;
936 }
937 
938 
939 
940 
941 int write_files(ARGUMENTS *args, GWEN_XMLNODE *node) {
942  int rv;
943  GWEN_XMLNODE *n;
944 
945  n=GWEN_XMLNode_FindFirstTag(node, "types", 0, 0);
946  if (!n) {
947  DBG_WARN(0, "Empty file");
948  return 0;
949  }
950  rv=write_hp_files_c(args, n);
951  if (rv) {
952  DBG_INFO(0, "here (%d)", rv);
953  return rv;
954  }
955 
956  rv=write_hl_files_c(args, n);
957  if (rv) {
958  DBG_INFO(0, "here (%d)", rv);
959  return rv;
960  }
961 
962  rv=write_ha_files_c(args, n);
963  if (rv) {
964  DBG_INFO(0, "here (%d)", rv);
965  return rv;
966  }
967 
968  rv=write_code_files_c(args, n);
969  if (rv) {
970  DBG_INFO(0, "here (%d)", rv);
971  return rv;
972  }
973 
974  return 0;
975 }
976 
977 
978 
979 const char *get_function_name2(GWEN_XMLNODE *node, const char *ftype,
980  const char *name) {
981  GWEN_XMLNODE *n;
982 
983  /* find typedef for this type */
984  n=node;
985  /* get root */
986  while(GWEN_XMLNode_GetParent(n))
988 
989  n=GWEN_XMLNode_FindFirstTag(n, "typedefs", 0, 0);
990  if (!n)
991  return 0;
992  n=GWEN_XMLNode_FindFirstTag(n, "type", "id", name);
993  if (!n)
994  return 0;
995 
996  n=GWEN_XMLNode_FindFirstTag(n, "functions", 0, 0);
997  if (n) {
998  n=GWEN_XMLNode_FindFirstTag(n, "function", "type", ftype);
999  if (n)
1000  return GWEN_XMLNode_GetProperty(n, "name", 0);
1001  }
1002 
1003  return 0;
1004 }
1005 
1006 
1007 
1008 const char *get_function_name(GWEN_XMLNODE *node, const char *ftype) {
1009  GWEN_XMLNODE *n;
1010  const char *name;
1011 
1012  n=GWEN_XMLNode_FindFirstTag(node, "functions", 0, 0);
1013  if (n) {
1014  n=GWEN_XMLNode_FindFirstTag(n, "function", "type", ftype);
1015  if (n)
1016  return GWEN_XMLNode_GetProperty(n, "name", 0);
1017  }
1018 
1019  name=GWEN_XMLNode_GetProperty(node, "type", 0);
1020  if (!name) {
1021  DBG_ERROR(0, "no type for element");
1022  return 0;
1023  }
1024 
1025  /* find typedef for this type */
1026  n=node;
1027  /* get root */
1028  while(GWEN_XMLNode_GetParent(n))
1030 
1031  n=GWEN_XMLNode_FindFirstTag(n, "typedefs", 0, 0);
1032  if (!n)
1033  return 0;
1034  n=GWEN_XMLNode_FindFirstTag(n, "type", "id", name);
1035  if (!n)
1036  return 0;
1037 
1038  n=GWEN_XMLNode_FindFirstTag(n, "functions", 0, 0);
1039  if (n) {
1040  n=GWEN_XMLNode_FindFirstTag(n, "function", "type", ftype);
1041  if (n)
1042  return GWEN_XMLNode_GetProperty(n, "name", 0);
1043  }
1044 
1045  return 0;
1046 }
1047 
1048 
1049 
1050 GWEN_XMLNODE *get_typedef(GWEN_XMLNODE *node, const char *name) {
1051  GWEN_XMLNODE *n;
1052  GWEN_XMLNODE *n2;
1053 
1054  assert(name);
1055  /* find typedef for this type */
1056  n=node;
1057  /* get root */
1058  while(GWEN_XMLNode_GetParent(n))
1060 
1061  n2=GWEN_XMLNode_FindFirstTag(n, "typedefs", 0, 0);
1062  if (n2)
1063  n2=GWEN_XMLNode_FindFirstTag(n2, "type", "id", name);
1064  if (n2)
1065  return n2;
1066 
1067  n2=GWEN_XMLNode_FindFirstTag(n, "types", 0, 0);
1068  if (n2)
1069  n2=GWEN_XMLNode_FindFirstTag(n2, "type", "id", name);
1070  if (n2)
1071  return n2;
1072 
1073  n2=get_struct_node(node);
1074  assert(n2);
1075 
1076  n2=GWEN_XMLNode_FindFirstTag(n2, "subtypes", 0, 0);
1077  if (n2)
1078  n2=GWEN_XMLNode_FindFirstTag(n2, "type", "id", name);
1079  if (n2)
1080  return n2;
1081 
1082  return 0;
1083 }
1084 
1085 
1086 
1087 const char *get_property(GWEN_XMLNODE *node,
1088  const char *pname,
1089  const char *defval) {
1090  GWEN_XMLNODE *n;
1091  const char *name;
1092  const char *r;
1093 
1094  r=GWEN_XMLNode_GetProperty(node, pname, 0);
1095  if (r)
1096  return r;
1097 
1098  name=GWEN_XMLNode_GetProperty(node, "type", 0);
1099  if (!name) {
1100  DBG_ERROR(0, "no type for element");
1101  return defval;
1102  }
1103 
1104  /* find typedef for this type */
1105  n=node;
1106  /* get root */
1107  while(GWEN_XMLNode_GetParent(n))
1109 
1110  n=GWEN_XMLNode_FindFirstTag(n, "typedefs", 0, 0);
1111  if (!n)
1112  return defval;
1113  n=GWEN_XMLNode_FindFirstTag(n, "type", "id", name);
1114  if (!n)
1115  return defval;
1116 
1117  return GWEN_XMLNode_GetProperty(n, pname, defval);
1118 }
1119 
1120 
1121 
1123  const char *pname,
1124  const char *defval) {
1125  GWEN_XMLNODE *n;
1126 
1128  if (strcasecmp(GWEN_XMLNode_GetData(node), "type")==0) {
1129  return GWEN_XMLNode_GetProperty(node, pname, defval);
1130  }
1131 
1132  /* find typedef for this type */
1133  n=GWEN_XMLNode_GetParent(node);
1134  if (n)
1135  return get_struct_property(n, pname, defval);
1136 
1137  return defval;
1138 }
1139 
1140 
1141 
1143  while(node) {
1145  if (strcasecmp(GWEN_XMLNode_GetData(node), "type")==0) {
1146  return node;
1147  }
1148  node=GWEN_XMLNode_GetParent(node);
1149  }
1150 
1151  return 0;
1152 }
1153 
1154 
1155 
1156 int main(int argc, char **argv) {
1157  ARGUMENTS *args;
1158  int rv;
1159  FREEPARAM *inFile;
1160 
1161  args=Arguments_new();
1162  rv=checkArgs(args, argc, argv);
1163  if (rv==-1) {
1164  fprintf(stderr, "Parameter error\n");
1165  return rv;
1166  }
1167  else if (rv==-2) {
1168  return 0;
1169  }
1170 
1171  GWEN_Logger_Open(0, "typemaker",
1172  args->logFile,
1173  args->logType,
1175  GWEN_Logger_SetLevel(0, args->logLevel);
1176 
1177  inFile=args->params;
1178  if (!inFile) {
1179  fprintf(stderr, "No input file given.\n");
1180  Arguments_free(args);
1181  return 1;
1182  }
1183 
1184  /* read all files */
1185  while(inFile) {
1186  GWEN_XMLNODE *n;
1187 
1189  if (GWEN_XML_ReadFile(n, inFile->param, GWEN_XML_FLAGS_DEFAULT)) {
1190  fprintf(stderr, "ERROR: Error reading file \"%s\"\n", inFile->param);
1191  GWEN_XMLNode_free(n);
1192  return 2;
1193  }
1194 
1195  /* write file(s) */
1196  rv=write_files(args, n);
1197  if (rv) {
1198  DBG_ERROR(0, "Error in file \"%s\"", inFile->param);
1199  GWEN_XMLNode_free(n);
1200  return 2;
1201  }
1202 
1203  GWEN_XMLNode_free(n);
1204  inFile=inFile->next;
1205  } /* while */
1206 
1207 
1208  Arguments_free(args);
1209 
1210  return 0;
1211 }
1212 
1213 
1214 
1215 
int GWEN_SyncIo_WriteForced(GWEN_SYNCIO *sio, const uint8_t *buffer, uint32_t size)
Definition: syncio.c:295
int write_h_header(ARGUMENTS *args, GWEN_XMLNODE *node, GWEN_SYNCIO *sio, const char *where)
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
Definition: buffer.c:223
GWENHYWFAR_API int GWEN_XMLNode_toBuffer(const GWEN_XMLNODE *n, GWEN_BUFFER *buf, uint32_t flags)
Definition: xmlrw.c:351
#define GWEN_XML_FLAGS_DEFAULT
Definition: xml.h:110
uint32_t GWEN_Buffer_GetUsedBytes(const GWEN_BUFFER *bf)
Definition: buffer.c:266
#define GWEN_XML_FLAGS_SIMPLE
Definition: xml.h:89
const char * GWEN_XMLNode_GetProperty(const GWEN_XMLNODE *n, const char *name, const char *defaultValue)
Definition: xml.c:228
void GWEN_Logger_SetLevel(const char *logDomain, GWEN_LOGGER_LEVEL l)
Definition: logger.c:604
int checkArgs(ARGUMENTS *args, int argc, char **argv)
GWEN_XMLNODE * GWEN_XMLNode_FindNextTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
Definition: xml.c:712
GWEN_XMLNODE * GWEN_XMLNode_GetFirstData(const GWEN_XMLNODE *n)
Definition: xml.c:646
const char * param
int write_ha_files_c(ARGUMENTS *args, GWEN_XMLNODE *node)
Definition: ahc.c:540
GWENHYWFAR_API int GWEN_XML_ReadFile(GWEN_XMLNODE *n, const char *filepath, uint32_t flags)
Definition: xmlrw.c:973
int write_hl_files_c(ARGUMENTS *args, GWEN_XMLNODE *node)
Definition: lhc.c:402
#define DBG_WARN(dbg_logger, format, args...)
Definition: debug.h:118
#define DBG_ERROR_ERR(dbg_logger, dbg_err)
Definition: debug.h:108
uint32_t GWEN_Buffer_GetPos(const GWEN_BUFFER *bf)
Definition: buffer.c:239
int write_hp_files_c(ARGUMENTS *args, GWEN_XMLNODE *node)
Definition: phc.c:501
GWEN_XMLNODE * GWEN_XMLNode_new(GWEN_XMLNODE_TYPE t, const char *data)
Definition: xml.c:137
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
Definition: buffer.c:38
int write_apidocrec_c(ARGUMENTS *args, GWEN_XMLNODE *node, GWEN_SYNCIO *sio, const char *acc, int level)
int main(int argc, char **argv)
int GWEN_SyncIo_WriteLine(GWEN_SYNCIO *sio, const char *s)
Definition: syncio.c:382
ARGUMENTS * Arguments_new()
GWEN_XMLNODE * GWEN_XMLNode_FindFirstTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
Definition: xml.c:695
GWEN_XMLNODE * get_typedef(GWEN_XMLNODE *node, const char *name)
GWEN_XMLNODE * get_struct_node(GWEN_XMLNODE *node)
struct GWEN_SYNCIO GWEN_SYNCIO
Definition: syncio.h:40
GWEN_XMLNODE_TYPE GWEN_XMLNode_GetType(const GWEN_XMLNODE *n)
Definition: xml.c:431
GWEN_LOGGER_LOGTYPE logType
const char * get_struct_property(GWEN_XMLNODE *node, const char *pname, const char *defval)
int write_h_funcs(ARGUMENTS *args, GWEN_XMLNODE *node, GWEN_SYNCIO *sio, const char *acc)
GWEN_XMLNODE * GWEN_XMLNode_GetNextTag(const GWEN_XMLNODE *n)
Definition: xml.c:635
FREEPARAM * next
GWEN_LOGGER_LEVEL logLevel
FREEPARAM * params
int write_files(ARGUMENTS *args, GWEN_XMLNODE *node)
int GWEN_Buffer_AppendByte(GWEN_BUFFER *bf, char c)
Definition: buffer.c:380
void GWEN_Buffer_free(GWEN_BUFFER *bf)
Definition: buffer.c:83
void GWEN_XMLNode_free(GWEN_XMLNODE *n)
Definition: xml.c:152
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:41
GWEN_XMLNODE * GWEN_XMLNode_GetParent(const GWEN_XMLNODE *n)
Definition: xml.c:392
const char * get_property(GWEN_XMLNODE *node, const char *pname, const char *defval)
int GWEN_Logger_Open(const char *logDomain, const char *ident, const char *file, GWEN_LOGGER_LOGTYPE logtype, GWEN_LOGGER_FACILITY facility)
Definition: logger.c:212
int GWEN_Buffer_Crop(GWEN_BUFFER *bf, uint32_t pos, uint32_t l)
Definition: buffer.c:973
const char * domain
#define DBG_ERROR(dbg_logger, format, args...)
Definition: debug.h:97
GWEN_XMLNODE * GWEN_XMLNode_GetFirstTag(const GWEN_XMLNODE *n)
Definition: xml.c:629
int GWEN_SyncIo_WriteString(GWEN_SYNCIO *sio, const char *s)
Definition: syncio.c:368
const char * GWEN_XMLNode_GetData(const GWEN_XMLNODE *n)
Definition: xml.c:351
int write_h_enums(ARGUMENTS *args, GWEN_XMLNODE *node, GWEN_SYNCIO *sio, const char *acc)
const char * get_function_name(GWEN_XMLNODE *node, const char *ftype)
int write_code_files_c(ARGUMENTS *args, GWEN_XMLNODE *node)
Definition: code_c.c:2937
#define DBG_INFO(dbg_logger, format, args...)
Definition: debug.h:164
int write_h_setget_c(ARGUMENTS *args, GWEN_XMLNODE *node, GWEN_SYNCIO *sio, const char *acc)
#define GWEN_XML_FLAGS_INDENT
Definition: xml.h:66
int write_xml_to_bio(GWEN_XMLNODE *n, GWEN_SYNCIO *sio, uint32_t flags)
void write_if_nonnull(GWEN_SYNCIO *sio, const char *str)
const char * get_function_name2(GWEN_XMLNODE *node, const char *ftype, const char *name)
int write_apidoc_c(ARGUMENTS *args, GWEN_XMLNODE *node, GWEN_SYNCIO *sio, const char *acc)
struct GWEN__XMLNODE GWEN_XMLNODE
Definition: xml.h:148
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)
Definition: buffer.c:1014
int GWEN_SyncIo_WriteChar(GWEN_SYNCIO *sio, char s)
Definition: syncio.c:405
void Arguments_free(ARGUMENTS *ar)