A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use homogeneous dictionaries whenever possible.
[simgrid.git]
/
src
/
gras
/
DataDesc
/
ddt_parse.c
diff --git
a/src/gras/DataDesc/ddt_parse.c
b/src/gras/DataDesc/ddt_parse.c
index
4ffcf1a
..
77f5d66
100644
(file)
--- a/
src/gras/DataDesc/ddt_parse.c
+++ b/
src/gras/DataDesc/ddt_parse.c
@@
-240,7
+240,7
@@
static void parse_statement(char *definition,
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_RA) {
XBT_OUT();
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_RA) {
XBT_OUT();
- THROW
0
(mismatch_error, 0, "End of the englobing structure or union");
+ THROW
F
(mismatch_error, 0, "End of the englobing structure or union");
}
if (XBT_LOG_ISENABLED(gras_ddt_parse, xbt_log_priority_debug)) {
}
if (XBT_LOG_ISENABLED(gras_ddt_parse, xbt_log_priority_debug)) {
@@
-255,7
+255,7
@@
static void parse_statement(char *definition,
}
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
}
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable symbol: found a typeless statement (got '%s' instead)",
gras_ddt_parse_text);
("Unparsable symbol: found a typeless statement (got '%s' instead)",
gras_ddt_parse_text);
@@
-265,7
+265,7
@@
static void parse_statement(char *definition,
/* FIXME: This does not detect recursive definitions at all? */
if (identifier.tm.is_union || identifier.tm.is_enum
|| identifier.tm.is_struct)
/* FIXME: This does not detect recursive definitions at all? */
if (identifier.tm.is_union || identifier.tm.is_enum
|| identifier.tm.is_struct)
- PARSE_ERROR
0
+ PARSE_ERROR
("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle recursive type definition yet");
/**** get the base type, giving "short a" the needed love ****/
("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle recursive type definition yet");
/**** get the base type, giving "short a" the needed love ****/
@@
-289,11
+289,11
@@
static void parse_statement(char *definition,
/**** build the base type for latter use ****/
if (identifier.tm.is_union) {
/**** build the base type for latter use ****/
if (identifier.tm.is_union) {
- PARSE_ERROR
0
+ PARSE_ERROR
("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle union yet (get callback from annotation?)");
} else if (identifier.tm.is_enum) {
("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle union yet (get callback from annotation?)");
} else if (identifier.tm.is_enum) {
- PARSE_ERROR
0
+ PARSE_ERROR
("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle enum yet");
} else if (identifier.tm.is_struct) {
("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle enum yet");
} else if (identifier.tm.is_struct) {
@@
-325,7
+325,7
@@
static void parse_statement(char *definition,
} else if (!strcmp(identifier.type_name, "double")) {
if (identifier.tm.is_long)
} else if (!strcmp(identifier.type_name, "double")) {
if (identifier.tm.is_long)
- PARSE_ERROR
0
("long double not portable and thus not handled");
+ PARSE_ERROR("long double not portable and thus not handled");
identifier.type = gras_datadesc_by_name("double");
identifier.type = gras_datadesc_by_name("double");
@@
-353,7
+353,7
@@
static void parse_statement(char *definition,
} else {
identifier.type = gras_datadesc_by_name(identifier.type_name);
if (!identifier.type)
} else {
identifier.type = gras_datadesc_by_name(identifier.type_name);
if (!identifier.type)
- PARSE_ERROR
1
("Unknown base type '%s'", identifier.type_name);
+ PARSE_ERROR("Unknown base type '%s'", identifier.type_name);
}
}
}
}
}
}
@@
-379,7
+379,7
@@
static void parse_statement(char *definition,
/* Handle fixed size arrays */
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_RB) {
/* Handle fixed size arrays */
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_RB) {
- PARSE_ERROR
0
+ PARSE_ERROR
("Unimplemented feature: GRAS_DEFINE_TYPE cannot deal with [] constructs (yet)");
} else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
("Unimplemented feature: GRAS_DEFINE_TYPE cannot deal with [] constructs (yet)");
} else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_WORD) {
@@
-393,7
+393,7
@@
static void parse_statement(char *definition,
if (storage) {
size = *storage;
} else {
if (storage) {
size = *storage;
} else {
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable size of array. Found '%s', expected number or known constant. Need to use gras_datadesc_set_const(), huh?",
gras_ddt_parse_text);
}
("Unparsable size of array. Found '%s', expected number or known constant. Need to use gras_datadesc_set_const(), huh?",
gras_ddt_parse_text);
}
@@
-405,11
+405,11
@@
static void parse_statement(char *definition,
/* eat the closing bracket */
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RB)
/* eat the closing bracket */
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RB)
- PARSE_ERROR
0
("Unparsable size of array");
+ PARSE_ERROR("Unparsable size of array");
XBT_DEBUG("Fixed size array, size=%ld", size);
continue;
} else {
XBT_DEBUG("Fixed size array, size=%ld", size);
continue;
} else {
- PARSE_ERROR
0
("Unparsable size of array");
+ PARSE_ERROR("Unparsable size of array");
}
/* End of fixed size arrays handling */
}
/* End of fixed size arrays handling */
@@
-420,13
+420,13
@@
static void parse_statement(char *definition,
char *keyval = NULL;
memset(&array, 0, sizeof(array));
if (strcmp(gras_ddt_parse_text, "GRAS_ANNOTE"))
char *keyval = NULL;
memset(&array, 0, sizeof(array));
if (strcmp(gras_ddt_parse_text, "GRAS_ANNOTE"))
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable symbol: Expected 'GRAS_ANNOTE', got '%s'",
gras_ddt_parse_text);
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_LP)
("Unparsable symbol: Expected 'GRAS_ANNOTE', got '%s'",
gras_ddt_parse_text);
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_LP)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable annotation: Expected parenthesis, got '%s'",
gras_ddt_parse_text);
("Unparsable annotation: Expected parenthesis, got '%s'",
gras_ddt_parse_text);
@@
-435,7
+435,7
@@
static void parse_statement(char *definition,
GRAS_DDT_PARSE_TOKEN_EMPTY);
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
GRAS_DDT_PARSE_TOKEN_EMPTY);
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable annotation: Expected key name, got '%s'",
gras_ddt_parse_text);
keyname = (char *) strdup(gras_ddt_parse_text);
("Unparsable annotation: Expected key name, got '%s'",
gras_ddt_parse_text);
keyname = (char *) strdup(gras_ddt_parse_text);
@@
-445,7
+445,7
@@
static void parse_statement(char *definition,
GRAS_DDT_PARSE_TOKEN_EMPTY);
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_COLON)
GRAS_DDT_PARSE_TOKEN_EMPTY);
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_COLON)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable annotation: expected ',' after the key name, got '%s'",
gras_ddt_parse_text);
("Unparsable annotation: expected ',' after the key name, got '%s'",
gras_ddt_parse_text);
@@
-456,7
+456,7
@@
static void parse_statement(char *definition,
/* get the value */
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
/* get the value */
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable annotation: Expected key value, got '%s'",
gras_ddt_parse_text);
keyval = (char *) strdup(gras_ddt_parse_text);
("Unparsable annotation: Expected key value, got '%s'",
gras_ddt_parse_text);
keyval = (char *) strdup(gras_ddt_parse_text);
@@
-470,7
+470,7
@@
static void parse_statement(char *definition,
XBT_DEBUG("Anotation: %s=%s", keyname, keyval);
if (!strcmp(keyname, "size")) {
if (!identifier.tm.is_ref)
XBT_DEBUG("Anotation: %s=%s", keyname, keyval);
if (!strcmp(keyname, "size")) {
if (!identifier.tm.is_ref)
- PARSE_ERROR
0
+ PARSE_ERROR
("Size annotation for a field not being a reference");
identifier.tm.is_ref--;
("Size annotation for a field not being a reference");
identifier.tm.is_ref--;
@@
-502,7
+502,7
@@
static void parse_statement(char *definition,
change_to_dynar_of(identifiers, subtype);
identifier.tm.is_dynar = -1;
} else {
change_to_dynar_of(identifiers, subtype);
identifier.tm.is_dynar = -1;
} else {
- PARSE_ERROR
1
+ PARSE_ERROR
("subtype annotation only accepted for dynars and matrices, but passed to '%s'",
identifier.type_name);
}
("subtype annotation only accepted for dynars and matrices, but passed to '%s'",
identifier.type_name);
}
@@
-510,7
+510,7
@@
static void parse_statement(char *definition,
} else if (!strcmp(keyname, "free_f")) {
int *storage = xbt_dict_get_or_null(gras_dd_constants, keyval);
if (!storage)
} else if (!strcmp(keyname, "free_f")) {
int *storage = xbt_dict_get_or_null(gras_dd_constants, keyval);
if (!storage)
- PARSE_ERROR
1
+ PARSE_ERROR
("value for free_f annotation of field %s is not a known constant",
identifier.name);
if (identifier.tm.is_matrix == -1) {
("value for free_f annotation of field %s is not a known constant",
identifier.name);
if (identifier.tm.is_matrix == -1) {
@@
-520,14
+520,14
@@
static void parse_statement(char *definition,
add_free_f(identifiers, *(void_f_pvoid_t *) storage);
identifier.tm.is_dynar = 0;
} else {
add_free_f(identifiers, *(void_f_pvoid_t *) storage);
identifier.tm.is_dynar = 0;
} else {
- PARSE_ERROR
1
+ PARSE_ERROR
("free_f annotation only accepted for dynars and matrices which subtype is already declared (field %s)",
identifier.name);
}
free(keyval);
} else {
free(keyval);
("free_f annotation only accepted for dynars and matrices which subtype is already declared (field %s)",
identifier.name);
}
free(keyval);
} else {
free(keyval);
- PARSE_ERROR
1
("Unknown annotation type: '%s'", keyname);
+ PARSE_ERROR("Unknown annotation type: '%s'", keyname);
}
free(keyname);
}
free(keyname);
@@
-537,7
+537,7
@@
static void parse_statement(char *definition,
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
gras_ddt_parse_tok_num = gras_ddt_parse_lex_n_dump();
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable annotation: Expected field name after '*', got '%s'",
gras_ddt_parse_text);
("Unparsable annotation: Expected field name after '*', got '%s'",
gras_ddt_parse_text);
@@
-553,7
+553,7
@@
static void parse_statement(char *definition,
}
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RP)
}
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RP)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable annotation: Expected parenthesis, got '%s'",
gras_ddt_parse_text);
("Unparsable annotation: Expected parenthesis, got '%s'",
gras_ddt_parse_text);
@@
-561,12
+561,12
@@
static void parse_statement(char *definition,
/* End of annotation handling */
} else {
/* End of annotation handling */
} else {
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable symbol: Got '%s' instead of expected comma (',')",
gras_ddt_parse_text);
}
} else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_COLON) {
("Unparsable symbol: Got '%s' instead of expected comma (',')",
gras_ddt_parse_text);
}
} else if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_COLON) {
- PARSE_ERROR
0
("Unparsable symbol: Unexpected comma (',')");
+ PARSE_ERROR("Unparsable symbol: Unexpected comma (',')");
}
if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
}
if (gras_ddt_parse_tok_num == GRAS_DDT_PARSE_TOKEN_STAR) {
@@
-586,14
+586,14
@@
static void parse_statement(char *definition,
continue;
}
continue;
}
- PARSE_ERROR
0
+ PARSE_ERROR
("Unparasable symbol (maybe a def struct in a def struct or a parser bug ;)");
}
if (identifier.tm.is_matrix > 0)
("Unparasable symbol (maybe a def struct in a def struct or a parser bug ;)");
}
if (identifier.tm.is_matrix > 0)
- PARSE_ERROR
0
("xbt_matrix_t field without 'subtype' annotation");
+ PARSE_ERROR("xbt_matrix_t field without 'subtype' annotation");
if (identifier.tm.is_dynar > 0)
if (identifier.tm.is_dynar > 0)
- PARSE_ERROR
0
("xbt_dynar_t field without 'subtype' annotation");
+ PARSE_ERROR("xbt_dynar_t field without 'subtype' annotation");
XBT_OUT();
}
XBT_OUT();
}
@@
-614,7
+614,7
@@
static gras_datadesc_type_t parse_struct(char *definition)
xbt_dynar_t fields_to_push;
char *name;
xbt_dynar_t fields_to_push;
char *name;
- gras_datadesc_type_t struct_type;
+
volatile
gras_datadesc_type_t struct_type;
XBT_IN("");
identifiers = xbt_dynar_new(sizeof(s_identifier_t), NULL);
XBT_IN("");
identifiers = xbt_dynar_new(sizeof(s_identifier_t), NULL);
@@
-632,7
+632,7
@@
static gras_datadesc_type_t parse_struct(char *definition)
}
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_LA)
}
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_LA)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparasable symbol: Expecting struct definition, but got %s instead of '{'",
gras_ddt_parse_text);
("Unparasable symbol: Expecting struct definition, but got %s instead of '{'",
gras_ddt_parse_text);
@@
-654,7
+654,7
@@
static gras_datadesc_type_t parse_struct(char *definition)
/* append the identifiers we've found */
xbt_dynar_foreach(identifiers, iter, field) {
if (field.tm.is_ref)
/* append the identifiers we've found */
xbt_dynar_foreach(identifiers, iter, field) {
if (field.tm.is_ref)
- PARSE_ERROR
2
+ PARSE_ERROR
("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
field.name, field.tm.is_ref);
("Not enough GRAS_ANNOTATE to deal with all dereferencing levels of %s (%d '*' left)",
field.name, field.tm.is_ref);
@@
-687,7
+687,7
@@
static gras_datadesc_type_t parse_struct(char *definition)
/* terminates */
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RA)
/* terminates */
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_RA)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparasable symbol: Expected '}' at the end of struct definition, got '%s'",
gras_ddt_parse_text);
("Unparasable symbol: Expected '}' at the end of struct definition, got '%s'",
gras_ddt_parse_text);
@@
-704,7
+704,6
@@
static gras_datadesc_type_t parse_typedef(char *definition)
s_type_modifier_t tm;
s_type_modifier_t tm;
- gras_datadesc_type_t struct_desc = NULL;
gras_datadesc_type_t typedef_desc = NULL;
XBT_IN("");
gras_datadesc_type_t typedef_desc = NULL;
XBT_IN("");
@@
-714,23
+713,23
@@
static gras_datadesc_type_t parse_typedef(char *definition)
parse_type_modifier(&tm);
if (tm.is_struct) {
parse_type_modifier(&tm);
if (tm.is_struct) {
-
struct_desc =
parse_struct(definition);
+ parse_struct(definition);
}
parse_type_modifier(&tm);
if (tm.is_ref)
}
parse_type_modifier(&tm);
if (tm.is_ref)
- PARSE_ERROR
0
+ PARSE_ERROR
("GRAS_DEFINE_TYPE cannot handle reference without annotation");
/* get the aliasing name */
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
("GRAS_DEFINE_TYPE cannot handle reference without annotation");
/* get the aliasing name */
if (gras_ddt_parse_tok_num != GRAS_DDT_PARSE_TOKEN_WORD)
- PARSE_ERROR
1
+ PARSE_ERROR
("Unparsable typedef: Expected the alias name, and got '%s'",
gras_ddt_parse_text);
/* (FIXME: should) build the alias */
("Unparsable typedef: Expected the alias name, and got '%s'",
gras_ddt_parse_text);
/* (FIXME: should) build the alias */
- PARSE_ERROR
0
+ PARSE_ERROR
("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle typedef yet");
XBT_OUT();
("Unimplemented feature: GRAS_DEFINE_TYPE cannot handle typedef yet");
XBT_OUT();
@@
-812,5
+811,5
@@
void gras_datadesc_set_const(const char *name, int value)
int *stored = xbt_new(int, 1);
*stored = value;
int *stored = xbt_new(int, 1);
*stored = value;
- xbt_dict_set(gras_dd_constants, name, stored,
xbt_free_f
);
+ xbt_dict_set(gras_dd_constants, name, stored,
NULL
);
}
}