gwenhywfar  5.7.2
file.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Mon Feb 08 2021
3  copyright : (C) 2021 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 
15 #include "gwenbuild/types/file_p.h"
16 
17 #include <gwenhywfar/debug.h>
18 #include <gwenhywfar/memory.h>
19 #include <gwenhywfar/buffer.h>
20 
21 #include <string.h>
22 
23 
24 
26 
27 
28 static void _writeFileFlagsToXml(uint32_t flags, GWEN_XMLNODE *xmlNode, const char *varName);
29 static uint32_t _readFlagsFromChar(const char *flagsAsText);
30 
31 
32 
33 
34 GWB_FILE *GWB_File_new(const char *folder, const char *fName, uint32_t id)
35 {
36  GWB_FILE *f;
37 
39  if (folder && *folder)
40  GWB_File_SetFolder(f, folder);
41  if (fName && *fName)
42  GWB_File_SetName(f, fName);
43  f->id=id;
44 
45  return f;
46 }
47 
48 
49 
50 GWB_FILE *GWB_File_dup(const GWB_FILE *oldFile)
51 {
52  if (oldFile) {
53  GWB_FILE *fileOut;
54 
55  fileOut=GWB_File_new(oldFile->folder, oldFile->name, 0);
56  GWB_File_SetFileType(fileOut, oldFile->fileType);
57  GWB_File_SetInstallPath(fileOut, oldFile->installPath);
58  GWB_File_SetBuilder(fileOut, oldFile->builder);
59  GWB_File_SetFlags(fileOut, oldFile->flags);
60  fileOut->buildCmd=oldFile->buildCmd;
61  return fileOut;
62  }
63 
64  return NULL;
65 }
66 
67 
68 
70 {
71  if (f) {
72  GWB_BuildCmd_List2_free(f->waitingBuildCmdList2);
73  free(f->builder);
74  free(f->folder);
75  free(f->name);
76 
78  }
79 }
80 
81 
82 
83 uint32_t GWB_File_GetId(const GWB_FILE *f)
84 {
85  return f->id;
86 }
87 
88 
89 
90 void GWB_File_SetId(GWB_FILE *f, uint32_t i)
91 {
92  f->id=i;
93 }
94 
95 
96 
97 uint32_t GWB_File_GetFlags(const GWB_FILE *f)
98 {
99  return f->flags;
100 }
101 
102 
103 
104 void GWB_File_SetFlags(GWB_FILE *f, uint32_t i)
105 {
106  f->flags=i;
107 }
108 
109 
110 
111 void GWB_File_AddFlags(GWB_FILE *f, uint32_t i)
112 {
113  f->flags|=i;
114 }
115 
116 
117 
118 void GWB_File_DelFlags(GWB_FILE *f, uint32_t i)
119 {
120  f->flags&=~i;
121 }
122 
123 
124 
125 const char *GWB_File_GetFolder(const GWB_FILE *f)
126 {
127  return f->folder;
128 }
129 
130 
131 
132 void GWB_File_SetFolder(GWB_FILE *f, const char *s)
133 {
134  if (f->folder)
135  free(f->folder);
136  if (s && *s)
137  f->folder=strdup(s);
138  else
139  f->folder=NULL;
140 }
141 
142 
143 
144 const char *GWB_File_GetName(const GWB_FILE *f)
145 {
146  return f->name;
147 }
148 
149 
150 
151 void GWB_File_SetName(GWB_FILE *f, const char *s)
152 {
153  if (f->name)
154  free(f->name);
155  if (s && *s)
156  f->name=strdup(s);
157  else
158  f->name=NULL;
159 }
160 
161 
162 
163 const char *GWB_File_GetExt(const GWB_FILE *f)
164 {
165  if (f->name)
166  return (const char*) strrchr(f->name, '.');
167  return NULL;
168 }
169 
170 
171 
172 const char *GWB_File_GetBuilder(const GWB_FILE *f)
173 {
174  return f->builder;
175 }
176 
177 
178 
179 void GWB_File_SetBuilder(GWB_FILE *f, const char *s)
180 {
181  free(f->builder);
182  f->builder=s?strdup(s):NULL;
183 }
184 
185 
186 
187 const char *GWB_File_GetInstallPath(const GWB_FILE *f)
188 {
189  return f->installPath;
190 }
191 
192 
193 
194 void GWB_File_SetInstallPath(GWB_FILE *f, const char *s)
195 {
196  if (f->installPath)
197  free(f->installPath);
198  if (s && *s)
199  f->installPath=strdup(s);
200  else
201  f->installPath=NULL;
202 }
203 
204 
205 
206 const char *GWB_File_GetFileType(const GWB_FILE *f)
207 {
208  return f->fileType;
209 }
210 
211 
212 
213 void GWB_File_SetFileType(GWB_FILE *f, const char *s)
214 {
215  if (f->fileType)
216  free(f->fileType);
217  if (s && *s)
218  f->fileType=strdup(s);
219  else
220  f->fileType=NULL;
221 }
222 
223 
224 
225 GWB_BUILD_CMD_LIST2 *GWB_File_GetWaitingBuildCmdList2(const GWB_FILE *f)
226 {
227  return f->waitingBuildCmdList2;
228 }
229 
230 
231 
233 {
234  if (f->waitingBuildCmdList2==NULL)
235  f->waitingBuildCmdList2=GWB_BuildCmd_List2_new();
236  GWB_BuildCmd_List2_PushBack(f->waitingBuildCmdList2, bcmd);
237 }
238 
239 
240 
242 {
243  if (f->waitingBuildCmdList2)
244  GWB_BuildCmd_List2_Clear(f->waitingBuildCmdList2);
245 }
246 
247 
248 
250 {
251  return f->buildCmd;
252 }
253 
254 
255 
257 {
258  f->buildCmd=bcmd;
259 }
260 
261 
262 
263 void GWB_File_List2_FreeAll(GWB_FILE_LIST2 *fileList2)
264 {
265  if (fileList2) {
266  GWB_FILE_LIST2_ITERATOR *it;
267 
268  it=GWB_File_List2_First(fileList2);
269  if (it) {
270  GWB_FILE *f;
271 
272  f=GWB_File_List2Iterator_Data(it);
273  while(f) {
274  GWB_File_free(f);
275  f=GWB_File_List2Iterator_Next(it);
276  }
277  }
278  GWB_File_List2_free(fileList2);
279  }
280 }
281 
282 
283 
284 void GWB_File_ReplaceExtension(GWB_FILE *file, const char *newExt)
285 {
286  const char *s;
287 
288  s=file->name;
289  if (s && *s) {
290  const char *ext;
291  GWEN_BUFFER *buf;
292 
293  buf=GWEN_Buffer_new(0, 64, 0, 1);
294  ext=strrchr(s, '.');
295  if (ext) {
296  int len;
297 
298  len=(ext-s); /* exclude "." */
299  if (len) {
300  GWEN_Buffer_AppendBytes(buf, s, len);
301  }
302  }
303  GWEN_Buffer_AppendString(buf, newExt);
305  GWEN_Buffer_free(buf);
306  }
307 }
308 
309 
310 
311 GWB_FILE *GWB_File_CopyObjectAndChangeExtension(const GWB_FILE *file, const char *newExt)
312 {
313  GWB_FILE *fileOut;
314  const char *s1;
315  const char *s2;
316 
317  fileOut=GWB_File_dup(file);
318  GWB_File_ReplaceExtension(fileOut, newExt);
319  s1=GWB_File_GetName(file);
320  s2=GWB_File_GetName(fileOut);
321  if (strcasecmp(s1, s2)==0) {
322  DBG_ERROR(NULL, "Output file has the same name as input file (%s)!", s1);
323  GWB_File_free(fileOut);
324  return NULL;
325  }
326 
327  return fileOut;
328 }
329 
330 
331 
332 GWB_FILE *GWB_File_List2_GetFileByPathAndName(const GWB_FILE_LIST2 *fileList, const char *folder, const char *fname)
333 {
334  GWB_FILE_LIST2_ITERATOR *it;
335 
336  it=GWB_File_List2_First(fileList);
337  if (it) {
338  GWB_FILE *file;
339 
340  file=GWB_File_List2Iterator_Data(it);
341  while(file) {
342  const char *currentName;
343 
344  currentName=GWB_File_GetName(file);
345  if (currentName && *currentName && strcasecmp(currentName, fname)==0) {
346  const char *currentFolder;
347 
348  currentFolder=GWB_File_GetFolder(file);
349  if (currentFolder && *currentFolder && strcasecmp(currentFolder, folder)==0) {
350  GWB_File_List2Iterator_free(it);
351  return file;
352  }
353  }
354  file=GWB_File_List2Iterator_Next(it);
355  }
356  GWB_File_List2Iterator_free(it);
357  }
358 
359  return NULL;
360 }
361 
362 
363 
364 GWB_FILE *GWB_File_List2_GetOrCreateFile(GWB_FILE_LIST2 *fileList, const char *folder, const char *fname)
365 {
366  GWEN_BUFFER *pathBuf;
367  char *s;
368  const char *realFolder;
369  const char *realFilename;
370  GWB_FILE *file;
371 
372  pathBuf=GWEN_Buffer_new(0, 256, 0, 1);
373  if (folder && *folder) {
374  GWEN_Buffer_AppendString(pathBuf, folder);
376  }
377  GWEN_Buffer_AppendString(pathBuf, fname);
378  s=strrchr(GWEN_Buffer_GetStart(pathBuf), GWEN_DIR_SEPARATOR);
379  if (s) {
380  *s=0;
381  realFolder=GWEN_Buffer_GetStart(pathBuf);
382  realFilename=s+1;
383  }
384  else {
385  realFolder=NULL;
386  realFilename=GWEN_Buffer_GetStart(pathBuf);
387  }
388 
389  file=GWB_File_List2_GetFileByPathAndName(fileList, realFolder, realFilename);
390  if (file==NULL) {
391  file=GWB_File_new(realFolder, realFilename, 0);
392  GWB_File_List2_PushBack(fileList, file);
393  }
394  GWEN_Buffer_free(pathBuf);
395  return file;
396 }
397 
398 
399 
400 GWB_FILE *GWB_File_List2_GetFileById(const GWB_FILE_LIST2 *fileList, uint32_t id)
401 {
402  GWB_FILE_LIST2_ITERATOR *it;
403 
404  it=GWB_File_List2_First(fileList);
405  if (it) {
406  GWB_FILE *file;
407 
408  file=GWB_File_List2Iterator_Data(it);
409  while(file) {
410  if (GWB_File_GetId(file)==id) {
411  GWB_File_List2Iterator_free(it);
412  return file;
413  }
414  file=GWB_File_List2Iterator_Next(it);
415  }
416  GWB_File_List2Iterator_free(it);
417  }
418 
419  return NULL;
420 }
421 
422 
423 
424 void GWB_File_AddFileList2ToFileList2(GWB_FILE_LIST2 *sourceList, GWB_FILE_LIST2 *destList, const char *ext)
425 {
426  GWB_FILE_LIST2_ITERATOR *it;
427 
428  it=GWB_File_List2_First(sourceList);
429  if (it) {
430  GWB_FILE *file;
431 
432  file=GWB_File_List2Iterator_Data(it);
433  while(file) {
434  if (ext && *ext) {
435  const char *s;
436 
437  s=GWB_File_GetExt(file);
438  if (s && strcasecmp(s, ext)==0) {
439  GWB_File_List2_PushBack(destList, file);
440  }
441  }
442  else
443  GWB_File_List2_PushBack(destList, file);
444  file=GWB_File_List2Iterator_Next(it);
445  }
446  GWB_File_List2Iterator_free(it);
447  }
448 }
449 
450 
451 
452 void GWB_File_WriteFileNameToTopBuildDirString(const GWB_FILE *file, const char *initialSourceDir, GWEN_BUFFER *fbuf)
453 {
454  const char *s;
455 
457  if (initialSourceDir && *initialSourceDir) {
458  GWEN_Buffer_AppendString(fbuf, initialSourceDir);
460  }
461  }
462  s=GWB_File_GetFolder(file);
463  if (s && *s) {
464  GWEN_Buffer_AppendString(fbuf, s);
466  }
467  s=GWB_File_GetName(file);
468  GWEN_Buffer_AppendString(fbuf, s);
469 }
470 
471 
472 
473 GWEN_STRINGLIST *GWB_File_FileListToTopBuildDirStringList(const GWB_FILE_LIST2 *fileList, const char *initialSourceDir)
474 {
475  GWB_FILE_LIST2_ITERATOR *it;
476 
477  it=GWB_File_List2_First(fileList);
478  if (it) {
479  GWEN_STRINGLIST *sl;
480  GWB_FILE *file;
481  GWEN_BUFFER *fbuf;
482 
483  sl=GWEN_StringList_new();
484  fbuf=GWEN_Buffer_new(0, 256, 0, 1);
485  file=GWB_File_List2Iterator_Data(it);
486  while(file) {
487  GWB_File_WriteFileNameToTopBuildDirString(file, initialSourceDir, fbuf);
489  GWEN_Buffer_Reset(fbuf);
490  file=GWB_File_List2Iterator_Next(it);
491  } /* while */
492  GWEN_Buffer_Reset(fbuf);
493  GWB_File_List2Iterator_free(it);
494 
495  if (GWEN_StringList_Count(sl)==0) {
497  return NULL;
498  }
499  return sl;
500  }
501 
502  return NULL;
503 }
504 
505 
506 
507 void GWB_File_toXml(const GWB_FILE *file, GWEN_XMLNODE *xmlNode)
508 {
509  GWEN_XMLNode_SetIntProperty(xmlNode, "id", (int) (file->id));
510  if (file->folder)
511  GWEN_XMLNode_SetCharValue(xmlNode, "folder", file->folder);
512  if (file->name)
513  GWEN_XMLNode_SetCharValue(xmlNode, "name", file->name);
514  if (file->fileType)
515  GWEN_XMLNode_SetCharValue(xmlNode, "type", file->fileType);
516  if (file->installPath)
517  GWEN_XMLNode_SetCharValue(xmlNode, "installPath", file->installPath);
518  if (file->builder)
519  GWEN_XMLNode_SetCharValue(xmlNode, "builder", file->builder);
520  _writeFileFlagsToXml(GWB_File_GetFlags(file), xmlNode, "flags");
521 }
522 
523 
524 
526 {
527  uint32_t id;
528  GWB_FILE *file;
529  const char *folder;
530  const char *name;
531  const char *s;
532 
533  id=(uint32_t) GWEN_XMLNode_GetIntProperty(xmlNode, "id", 0);
534 
535  folder=GWEN_XMLNode_GetCharValue(xmlNode, "folder", NULL);
536  name=GWEN_XMLNode_GetCharValue(xmlNode, "name", NULL);
537 
538  file=GWB_File_new(folder, name, id);
539  s=GWEN_XMLNode_GetCharValue(xmlNode, "flags", NULL);
540  if (s)
541  file->flags=_readFlagsFromChar(s);
542  GWB_File_SetFileType(file, GWEN_XMLNode_GetCharValue(xmlNode, "type", NULL));
543  GWB_File_SetInstallPath(file, GWEN_XMLNode_GetCharValue(xmlNode, "installPath", NULL));
544  GWB_File_SetBuilder(file, GWEN_XMLNode_GetCharValue(xmlNode, "builder", NULL));
545 
546  return file;
547 }
548 
549 
550 
551 void _writeFileFlagsToXml(uint32_t flags, GWEN_XMLNODE *xmlNode, const char *varName)
552 {
553  if (flags) {
554  GWEN_BUFFER *dbuf;
555 
556  dbuf=GWEN_Buffer_new(0, 256, 0, 1);
557 
558  if (flags & GWB_FILE_FLAGS_DIST) {
559  if (GWEN_Buffer_GetUsedBytes(dbuf))
560  GWEN_Buffer_AppendString(dbuf, " ");
561  GWEN_Buffer_AppendString(dbuf, "DIST");
562  }
563 
564  if (flags & GWB_FILE_FLAGS_INSTALL) {
565  if (GWEN_Buffer_GetUsedBytes(dbuf))
566  GWEN_Buffer_AppendString(dbuf, " ");
567  GWEN_Buffer_AppendString(dbuf, "INSTALL");
568  }
569 
570  if (flags & GWB_FILE_FLAGS_GENERATED) {
571  if (GWEN_Buffer_GetUsedBytes(dbuf))
572  GWEN_Buffer_AppendString(dbuf, " ");
573  GWEN_Buffer_AppendString(dbuf, "GENERATED");
574  }
575 
576  if (GWEN_Buffer_GetUsedBytes(dbuf))
577  GWEN_XMLNode_SetCharValue(xmlNode, varName, GWEN_Buffer_GetStart(dbuf));
578  GWEN_Buffer_free(dbuf);
579  }
580 }
581 
582 
583 
584 uint32_t _readFlagsFromChar(const char *flagsAsText)
585 {
586  GWEN_STRINGLIST *sl;
587  uint32_t flags=0;
588 
589  sl=GWEN_StringList_fromString(flagsAsText, " ", 1);
590  if (sl) {
592 
594  while(se) {
595  const char *s;
596 
598  if (s && *s) {
599  if (strcasecmp(s, "DIST")==0)
600  flags|=GWB_FILE_FLAGS_DIST;
601  else if (strcasecmp(s, "INSTALL")==0)
602  flags|=GWB_FILE_FLAGS_INSTALL;
603  else if (strcasecmp(s, "GENERATED")==0)
605  else {
606  DBG_ERROR(NULL, "Unexpected FILE flag \"%s\"", s);
607  }
608  }
610  }
612  }
613 
614  return flags;
615 }
616 
617 
618 
619 GWB_FILE *GWB_File_List2_GetAt(const GWB_FILE_LIST2 *fileList, int index)
620 {
621  GWB_FILE_LIST2_ITERATOR *it;
622  int i=0;
623 
624  it=GWB_File_List2_First(fileList);
625  if (it) {
626  GWB_FILE *file;
627 
628  file=GWB_File_List2Iterator_Data(it);
629  while(file) {
630  if (i==index) {
631  GWB_File_List2Iterator_free(it);
632  return file;
633  }
634  i++;
635  file=GWB_File_List2Iterator_Next(it);
636  }
637 
638  GWB_File_List2Iterator_free(it);
639  }
640 
641  return NULL;
642 }
643 
644 
645 
646 void GWB_File_List2_WriteXml(const GWB_FILE_LIST2 *fileList, GWEN_XMLNODE *xmlNode, const char *groupName)
647 {
648  GWB_FILE_LIST2_ITERATOR *it;
649 
650  it=GWB_File_List2_First(fileList);
651  if (it) {
652  GWB_FILE *file;
653 
654  file=GWB_File_List2Iterator_Data(it);
655  while(file) {
656  GWEN_XMLNODE *entryNode;
657 
658  entryNode=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, groupName);
659  GWB_File_toXml(file, entryNode);
660  GWEN_XMLNode_AddChild(xmlNode, entryNode);
661  file=GWB_File_List2Iterator_Next(it);
662  }
663  GWB_File_List2Iterator_free(it);
664  }
665 }
666 
667 
668 
669 void GWB_File_List2_ReadXml(GWEN_XMLNODE *xmlNode, const char *groupName, GWB_FILE_LIST2 *destFileList)
670 {
671  GWEN_XMLNODE *xmlEntry;
672 
673  xmlEntry=GWEN_XMLNode_FindFirstTag(xmlNode, groupName, NULL, NULL);
674  while(xmlEntry) {
675  GWB_FILE *file;
676 
677  file=GWB_File_fromXml(xmlEntry);
678  if (file)
679  GWB_File_List2_PushBack(destFileList, file);
680  xmlEntry=GWEN_XMLNode_FindNextTag(xmlEntry, groupName, NULL, NULL);
681  }
682 }
683 
684 
685 
686 
687 
void GWB_File_free(GWB_FILE *f)
Definition: file.c:69
const char * GWB_File_GetFileType(const GWB_FILE *f)
Definition: file.c:206
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
Definition: buffer.c:235
struct GWEN_STRINGLISTENTRYSTRUCT GWEN_STRINGLISTENTRY
Definition: stringlist.h:53
#define GWEN_LIST2_FUNCTIONS(t, pr)
Definition: list2.h:99
GWB_FILE * GWB_File_List2_GetFileById(const GWB_FILE_LIST2 *fileList, uint32_t id)
Definition: file.c:400
uint32_t GWB_File_GetId(const GWB_FILE *f)
Definition: file.c:83
#define GWEN_DIR_SEPARATOR_S
uint32_t GWEN_Buffer_GetUsedBytes(const GWEN_BUFFER *bf)
Definition: buffer.c:277
void GWB_File_SetBuildCmd(GWB_FILE *f, GWB_BUILD_CMD *bcmd)
Definition: file.c:256
void GWB_File_SetInstallPath(GWB_FILE *f, const char *s)
Definition: file.c:194
GWEN_XMLNODE * GWEN_XMLNode_FindNextTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
Definition: xml.c:794
struct GWB_FILE GWB_FILE
Definition: file.h:18
#define GWEN_FREE_OBJECT(varname)
Definition: memory.h:61
#define NULL
Definition: binreloc.c:300
void GWB_File_AddFlags(GWB_FILE *f, uint32_t i)
Definition: file.c:111
GWB_FILE * GWB_File_dup(const GWB_FILE *oldFile)
Definition: file.c:50
GWB_FILE * GWB_File_List2_GetOrCreateFile(GWB_FILE_LIST2 *fileList, const char *folder, const char *fname)
Definition: file.c:364
void GWB_File_SetFileType(GWB_FILE *f, const char *s)
Definition: file.c:213
void GWB_File_DelFlags(GWB_FILE *f, uint32_t i)
Definition: file.c:118
void GWB_File_List2_ReadXml(GWEN_XMLNODE *xmlNode, const char *groupName, GWB_FILE_LIST2 *destFileList)
Definition: file.c:669
void GWB_File_SetId(GWB_FILE *f, uint32_t i)
Definition: file.c:90
void GWB_File_AddFileList2ToFileList2(GWB_FILE_LIST2 *sourceList, GWB_FILE_LIST2 *destList, const char *ext)
Definition: file.c:424
void GWEN_XMLNode_SetCharValue(GWEN_XMLNODE *n, const char *name, const char *value)
Definition: xml.c:897
GWB_FILE * GWB_File_fromXml(GWEN_XMLNODE *xmlNode)
Definition: file.c:525
GWB_BUILD_CMD_LIST2 * GWB_File_GetWaitingBuildCmdList2(const GWB_FILE *f)
Definition: file.c:225
GWEN_XMLNODE * GWEN_XMLNode_new(GWEN_XMLNODE_TYPE t, const char *data)
Definition: xml.c:144
#define GWB_FILE_FLAGS_DIST
Definition: file.h:21
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
Definition: buffer.c:42
GWEN_STRINGLISTENTRY * GWEN_StringList_FirstEntry(const GWEN_STRINGLIST *sl)
Definition: stringlist.c:390
GWB_BUILD_CMD * GWB_File_GetBuildCmd(const GWB_FILE *f)
Definition: file.c:249
void GWEN_Buffer_Reset(GWEN_BUFFER *bf)
Definition: buffer.c:650
const char * GWEN_StringListEntry_Data(const GWEN_STRINGLISTENTRY *se)
Definition: stringlist.c:406
#define GWB_FILE_FLAGS_INSTALL
Definition: file.h:22
const char * GWB_File_GetInstallPath(const GWB_FILE *f)
Definition: file.c:187
const char * GWB_File_GetFolder(const GWB_FILE *f)
Definition: file.c:125
GWB_FILE * GWB_File_new(const char *folder, const char *fName, uint32_t id)
Definition: file.c:34
const char * GWB_File_GetName(const GWB_FILE *f)
Definition: file.c:144
void GWEN_StringList_free(GWEN_STRINGLIST *sl)
Definition: stringlist.c:62
GWEN_XMLNODE * GWEN_XMLNode_FindFirstTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
Definition: xml.c:776
void GWB_File_SetBuilder(GWB_FILE *f, const char *s)
Definition: file.c:179
#define GWEN_NEW_OBJECT(typ, varname)
Definition: memory.h:55
int GWEN_XMLNode_GetIntProperty(const GWEN_XMLNODE *n, const char *name, int defaultValue)
Definition: xml.c:263
const char * GWEN_XMLNode_GetCharValue(const GWEN_XMLNODE *n, const char *name, const char *defValue)
Definition: xml.c:812
int GWEN_StringList_AppendString(GWEN_STRINGLIST *sl, const char *s, int take, int checkDouble)
Definition: stringlist.c:245
void GWB_File_SetFolder(GWB_FILE *f, const char *s)
Definition: file.c:132
struct GWEN_STRINGLISTSTRUCT GWEN_STRINGLIST
Definition: stringlist.h:56
void GWB_File_SetFlags(GWB_FILE *f, uint32_t i)
Definition: file.c:104
GWEN_STRINGLIST * GWEN_StringList_fromString(const char *str, const char *delimiters, int checkDouble)
Definition: stringlist.c:746
void GWB_File_List2_FreeAll(GWB_FILE_LIST2 *fileList2)
Definition: file.c:263
const char * GWB_File_GetExt(const GWB_FILE *f)
Definition: file.c:163
void GWEN_Buffer_free(GWEN_BUFFER *bf)
Definition: buffer.c:89
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition: buffer.h:38
void GWEN_XMLNode_SetIntProperty(GWEN_XMLNODE *n, const char *name, int value)
Definition: xml.c:330
unsigned int GWEN_StringList_Count(const GWEN_STRINGLIST *sl)
Definition: stringlist.c:427
#define DBG_ERROR(dbg_logger, format, args...)
Definition: debug.h:97
void GWB_File_List2_WriteXml(const GWB_FILE_LIST2 *fileList, GWEN_XMLNODE *xmlNode, const char *groupName)
Definition: file.c:646
void GWB_File_toXml(const GWB_FILE *file, GWEN_XMLNODE *xmlNode)
Definition: file.c:507
const char * GWB_File_GetBuilder(const GWB_FILE *f)
Definition: file.c:172
void GWB_File_SetName(GWB_FILE *f, const char *s)
Definition: file.c:151
GWB_FILE * GWB_File_List2_GetFileByPathAndName(const GWB_FILE_LIST2 *fileList, const char *folder, const char *fname)
Definition: file.c:332
#define GWEN_DIR_SEPARATOR
GWEN_STRINGLISTENTRY * GWEN_StringListEntry_Next(const GWEN_STRINGLISTENTRY *se)
Definition: stringlist.c:398
void GWB_File_WriteFileNameToTopBuildDirString(const GWB_FILE *file, const char *initialSourceDir, GWEN_BUFFER *fbuf)
Definition: file.c:452
struct GWB_BUILD_CMD GWB_BUILD_CMD
Definition: buildcmd.h:20
uint32_t GWB_File_GetFlags(const GWB_FILE *f)
Definition: file.c:97
void GWB_File_ClearWaitingBuildCmds(GWB_FILE *f)
Definition: file.c:241
int GWEN_Buffer_AppendBytes(GWEN_BUFFER *bf, const char *buffer, uint32_t size)
Definition: buffer.c:361
GWEN_STRINGLIST * GWB_File_FileListToTopBuildDirStringList(const GWB_FILE_LIST2 *fileList, const char *initialSourceDir)
Definition: file.c:473
GWEN_STRINGLIST * GWEN_StringList_new(void)
Definition: stringlist.c:50
static uint32_t _readFlagsFromChar(const char *flagsAsText)
Definition: file.c:584
static void _writeFileFlagsToXml(uint32_t flags, GWEN_XMLNODE *xmlNode, const char *varName)
Definition: file.c:551
struct GWEN__XMLNODE GWEN_XMLNODE
Definition: xml.h:156
#define GWB_FILE_FLAGS_GENERATED
Definition: file.h:23
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)
Definition: buffer.c:989
void GWB_File_AddWaitingBuildCmd(GWB_FILE *f, GWB_BUILD_CMD *bcmd)
Definition: file.c:232
void GWEN_XMLNode_AddChild(GWEN_XMLNODE *n, GWEN_XMLNODE *child)
Definition: xml.c:423
GWB_FILE * GWB_File_List2_GetAt(const GWB_FILE_LIST2 *fileList, int index)
Definition: file.c:619
void GWB_File_ReplaceExtension(GWB_FILE *file, const char *newExt)
Definition: file.c:284
GWB_FILE * GWB_File_CopyObjectAndChangeExtension(const GWB_FILE *file, const char *newExt)
Definition: file.c:311