gwenhywfar  5.14.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==NULL && folder==NULL) ||
371  (currentFolder && *currentFolder && strcasecmp(currentFolder, folder)==0)) {
372  GWB_File_List2Iterator_free(it);
373  return file;
374  }
375  }
376  file=GWB_File_List2Iterator_Next(it);
377  }
378  GWB_File_List2Iterator_free(it);
379  }
380 
381  return NULL;
382 }
383 
384 
385 
386 GWB_FILE *GWB_File_List2_GetOrCreateFile(GWB_FILE_LIST2 *fileList, const char *folder, const char *fname)
387 {
388  GWEN_BUFFER *pathBuf;
389  char *s;
390  const char *realFolder;
391  const char *realFilename;
392  GWB_FILE *file;
393 
394  pathBuf=GWEN_Buffer_new(0, 256, 0, 1);
395  if (folder && *folder) {
396  GWEN_Buffer_AppendString(pathBuf, folder);
398  }
399  GWEN_Buffer_AppendString(pathBuf, fname);
400  s=strrchr(GWEN_Buffer_GetStart(pathBuf), GWEN_DIR_SEPARATOR);
401  if (s) {
402  *s=0;
403  realFolder=GWEN_Buffer_GetStart(pathBuf);
404  realFilename=s+1;
405  }
406  else {
407  realFolder=NULL;
408  realFilename=GWEN_Buffer_GetStart(pathBuf);
409  }
410 
411  file=GWB_File_List2_GetFileByPathAndName(fileList, realFolder, realFilename);
412  if (file==NULL) {
413  file=GWB_File_new(realFolder, realFilename, 0);
414  GWB_File_List2_PushBack(fileList, file);
415  }
416  GWEN_Buffer_free(pathBuf);
417  return file;
418 }
419 
420 
421 
422 GWB_FILE *GWB_File_List2_GetFileById(const GWB_FILE_LIST2 *fileList, uint32_t id)
423 {
424  GWB_FILE_LIST2_ITERATOR *it;
425 
426  it=GWB_File_List2_First(fileList);
427  if (it) {
428  GWB_FILE *file;
429 
430  file=GWB_File_List2Iterator_Data(it);
431  while(file) {
432  if (GWB_File_GetId(file)==id) {
433  GWB_File_List2Iterator_free(it);
434  return file;
435  }
436  file=GWB_File_List2Iterator_Next(it);
437  }
438  GWB_File_List2Iterator_free(it);
439  }
440 
441  return NULL;
442 }
443 
444 
445 
446 void GWB_File_AddFileList2ToFileList2(GWB_FILE_LIST2 *sourceList, GWB_FILE_LIST2 *destList, const char *ext)
447 {
448  GWB_FILE_LIST2_ITERATOR *it;
449 
450  it=GWB_File_List2_First(sourceList);
451  if (it) {
452  GWB_FILE *file;
453 
454  file=GWB_File_List2Iterator_Data(it);
455  while(file) {
456  if (ext && *ext) {
457  const char *s;
458 
459  s=GWB_File_GetExt(file);
460  if (s && strcasecmp(s, ext)==0) {
461  GWB_File_List2_PushBack(destList, file);
462  }
463  }
464  else
465  GWB_File_List2_PushBack(destList, file);
466  file=GWB_File_List2Iterator_Next(it);
467  }
468  GWB_File_List2Iterator_free(it);
469  }
470 }
471 
472 
473 
474 void GWB_File_WriteFileNameToTopBuildDirString(const GWB_FILE *file, const char *initialSourceDir, GWEN_BUFFER *fbuf)
475 {
476  const char *s;
477 
479  if (initialSourceDir && *initialSourceDir) {
480  GWEN_Buffer_AppendString(fbuf, initialSourceDir);
482  }
483  }
484  s=GWB_File_GetFolder(file);
485  if (s && *s) {
486  GWEN_Buffer_AppendString(fbuf, s);
488  }
489  s=GWB_File_GetName(file);
490  GWEN_Buffer_AppendString(fbuf, s);
491 }
492 
493 
494 
495 GWEN_STRINGLIST *GWB_File_FileListToTopBuildDirStringList(const GWB_FILE_LIST2 *fileList, const char *initialSourceDir)
496 {
497  GWB_FILE_LIST2_ITERATOR *it;
498 
499  it=GWB_File_List2_First(fileList);
500  if (it) {
501  GWEN_STRINGLIST *sl;
502  GWB_FILE *file;
503  GWEN_BUFFER *fbuf;
504 
505  sl=GWEN_StringList_new();
506  fbuf=GWEN_Buffer_new(0, 256, 0, 1);
507  file=GWB_File_List2Iterator_Data(it);
508  while(file) {
509  GWB_File_WriteFileNameToTopBuildDirString(file, initialSourceDir, fbuf);
511  GWEN_Buffer_Reset(fbuf);
512  file=GWB_File_List2Iterator_Next(it);
513  } /* while */
514  GWEN_Buffer_Reset(fbuf);
515  GWB_File_List2Iterator_free(it);
516 
517  if (GWEN_StringList_Count(sl)==0) {
519  return NULL;
520  }
521  return sl;
522  }
523 
524  return NULL;
525 }
526 
527 
528 
529 void GWB_File_toXml(const GWB_FILE *file, GWEN_XMLNODE *xmlNode)
530 {
531  GWEN_XMLNode_SetIntProperty(xmlNode, "id", (int) (file->id));
532  if (file->folder)
533  GWEN_XMLNode_SetCharValue(xmlNode, "folder", file->folder);
534  if (file->name)
535  GWEN_XMLNode_SetCharValue(xmlNode, "name", file->name);
536  if (file->installName)
537  GWEN_XMLNode_SetCharValue(xmlNode, "installName", file->installName);
538  if (file->fileType)
539  GWEN_XMLNode_SetCharValue(xmlNode, "type", file->fileType);
540  if (file->installPath)
541  GWEN_XMLNode_SetCharValue(xmlNode, "installPath", file->installPath);
542  if (file->builder)
543  GWEN_XMLNode_SetCharValue(xmlNode, "builder", file->builder);
544  _writeFileFlagsToXml(GWB_File_GetFlags(file), xmlNode, "flags");
545 }
546 
547 
548 
550 {
551  uint32_t id;
552  GWB_FILE *file;
553  const char *folder;
554  const char *name;
555  const char *s;
556 
557  id=(uint32_t) GWEN_XMLNode_GetIntProperty(xmlNode, "id", 0);
558 
559  folder=GWEN_XMLNode_GetCharValue(xmlNode, "folder", NULL);
560  name=GWEN_XMLNode_GetCharValue(xmlNode, "name", NULL);
561 
562  file=GWB_File_new(folder, name, id);
563  s=GWEN_XMLNode_GetCharValue(xmlNode, "flags", NULL);
564  if (s)
565  file->flags=_readFlagsFromChar(s);
566  GWB_File_SetFileType(file, GWEN_XMLNode_GetCharValue(xmlNode, "type", NULL));
567  GWB_File_SetInstallPath(file, GWEN_XMLNode_GetCharValue(xmlNode, "installPath", NULL));
568  GWB_File_SetBuilder(file, GWEN_XMLNode_GetCharValue(xmlNode, "builder", NULL));
569  GWB_File_SetInstallName(file, GWEN_XMLNode_GetCharValue(xmlNode, "installName", NULL));
570 
571  return file;
572 }
573 
574 
575 
576 void _writeFileFlagsToXml(uint32_t flags, GWEN_XMLNODE *xmlNode, const char *varName)
577 {
578  if (flags) {
579  GWEN_BUFFER *dbuf;
580 
581  dbuf=GWEN_Buffer_new(0, 256, 0, 1);
582 
583  if (flags & GWB_FILE_FLAGS_DIST) {
584  if (GWEN_Buffer_GetUsedBytes(dbuf))
585  GWEN_Buffer_AppendString(dbuf, " ");
586  GWEN_Buffer_AppendString(dbuf, "DIST");
587  }
588 
589  if (flags & GWB_FILE_FLAGS_INSTALL) {
590  if (GWEN_Buffer_GetUsedBytes(dbuf))
591  GWEN_Buffer_AppendString(dbuf, " ");
592  GWEN_Buffer_AppendString(dbuf, "INSTALL");
593  }
594 
595  if (flags & GWB_FILE_FLAGS_GENERATED) {
596  if (GWEN_Buffer_GetUsedBytes(dbuf))
597  GWEN_Buffer_AppendString(dbuf, " ");
598  GWEN_Buffer_AppendString(dbuf, "GENERATED");
599  }
600 
601  if (GWEN_Buffer_GetUsedBytes(dbuf))
602  GWEN_XMLNode_SetCharValue(xmlNode, varName, GWEN_Buffer_GetStart(dbuf));
603  GWEN_Buffer_free(dbuf);
604  }
605 }
606 
607 
608 
609 uint32_t _readFlagsFromChar(const char *flagsAsText)
610 {
611  GWEN_STRINGLIST *sl;
612  uint32_t flags=0;
613 
614  sl=GWEN_StringList_fromString(flagsAsText, " ", 1);
615  if (sl) {
617 
619  while(se) {
620  const char *s;
621 
623  if (s && *s) {
624  if (strcasecmp(s, "DIST")==0)
625  flags|=GWB_FILE_FLAGS_DIST;
626  else if (strcasecmp(s, "INSTALL")==0)
627  flags|=GWB_FILE_FLAGS_INSTALL;
628  else if (strcasecmp(s, "GENERATED")==0)
630  else {
631  DBG_ERROR(NULL, "Unexpected FILE flag \"%s\"", s);
632  }
633  }
635  }
637  }
638 
639  return flags;
640 }
641 
642 
643 
644 GWB_FILE *GWB_File_List2_GetAt(const GWB_FILE_LIST2 *fileList, int index)
645 {
646  GWB_FILE_LIST2_ITERATOR *it;
647  int i=0;
648 
649  it=GWB_File_List2_First(fileList);
650  if (it) {
651  GWB_FILE *file;
652 
653  file=GWB_File_List2Iterator_Data(it);
654  while(file) {
655  if (i==index) {
656  GWB_File_List2Iterator_free(it);
657  return file;
658  }
659  i++;
660  file=GWB_File_List2Iterator_Next(it);
661  }
662 
663  GWB_File_List2Iterator_free(it);
664  }
665 
666  return NULL;
667 }
668 
669 
670 
671 void GWB_File_List2_WriteXml(const GWB_FILE_LIST2 *fileList, GWEN_XMLNODE *xmlNode, const char *groupName)
672 {
673  GWB_FILE_LIST2_ITERATOR *it;
674 
675  it=GWB_File_List2_First(fileList);
676  if (it) {
677  GWB_FILE *file;
678 
679  file=GWB_File_List2Iterator_Data(it);
680  while(file) {
681  GWEN_XMLNODE *entryNode;
682 
683  entryNode=GWEN_XMLNode_new(GWEN_XMLNodeTypeTag, groupName);
684  GWB_File_toXml(file, entryNode);
685  GWEN_XMLNode_AddChild(xmlNode, entryNode);
686  file=GWB_File_List2Iterator_Next(it);
687  }
688  GWB_File_List2Iterator_free(it);
689  }
690 }
691 
692 
693 
694 void GWB_File_List2_ReadXml(GWEN_XMLNODE *xmlNode, const char *groupName, GWB_FILE_LIST2 *destFileList)
695 {
696  GWEN_XMLNODE *xmlEntry;
697 
698  xmlEntry=GWEN_XMLNode_FindFirstTag(xmlNode, groupName, NULL, NULL);
699  while(xmlEntry) {
700  GWB_FILE *file;
701 
702  file=GWB_File_fromXml(xmlEntry);
703  if (file)
704  GWB_File_List2_PushBack(destFileList, file);
705  xmlEntry=GWEN_XMLNode_FindNextTag(xmlEntry, groupName, NULL, NULL);
706  }
707 }
708 
709 
710 
711 
712 
void GWB_File_free(GWB_FILE *f)
Definition: file.c:70
const char * GWB_File_GetFileType(const GWB_FILE *f)
Definition: file.c:227
#define DBG_ERROR(dbg_logger, format,...)
Definition: debug.h:97
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:422
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:386
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:694
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:446
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:549
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:653
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:763
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
void GWB_File_List2_WriteXml(const GWB_FILE_LIST2 *fileList, GWEN_XMLNODE *xmlNode, const char *groupName)
Definition: file.c:671
void GWB_File_toXml(const GWB_FILE *file, GWEN_XMLNODE *xmlNode)
Definition: file.c:529
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:474
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:360
GWEN_STRINGLIST * GWB_File_FileListToTopBuildDirStringList(const GWB_FILE_LIST2 *fileList, const char *initialSourceDir)
Definition: file.c:495
GWEN_STRINGLIST * GWEN_StringList_new(void)
Definition: stringlist.c:50
static uint32_t _readFlagsFromChar(const char *flagsAsText)
Definition: file.c:609
static void _writeFileFlagsToXml(uint32_t flags, GWEN_XMLNODE *xmlNode, const char *varName)
Definition: file.c:576
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:992
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:644
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