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