12 INP boolean Required) {
22 "[LINE %d] Element '%s' not found within element '%s'.\n",
23 Parent->line, Name, Parent->name);
29 if (Cur != NULL && Cur->
next) {
31 TIO_MESSAGE_ERROR,
"[LINE %d] Element '%s' found twice within element '%s'.\n",
32 Parent->line, Name, Parent->name);
39 INP boolean Required) {
49 "[LINE %d] Element '%s' not found within element '%s'.\n",
50 Parent->line, Name, Parent->name);
60 assert(Node != NULL && Name != NULL);
61 if (0 != strcmp(Node->name, Name)) {
63 "[LINE %d] Element '%s' within element '%s' does match expected "
64 "element type of '%s'\n", Node->line, Node->name, Node->parent->name,
79 vpr_printf(TIO_MESSAGE_ERROR,
"[LINE %d] Node '%s' has invalid property %s=\"%s\".\n",
80 Node->line, Node->name, Node->attr[0], Node->attr[1]);
89 "[LINE %d] Node '%s' has unexpected text '%s' within it.\n",
90 Node->line, Node->name, Node->txt);
99 vpr_printf(TIO_MESSAGE_ERROR,
"[LINE %d] Node '%s' has invalid child node '%s'.\n",
100 Node->line, Node->name, Cur->
name);
129 "[Line %d] Required property '%s' not found for element '%s'.\n",
130 Parent->line, Name, Parent->name);
178 Len = (
sizeof(char) * Len) +
179 (
sizeof(char) * Count);
183 Tokens = (
char **)
my_malloc(
sizeof(
char *) * (Count + 1));
184 Dst = (
char *)
my_malloc(
sizeof(
char) * Len);
215 Tokens[Count] = NULL;
237 Len = (
sizeof(char) * Len) +
238 (
sizeof(char) * Count);
242 Tokens = (
char **)
my_malloc(
sizeof(
char *) * (Count + 1));
243 Dst = (
char *)
my_malloc(
sizeof(
char) * Len);
273 Tokens[Count] = NULL;
282 INP boolean Required,
INP int default_value) {
286 property_value = default_value;
289 property_value =
my_atoi(Prop);
292 return property_value;
298 INP boolean Required,
INP float default_value) {
301 float property_value;
303 property_value = default_value;
306 property_value = (float)atof(Prop);
309 return property_value;
315 INP boolean Required,
INP boolean default_value) {
318 boolean property_value;
320 property_value = default_value;
323 if ((strcmp(Prop,
"false") == 0) || (strcmp(Prop,
"FALSE") == 0)
324 || (strcmp(Prop,
"False") == 0)) {
325 property_value =
FALSE;
326 }
else if ((strcmp(Prop,
"true") == 0) || (strcmp(Prop,
"TRUE") == 0)
327 || (strcmp(Prop,
"True") == 0)) {
328 property_value =
TRUE;
331 TIO_MESSAGE_ERROR,
"[LINE %d] Unknown value %s for boolean attribute %s in %s",
332 Parent->line, Prop, Name, Parent->name);
337 return property_value;
357 if (strcmp(Cur->
name, Name) == 0) {
369 if (Count < min_count) {
370 vpr_printf(TIO_MESSAGE_ERROR,
"[Line %d] Expected node '%s' to have %d "
371 "child elements, but none found.\n", Node->line, Node->name, min_count);
char ** LookaheadNodeTokens(INP ezxml_t Node)
void CountTokensInString(INP const char *Str, OUTP int *Num, OUTP int *Len)
const char * FindProperty(INP ezxml_t Parent, INP const char *Name, INP boolean Required)
int GetIntProperty(INP ezxml_t Parent, INP char *Name, INP boolean Required, INP int default_value)
void CheckElement(INP ezxml_t Node, INP const char *Name)
void FreeNode(INOUTP ezxml_t Node)
boolean IsWhitespace(char c)
ezxml_t ezxml_set_attr(ezxml_t xml, char *name, char *value)
ezxml_t ezxml_child(ezxml_t xml, const char *name)
static void * my_malloc(int ibytes)
ezxml_t FindFirstElement(INP ezxml_t Parent, INP const char *Name, INP boolean Required)
#define ezxml_remove(xml)
const char * ezxml_attr(ezxml_t xml, const char *attr)
char ** GetNodeTokens(INP ezxml_t Node)
ezxml_t ezxml_set_txt(ezxml_t xml, char *txt)
boolean GetBooleanProperty(INP ezxml_t Parent, INP char *Name, INP boolean Required, INP boolean default_value)
float GetFloatProperty(INP ezxml_t Parent, INP char *Name, INP boolean Required, INP float default_value)
int CountChildren(INP ezxml_t Node, INP const char *Name, INP int min_count)
ezxml_t FindElement(INP ezxml_t Parent, INP const char *Name, INP boolean Required)
int my_atoi(const char *str)