VPR-7.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
read_settings.c File Reference
#include <string.h>
#include <assert.h>
#include "read_xml_util.h"
#include "read_settings.h"
+ Include dependency graph for read_settings.c:

Go to the source code of this file.

Functions

static int process_settings (ezxml_t Cur, char **outv)
 
int read_settings_file (char *file_name, char ***outv)
 

Function Documentation

static int process_settings ( ezxml_t  Cur,
char **  outv 
)
static

Definition at line 6 of file read_settings.c.

7 {
8  int count = 0;
9 
10  if (!Cur)
11  return(0);
12 
13  while (Cur->attr[count])
14  {
15  if (outv)
16  {
17  if (! (count % 2))
18  {
19  outv[count] = (char *)my_malloc(strlen(Cur->attr[count]) + 3);
20  strcpy(&outv[count][2], Cur->attr[count]);
21  outv[count][0] = outv[count][1] = '-';
22  }
23  else
24  outv[count] = Cur->attr[count];
25  }
26  count++;
27  }
28 
29  Cur = Cur->child;
30 
31  while (Cur)
32  {
33  if (outv)
34  {
35  outv[count] = (char *)my_malloc(strlen(Cur->name) + 3);
36  strcpy(&outv[count][2], Cur->name);
37  outv[count][0] = outv[count][1] = '-';
38  }
39  count++;
40 
41  if (strlen(Cur->txt))
42  {
43  if (outv) outv[count] = Cur->txt;
44  count++;
45  }
46 
47  Cur = Cur->ordered;
48  }
49 
50  return count;
51 }
char * txt
Definition: ezxml.h:47
static void * my_malloc(int ibytes)
Definition: graphics.c:499
ezxml_t ordered
Definition: ezxml.h:51
char * name
Definition: ezxml.h:45
char ** attr
Definition: ezxml.h:46
ezxml_t child
Definition: ezxml.h:52

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int read_settings_file ( char *  file_name,
char ***  outv 
)

Definition at line 53 of file read_settings.c.

54 {
55  ezxml_t Cur;
56  int count;
57 
58  Cur = ezxml_parse_file(file_name);
59  assert(*outv == NULL);
60  assert(! strcmp("settings",Cur->name));
61  Cur = FindElement(Cur, "arguments", FALSE);
62 
63  count = process_settings(Cur, *outv);
64 
65  /* prepend the settings file name */
66  count++;
67 
68  *outv = (char **)my_malloc(count * sizeof(char *));
69 
70  (*outv)[0] = my_strdup(file_name);
71 
72  if (count)
73  {
74  process_settings(Cur, &((*outv)[1]));
75  }
76 
77  return(count);
78 }
Definition: ezxml.h:44
Definition: util.h:12
static void * my_malloc(int ibytes)
Definition: graphics.c:499
ezxml_t FindElement(INP ezxml_t Parent, INP const char *Name, INP boolean Required)
Definition: read_xml_util.c:11
static int process_settings(ezxml_t Cur, char **outv)
Definition: read_settings.c:6
char * name
Definition: ezxml.h:45
ezxml_t ezxml_parse_file(const char *file)
Definition: ezxml.c:846
char * my_strdup(const char *str)
Definition: util.c:101

+ Here is the call graph for this function:

+ Here is the caller graph for this function: