15#include "gwenbuild/types/file_p.h"
17#include <gwenhywfar/debug.h>
18#include <gwenhywfar/memory.h>
19#include <gwenhywfar/buffer.h>
39 if (folder && *folder)
61 fileOut->buildCmd=oldFile->buildCmd;
73 GWB_BuildCmd_List2_free(f->waitingBuildCmdList2);
167 return f->installName;
175 free(f->installName);
177 f->installName=strdup(s);
187 return (
const char*) strrchr(f->name,
'.');
203 f->builder=s?strdup(s):
NULL;
210 return f->installPath;
218 free(f->installPath);
220 f->installPath=strdup(s);
239 f->fileType=strdup(s);
248 return f->waitingBuildCmdList2;
255 if (f->waitingBuildCmdList2==
NULL)
256 f->waitingBuildCmdList2=GWB_BuildCmd_List2_new();
257 GWB_BuildCmd_List2_PushBack(f->waitingBuildCmdList2, bcmd);
264 if (f->waitingBuildCmdList2)
265 GWB_BuildCmd_List2_Clear(f->waitingBuildCmdList2);
287 GWB_FILE_LIST2_ITERATOR *it;
289 it=GWB_File_List2_First(fileList2);
293 f=GWB_File_List2Iterator_Data(it);
296 f=GWB_File_List2Iterator_Next(it);
299 GWB_File_List2_free(fileList2);
342 if (strcasecmp(s1, s2)==0) {
343 DBG_ERROR(
NULL,
"Output file has the same name as input file (%s)!", s1);
355 GWB_FILE_LIST2_ITERATOR *it;
357 it=GWB_File_List2_First(fileList);
361 file=GWB_File_List2Iterator_Data(it);
363 const char *currentName;
366 if (currentName && *currentName && strcasecmp(currentName, fname)==0) {
367 const char *currentFolder;
370 if (currentFolder && *currentFolder && strcasecmp(currentFolder, folder)==0) {
371 GWB_File_List2Iterator_free(it);
375 file=GWB_File_List2Iterator_Next(it);
377 GWB_File_List2Iterator_free(it);
389 const char *realFolder;
390 const char *realFilename;
394 if (folder && *folder) {
413 GWB_File_List2_PushBack(fileList, file);
423 GWB_FILE_LIST2_ITERATOR *it;
425 it=GWB_File_List2_First(fileList);
429 file=GWB_File_List2Iterator_Data(it);
432 GWB_File_List2Iterator_free(it);
435 file=GWB_File_List2Iterator_Next(it);
437 GWB_File_List2Iterator_free(it);
447 GWB_FILE_LIST2_ITERATOR *it;
449 it=GWB_File_List2_First(sourceList);
453 file=GWB_File_List2Iterator_Data(it);
459 if (s && strcasecmp(s, ext)==0) {
460 GWB_File_List2_PushBack(destList, file);
464 GWB_File_List2_PushBack(destList, file);
465 file=GWB_File_List2Iterator_Next(it);
467 GWB_File_List2Iterator_free(it);
478 if (initialSourceDir && *initialSourceDir) {
496 GWB_FILE_LIST2_ITERATOR *it;
498 it=GWB_File_List2_First(fileList);
506 file=GWB_File_List2Iterator_Data(it);
511 file=GWB_File_List2Iterator_Next(it);
514 GWB_File_List2Iterator_free(it);
535 if (file->installName)
539 if (file->installPath)
623 if (strcasecmp(s,
"DIST")==0)
625 else if (strcasecmp(s,
"INSTALL")==0)
627 else if (strcasecmp(s,
"GENERATED")==0)
645 GWB_FILE_LIST2_ITERATOR *it;
648 it=GWB_File_List2_First(fileList);
652 file=GWB_File_List2Iterator_Data(it);
655 GWB_File_List2Iterator_free(it);
659 file=GWB_File_List2Iterator_Next(it);
662 GWB_File_List2Iterator_free(it);
672 GWB_FILE_LIST2_ITERATOR *it;
674 it=GWB_File_List2_First(fileList);
678 file=GWB_File_List2Iterator_Data(it);
685 file=GWB_File_List2Iterator_Next(it);
687 GWB_File_List2Iterator_free(it);
703 GWB_File_List2_PushBack(destFileList, file);
GWEN_BUFFER * GWEN_Buffer_new(char *buffer, uint32_t size, uint32_t used, int take)
void GWEN_Buffer_Reset(GWEN_BUFFER *bf)
int GWEN_Buffer_AppendBytes(GWEN_BUFFER *bf, const char *buffer, uint32_t size)
void GWEN_Buffer_free(GWEN_BUFFER *bf)
int GWEN_Buffer_AppendString(GWEN_BUFFER *bf, const char *buffer)
uint32_t GWEN_Buffer_GetUsedBytes(const GWEN_BUFFER *bf)
char * GWEN_Buffer_GetStart(const GWEN_BUFFER *bf)
struct GWB_BUILD_CMD GWB_BUILD_CMD
#define DBG_ERROR(dbg_logger, format, args...)
GWB_FILE * GWB_File_new(const char *folder, const char *fName, uint32_t id)
GWB_FILE * GWB_File_List2_GetAt(const GWB_FILE_LIST2 *fileList, int index)
void GWB_File_DelFlags(GWB_FILE *f, uint32_t i)
void GWB_File_SetId(GWB_FILE *f, uint32_t i)
void GWB_File_free(GWB_FILE *f)
void GWB_File_SetInstallPath(GWB_FILE *f, const char *s)
void GWB_File_List2_WriteXml(const GWB_FILE_LIST2 *fileList, GWEN_XMLNODE *xmlNode, const char *groupName)
void GWB_File_AddFileList2ToFileList2(GWB_FILE_LIST2 *sourceList, GWB_FILE_LIST2 *destList, const char *ext)
void GWB_File_SetName(GWB_FILE *f, const char *s)
GWB_FILE * GWB_File_fromXml(GWEN_XMLNODE *xmlNode)
void GWB_File_ClearWaitingBuildCmds(GWB_FILE *f)
void GWB_File_List2_FreeAll(GWB_FILE_LIST2 *fileList2)
const char * GWB_File_GetFolder(const GWB_FILE *f)
void GWB_File_List2_ReadXml(GWEN_XMLNODE *xmlNode, const char *groupName, GWB_FILE_LIST2 *destFileList)
static void _writeFileFlagsToXml(uint32_t flags, GWEN_XMLNODE *xmlNode, const char *varName)
const char * GWB_File_GetName(const GWB_FILE *f)
void GWB_File_SetBuildCmd(GWB_FILE *f, GWB_BUILD_CMD *bcmd)
GWB_FILE * GWB_File_List2_GetFileById(const GWB_FILE_LIST2 *fileList, uint32_t id)
GWB_FILE * GWB_File_CopyObjectAndChangeExtension(const GWB_FILE *file, const char *newExt)
void GWB_File_SetInstallName(GWB_FILE *f, const char *s)
void GWB_File_SetBuilder(GWB_FILE *f, const char *s)
void GWB_File_SetFileType(GWB_FILE *f, const char *s)
GWB_FILE * GWB_File_List2_GetOrCreateFile(GWB_FILE_LIST2 *fileList, const char *folder, const char *fname)
void GWB_File_WriteFileNameToTopBuildDirString(const GWB_FILE *file, const char *initialSourceDir, GWEN_BUFFER *fbuf)
uint32_t GWB_File_GetFlags(const GWB_FILE *f)
const char * GWB_File_GetInstallPath(const GWB_FILE *f)
void GWB_File_AddWaitingBuildCmd(GWB_FILE *f, GWB_BUILD_CMD *bcmd)
GWEN_STRINGLIST * GWB_File_FileListToTopBuildDirStringList(const GWB_FILE_LIST2 *fileList, const char *initialSourceDir)
GWB_FILE * GWB_File_dup(const GWB_FILE *oldFile)
const char * GWB_File_GetInstallName(const GWB_FILE *f)
GWB_BUILD_CMD_LIST2 * GWB_File_GetWaitingBuildCmdList2(const GWB_FILE *f)
GWB_FILE * GWB_File_List2_GetFileByPathAndName(const GWB_FILE_LIST2 *fileList, const char *folder, const char *fname)
uint32_t GWB_File_GetId(const GWB_FILE *f)
const char * GWB_File_GetBuilder(const GWB_FILE *f)
void GWB_File_SetFlags(GWB_FILE *f, uint32_t i)
static uint32_t _readFlagsFromChar(const char *flagsAsText)
GWB_BUILD_CMD * GWB_File_GetBuildCmd(const GWB_FILE *f)
void GWB_File_SetFolder(GWB_FILE *f, const char *s)
const char * GWB_File_GetFileType(const GWB_FILE *f)
void GWB_File_ReplaceExtension(GWB_FILE *file, const char *newExt)
void GWB_File_AddFlags(GWB_FILE *f, uint32_t i)
void GWB_File_toXml(const GWB_FILE *file, GWEN_XMLNODE *xmlNode)
const char * GWB_File_GetExt(const GWB_FILE *f)
#define GWB_FILE_FLAGS_GENERATED
#define GWB_FILE_FLAGS_DIST
#define GWB_FILE_FLAGS_INSTALL
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
#define GWEN_DIR_SEPARATOR_S
#define GWEN_DIR_SEPARATOR
#define GWEN_LIST2_FUNCTIONS(t, pr)
#define GWEN_FREE_OBJECT(varname)
#define GWEN_NEW_OBJECT(typ, varname)
void GWEN_StringList_free(GWEN_STRINGLIST *sl)
const char * GWEN_StringListEntry_Data(const GWEN_STRINGLISTENTRY *se)
GWEN_STRINGLISTENTRY * GWEN_StringListEntry_Next(const GWEN_STRINGLISTENTRY *se)
unsigned int GWEN_StringList_Count(const GWEN_STRINGLIST *sl)
int GWEN_StringList_AppendString(GWEN_STRINGLIST *sl, const char *s, int take, int checkDouble)
GWEN_STRINGLIST * GWEN_StringList_fromString(const char *str, const char *delimiters, int checkDouble)
GWEN_STRINGLISTENTRY * GWEN_StringList_FirstEntry(const GWEN_STRINGLIST *sl)
GWEN_STRINGLIST * GWEN_StringList_new(void)
struct GWEN_STRINGLISTENTRYSTRUCT GWEN_STRINGLISTENTRY
struct GWEN_STRINGLISTSTRUCT GWEN_STRINGLIST
GWEN_XMLNODE * GWEN_XMLNode_FindFirstTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
void GWEN_XMLNode_SetIntProperty(GWEN_XMLNODE *n, const char *name, int value)
GWEN_XMLNODE * GWEN_XMLNode_new(GWEN_XMLNODE_TYPE t, const char *data)
GWEN_XMLNODE * GWEN_XMLNode_FindNextTag(const GWEN_XMLNODE *n, const char *tname, const char *pname, const char *pvalue)
const char * GWEN_XMLNode_GetCharValue(const GWEN_XMLNODE *n, const char *name, const char *defValue)
void GWEN_XMLNode_AddChild(GWEN_XMLNODE *n, GWEN_XMLNODE *child)
void GWEN_XMLNode_SetCharValue(GWEN_XMLNODE *n, const char *name, const char *value)
int GWEN_XMLNode_GetIntProperty(const GWEN_XMLNODE *n, const char *name, int defaultValue)
struct GWEN__XMLNODE GWEN_XMLNODE