gwenhywfar  5.7.2
Functions
parser.c File Reference
#include "gwenbuild/parser/parser.h"
#include "gwenbuild/parser/p_project.h"
#include <gwenhywfar/debug.h>
#include <gwenhywfar/syncio.h>
#include <gwenhywfar/process.h>
#include <gwenhywfar/directory.h>
#include <gwenhywfar/text.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
Include dependency graph for parser.c:

Go to the source code of this file.

Functions

static void _appendVarValue (GWEN_DB_NODE *db, const char *name, const char *newValue)
 
static int _getFilePermissions (const char *fname)
 
static int _parseIfNotVarHasValue (GWB_PROJECT *project, GWB_CONTEXT *currentContext, GWEN_XMLNODE *n, GWB_PARSER_PARSE_ELEMENT_FN fn)
 
static int _parseIfNotVarMatches (GWB_PROJECT *project, GWB_CONTEXT *currentContext, GWEN_XMLNODE *n, GWB_PARSER_PARSE_ELEMENT_FN fn)
 
static int _parseIfVarHasValue (GWB_PROJECT *project, GWB_CONTEXT *currentContext, GWEN_XMLNODE *n, GWB_PARSER_PARSE_ELEMENT_FN fn)
 
static int _parseIfVarMatches (GWB_PROJECT *project, GWB_CONTEXT *currentContext, GWEN_XMLNODE *n, GWB_PARSER_PARSE_ELEMENT_FN fn)
 
static int _parseSetVar (GWB_CONTEXT *currentContext, GWEN_XMLNODE *xmlNode)
 
static int _parseSubdir (GWB_PROJECT *project, GWB_CONTEXT *currentContext, const char *sFolder, GWB_PARSER_PARSE_ELEMENT_FN fn)
 
static int _parseWriteFile (GWB_PROJECT *project, GWB_CONTEXT *currentContext, GWEN_XMLNODE *xmlNode)
 
static int _readIntUntilPoint (const char **s)
 
static int _readVersion (const char *s)
 
static int _setFilePermissions (const char *fname, int perms)
 
static int _varHasValue (GWB_CONTEXT *currentContext, GWEN_XMLNODE *xmlNode)
 
GWB_CONTEXTGWB_Parser_CopyContextForSubdir (const GWB_CONTEXT *sourceContext, const char *folder)
 
GWB_CONTEXTGWB_Parser_CopyContextForTarget (const GWB_CONTEXT *sourceContext)
 
int GWB_Parser_ParseSourcesOrHeaders (GWB_PROJECT *project, GWB_CONTEXT *currentContext, GWEN_XMLNODE *xmlNode, int alwaysDist, int isSource)
 
int GWB_Parser_ParseSubdirs (GWB_PROJECT *project, GWB_CONTEXT *currentContext, GWEN_XMLNODE *xmlNode, GWB_PARSER_PARSE_ELEMENT_FN fn)
 
int GWB_Parser_ParseWellKnownElements (GWB_PROJECT *project, GWB_CONTEXT *currentContext, GWEN_XMLNODE *n, GWB_PARSER_PARSE_ELEMENT_FN fn)
 
GWEN_XMLNODEGWB_Parser_ReadBuildFile (GWENBUILD *gwbuild, const GWB_CONTEXT *currentContext, const char *fileName)
 
GWB_PROJECTGWB_Parser_ReadBuildTree (GWENBUILD *gwbuild, GWB_CONTEXT *currentContext, const char *srcDir, GWB_KEYVALUEPAIR_LIST *givenOptionList)
 
GWEN_BUFFERGWB_Parser_ReadNamedXmlDataIntoBufferAndExpand (GWEN_DB_NODE *db, GWEN_XMLNODE *xmlNode, const char *elem)
 
GWEN_BUFFERGWB_Parser_ReadXmlDataIntoBufferAndExpand (GWEN_DB_NODE *db, GWEN_XMLNODE *xmlNode)
 
GWEN_STRINGLISTGWB_Parser_ReadXmlDataIntoStringList (GWEN_DB_NODE *db, GWEN_XMLNODE *xmlNode)
 
int GWB_Parser_ReplaceVarsBetweenAtSigns (const char *s, GWEN_BUFFER *dbuf, GWEN_DB_NODE *db)
 
void GWB_Parser_SetItemValue (GWEN_DB_NODE *db, const char *sId, const char *suffix, const char *value)
 

Function Documentation

◆ _appendVarValue()

void _appendVarValue ( GWEN_DB_NODE db,
const char *  name,
const char *  newValue 
)
static

Definition at line 839 of file parser.c.

References GWEN_Buffer_AppendString(), GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_GetCharValue(), GWEN_DB_SetCharValue(), and NULL.

Referenced by _parseSetVar().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _getFilePermissions()

int _getFilePermissions ( const char *  fname)
static

Definition at line 813 of file parser.c.

References DBG_ERROR, GWEN_ERROR_IO, and NULL.

Referenced by _parseWriteFile().

Here is the caller graph for this function:

◆ _parseIfNotVarHasValue()

int _parseIfNotVarHasValue ( GWB_PROJECT project,
GWB_CONTEXT currentContext,
GWEN_XMLNODE n,
GWB_PARSER_PARSE_ELEMENT_FN  fn 
)
static

Definition at line 652 of file parser.c.

References _varHasValue(), GWEN_XMLNode_FindFirstTag(), and NULL.

Referenced by GWB_Parser_ParseWellKnownElements().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parseIfNotVarMatches()

int _parseIfNotVarMatches ( GWB_PROJECT project,
GWB_CONTEXT currentContext,
GWEN_XMLNODE n,
GWB_PARSER_PARSE_ELEMENT_FN  fn 
)
static

Definition at line 574 of file parser.c.

References DBG_ERROR, DBG_INFO, GWB_Context_GetVars(), GWEN_DB_GetCharValue(), GWEN_ERROR_GENERIC, GWEN_Text_ComparePattern(), GWEN_XMLNode_FindFirstTag(), GWEN_XMLNode_GetProperty(), and NULL.

Referenced by GWB_Parser_ParseWellKnownElements().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parseIfVarHasValue()

int _parseIfVarHasValue ( GWB_PROJECT project,
GWB_CONTEXT currentContext,
GWEN_XMLNODE n,
GWB_PARSER_PARSE_ELEMENT_FN  fn 
)
static

Definition at line 629 of file parser.c.

References _varHasValue(), GWEN_XMLNode_FindFirstTag(), and NULL.

Referenced by GWB_Parser_ParseWellKnownElements().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parseIfVarMatches()

int _parseIfVarMatches ( GWB_PROJECT project,
GWB_CONTEXT currentContext,
GWEN_XMLNODE n,
GWB_PARSER_PARSE_ELEMENT_FN  fn 
)
static

Definition at line 519 of file parser.c.

References DBG_ERROR, DBG_INFO, GWB_Context_GetVars(), GWEN_DB_GetCharValue(), GWEN_ERROR_GENERIC, GWEN_Text_ComparePattern(), GWEN_XMLNode_FindFirstTag(), GWEN_XMLNode_GetProperty(), and NULL.

Referenced by GWB_Parser_ParseWellKnownElements().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _parseSetVar()

int _parseSetVar ( GWB_CONTEXT currentContext,
GWEN_XMLNODE xmlNode 
)
static

◆ _parseSubdir()

int _parseSubdir ( GWB_PROJECT project,
GWB_CONTEXT currentContext,
const char *  sFolder,
GWB_PARSER_PARSE_ELEMENT_FN  fn 
)
static

◆ _parseWriteFile()

int _parseWriteFile ( GWB_PROJECT project,
GWB_CONTEXT currentContext,
GWEN_XMLNODE xmlNode 
)
static

◆ _readIntUntilPoint()

int _readIntUntilPoint ( const char **  s)
static

Definition at line 285 of file parser.c.

References DBG_ERROR, GWEN_ERROR_GENERIC, and NULL.

Referenced by _readVersion().

Here is the caller graph for this function:

◆ _readVersion()

int _readVersion ( const char *  s)
static

Definition at line 242 of file parser.c.

References _readIntUntilPoint(), DBG_ERROR, GWEN_ERROR_GENERIC, and NULL.

Referenced by GWB_Parser_ReadBuildFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _setFilePermissions()

int _setFilePermissions ( const char *  fname,
int  perms 
)
static

Definition at line 827 of file parser.c.

References DBG_ERROR, GWEN_ERROR_IO, and NULL.

Referenced by _parseWriteFile().

Here is the caller graph for this function:

◆ _varHasValue()

int _varHasValue ( GWB_CONTEXT currentContext,
GWEN_XMLNODE xmlNode 
)
static

Definition at line 675 of file parser.c.

References DBG_ERROR, GWB_Context_GetVars(), GWEN_DB_GetCharValue(), GWEN_ERROR_GENERIC, GWEN_Text_ComparePattern(), GWEN_XMLNode_GetProperty(), and NULL.

Referenced by _parseIfNotVarHasValue(), and _parseIfVarHasValue().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWB_Parser_CopyContextForSubdir()

GWB_CONTEXT* GWB_Parser_CopyContextForSubdir ( const GWB_CONTEXT sourceContext,
const char *  folder 
)

◆ GWB_Parser_CopyContextForTarget()

GWB_CONTEXT* GWB_Parser_CopyContextForTarget ( const GWB_CONTEXT sourceContext)

Definition at line 142 of file parser.c.

References GWB_Context_ClearDefineList(), GWB_Context_ClearIncludeList(), GWB_Context_ClearSourceFileList2(), and GWB_Context_dup().

Referenced by GWB_ParseTarget().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWB_Parser_ParseSourcesOrHeaders()

int GWB_Parser_ParseSourcesOrHeaders ( GWB_PROJECT project,
GWB_CONTEXT currentContext,
GWEN_XMLNODE xmlNode,
int  alwaysDist,
int  isSource 
)

◆ GWB_Parser_ParseSubdirs()

int GWB_Parser_ParseSubdirs ( GWB_PROJECT project,
GWB_CONTEXT currentContext,
GWEN_XMLNODE xmlNode,
GWB_PARSER_PARSE_ELEMENT_FN  fn 
)

◆ GWB_Parser_ParseWellKnownElements()

int GWB_Parser_ParseWellKnownElements ( GWB_PROJECT project,
GWB_CONTEXT currentContext,
GWEN_XMLNODE n,
GWB_PARSER_PARSE_ELEMENT_FN  fn 
)

Definition at line 940 of file parser.c.

References _parseIfNotVarHasValue(), _parseIfNotVarMatches(), _parseIfVarHasValue(), _parseIfVarMatches(), _parseSetVar(), _parseWriteFile(), DBG_DEBUG, DBG_ERROR, GWEN_LOGDOMAIN, GWEN_XMLNode_GetData(), and NULL.

Referenced by _parseChildNodes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWB_Parser_ReadBuildFile()

GWEN_XMLNODE* GWB_Parser_ReadBuildFile ( GWENBUILD gwbuild,
const GWB_CONTEXT currentContext,
const char *  fileName 
)

◆ GWB_Parser_ReadBuildTree()

GWB_PROJECT* GWB_Parser_ReadBuildTree ( GWENBUILD gwbuild,
GWB_CONTEXT currentContext,
const char *  srcDir,
GWB_KEYVALUEPAIR_LIST *  givenOptionList 
)

◆ GWB_Parser_ReadNamedXmlDataIntoBufferAndExpand()

GWEN_BUFFER* GWB_Parser_ReadNamedXmlDataIntoBufferAndExpand ( GWEN_DB_NODE db,
GWEN_XMLNODE xmlNode,
const char *  elem 
)

Definition at line 370 of file parser.c.

References GWB_Parser_ReadXmlDataIntoBufferAndExpand(), GWEN_Buffer_free(), GWEN_Buffer_GetUsedBytes(), GWEN_XMLNode_FindFirstTag(), and NULL.

Referenced by GWB_ParseOption().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWB_Parser_ReadXmlDataIntoBufferAndExpand()

GWEN_BUFFER* GWB_Parser_ReadXmlDataIntoBufferAndExpand ( GWEN_DB_NODE db,
GWEN_XMLNODE xmlNode 
)

◆ GWB_Parser_ReadXmlDataIntoStringList()

GWEN_STRINGLIST* GWB_Parser_ReadXmlDataIntoStringList ( GWEN_DB_NODE db,
GWEN_XMLNODE xmlNode 
)

◆ GWB_Parser_ReplaceVarsBetweenAtSigns()

int GWB_Parser_ReplaceVarsBetweenAtSigns ( const char *  s,
GWEN_BUFFER dbuf,
GWEN_DB_NODE db 
)

Definition at line 877 of file parser.c.

References DBG_ERROR, DBG_WARN, GWEN_Buffer_AppendByte(), GWEN_Buffer_AppendString(), GWEN_DB_Dump(), GWEN_DB_GetCharValue(), GWEN_ERROR_BAD_DATA, GWEN_LOGDOMAIN, and NULL.

Referenced by _parseWriteFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWB_Parser_SetItemValue()

void GWB_Parser_SetItemValue ( GWEN_DB_NODE db,
const char *  sId,
const char *  suffix,
const char *  value 
)

Definition at line 860 of file parser.c.

References GWEN_Buffer_AppendString(), GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_DB_FLAGS_OVERWRITE_VARS, and GWEN_DB_SetCharValue().

Referenced by _callPkgConfig(), _checkVersion(), _parseLib(), _parseProg(), _setVarFunctionExists(), and _setVarHeaderExists().

Here is the call graph for this function:
Here is the caller graph for this function: