Commit 6d3f2a0a authored by Jonathan Jenkins's avatar Jonathan Jenkins

Annotation parsing support in LPGROUPS

parent 94958c20
......@@ -18,6 +18,7 @@
typedef struct config_lptype_s
{
char name[CONFIGURATION_MAX_NAME];
char anno[CONFIGURATION_MAX_NAME];
uint64_t count;
} config_lptype_t;
......
......@@ -42,7 +42,7 @@
%option bison-bridge nodefault
DIGIT [0-9]
ID [a-zA-Z][a-zA-Z0-9_\-]*
ID [a-zA-Z][a-zA-Z0-9_\-]*(@[a-zA-Z0-9_\-]+)?
SECTION_OPEN "{"
SECTION_CLOSE "}"
......
......@@ -268,10 +268,21 @@ int configuration_get_lpgroups (ConfigHandle *handle,
}
else
{
size_t s = sizeof(lpgroups->lpgroups[i].lptypes[lpt].name);
char *nm = lpgroups->lpgroups[i].lptypes[lpt].name;
char *anno = lpgroups->lpgroups[i].lptypes[lpt].anno;
// assume these are lptypes and counts
strncpy(lpgroups->lpgroups[i].lptypes[lpt].name,
subse[j].name,
sizeof(lpgroups->lpgroups[i].lptypes[lpt].name));
strncpy(nm, subse[j].name, s-1);
lpgroups->lpgroups[i].lptypes[lpt].name[s-1] = '\0';
char *c = strchr(nm, '@');
if (c) {
strcpy(anno, c+1);
*c = '\0';
}
else {
anno[0] = '\0';
}
lpgroups->lpgroups[i].lptypes[lpt].count = atoi(data);
lpgroups->lpgroups[i].lptypes_count++;
lpt++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment