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

Annotation parsing support in LPGROUPS

parent 94958c20
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
typedef struct config_lptype_s typedef struct config_lptype_s
{ {
char name[CONFIGURATION_MAX_NAME]; char name[CONFIGURATION_MAX_NAME];
char anno[CONFIGURATION_MAX_NAME];
uint64_t count; uint64_t count;
} config_lptype_t; } config_lptype_t;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
%option bison-bridge nodefault %option bison-bridge nodefault
DIGIT [0-9] 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_OPEN "{"
SECTION_CLOSE "}" SECTION_CLOSE "}"
......
...@@ -268,10 +268,21 @@ int configuration_get_lpgroups (ConfigHandle *handle, ...@@ -268,10 +268,21 @@ int configuration_get_lpgroups (ConfigHandle *handle,
} }
else 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 // assume these are lptypes and counts
strncpy(lpgroups->lpgroups[i].lptypes[lpt].name, strncpy(nm, subse[j].name, s-1);
subse[j].name, lpgroups->lpgroups[i].lptypes[lpt].name[s-1] = '\0';
sizeof(lpgroups->lpgroups[i].lptypes[lpt].name));
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[lpt].count = atoi(data);
lpgroups->lpgroups[i].lptypes_count++; lpgroups->lpgroups[i].lptypes_count++;
lpt++; 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