X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=sidebyside;f=ltt%2Fbranches%2Fpoly%2Fltt%2Fparser.c;h=ab24a6c2e0030898d11c8141edff00c2ec8cd0c4;hb=fcc08e1e49ca66dffe10ce9d27216421482663f0;hp=84a0b5f4d273517f6912f22a5129b8b93541921b;hpb=845a3be5d28365527f858fcdaba910aca0065284;p=lttv.git
diff --git a/ltt/branches/poly/ltt/parser.c b/ltt/branches/poly/ltt/parser.c
index 84a0b5f4..ab24a6c2 100644
--- a/ltt/branches/poly/ltt/parser.c
+++ b/ltt/branches/poly/ltt/parser.c
@@ -96,12 +96,31 @@ int getSizeindex(unsigned int value)
unsigned long long int getSize(parse_file_t *in)
{
- char *token;
+ char *token, *token2;
+ unsigned long long int ret;
token = getToken(in);
- if(in->type == NUMBER) {
- return strtoull(token, NULL, 0);
+
+
+ if(in->type == QUOTEDSTRING) {
+ in->type = NUMBER;
+ token2 = token;
+ do {
+ if (!isdigit(*token2)) {
+ in->type = QUOTEDSTRING;
+ break;
+ }
+ } while (*(++token2) != '\0');
}
+
+ if(in->type == NUMBER) {
+ ret = strtoull(token, NULL, 0);
+ } else {
+ goto error;
+ }
+
+ return ret;
+error:
in->error(in,"incorrect size specification");
return -1;
}
@@ -179,10 +198,12 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
sequence_t * unnamed_types, table_t * named_types)
{
char * token;
+ int car;
t->fmt = NULL;
t->size = 0;
t->custom_write = 0;
+ t->network = 0;
while(1) {
token = getToken(in);
@@ -205,8 +226,26 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
t->size = getSize(in);
} else if(!strcmp("custom_write", token)) {
t->custom_write = 1;
- }
- }
+ } else if(!strcmp("byte_order",token)) {
+ getEqual(in);
+ car = seekNextChar(in);
+ if(car == EOF) in->error(in,"byte order was expected (network?)");
+ else if(car == '\"') token = getQuotedString(in);
+ else token = getName(in);
+ if(!strcmp("network", token)) {
+ t->network = 1;
+ }
+ } else if(!strcmp("write",token)) {
+ getEqual(in);
+ car = seekNextChar(in);
+ if(car == EOF) in->error(in,"write type was expected (custom?)");
+ else if(car == '\"') token = getQuotedString(in);
+ else token = getName(in);
+ if(!strcmp("custom", token)) {
+ t->custom_write = 1;
+ }
+ }
+ }
}
/**************************************************************************
@@ -224,11 +263,13 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
void getEventAttributes(parse_file_t *in, event_t *ev)
{
char * token;
- char car;
+ int car;
ev->name = NULL;
ev->per_trace = 0;
ev->per_tracefile = 0;
+ ev->param_buffer = 0;
+ ev->no_instrument_function = 0;
while(1) {
token = getToken(in);
@@ -243,12 +284,30 @@ void getEventAttributes(parse_file_t *in, event_t *ev)
if(car == EOF) in->error(in,"name was expected");
else if(car == '\"') ev->name = allocAndCopy(getQuotedString(in));
else ev->name = allocAndCopy(getName(in));
- } else if(!strcmp("per_trace", token)) {
- ev->per_trace = 1;
- } else if(!strcmp("per_tracefile", token)) {
- ev->per_tracefile = 1;
+ } else if(!strcmp("scope", token)) {
+ getEqual(in);
+ car = seekNextChar(in);
+ if(car == EOF) in->error(in,"scope was expected");
+ else if(car == '\"') token = getQuotedString(in);
+ else token = getName(in);
+ if(!strcmp(token, "trace")) ev->per_trace = 1;
+ else if(!strcmp(token, "tracefile")) ev->per_tracefile = 1;
+ } else if(!strcmp("param", token)) {
+ getEqual(in);
+ car = seekNextChar(in);
+ if(car == EOF) in->error(in,"parameter type was expected");
+ else if(car == '\"') token = getQuotedString(in);
+ else token = getName(in);
+ if(!strcmp(token, "buffer")) ev->param_buffer = 1;
+ } else if(!strcmp("attribute", token)) {
+ getEqual(in);
+ car = seekNextChar(in);
+ if(car == EOF) in->error(in,"attribute was expected");
+ else if(car == '\"') token = getQuotedString(in);
+ else token = getName(in);
+ if(!strcmp(token, "no_instrument_function"))
+ ev->no_instrument_function = 1;
}
-
}
}
@@ -267,10 +326,11 @@ void getEventAttributes(parse_file_t *in, event_t *ev)
void getFacilityAttributes(parse_file_t *in, facility_t *fac)
{
char * token;
- char car;
+ int car;
fac->name = NULL;
fac->arch = NULL;
+ fac->user = 0;
while(1) {
token = getToken(in);
@@ -285,10 +345,12 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac)
if(car == EOF) in->error(in,"name was expected");
else if(car == '\"') fac->name = allocAndCopy(getQuotedString(in));
else fac->name = allocAndCopy(getName(in));
+ if(!strncmp(fac->name, "user_", sizeof("user_")-1))
+ fac->user = 1;
} else if(!strcmp("arch", token)) {
getEqual(in);
car = seekNextChar(in);
- if(car == '\"') fac->name = allocAndCopy(getQuotedString(in));
+ if(car == '\"') fac->arch = allocAndCopy(getQuotedString(in));
else fac->arch = allocAndCopy(getName(in));
}
}
@@ -309,7 +371,7 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac)
void getFieldAttributes(parse_file_t *in, field_t *f)
{
char * token;
- char car;
+ int car;
f->name = NULL;
@@ -327,14 +389,14 @@ void getFieldAttributes(parse_file_t *in, field_t *f)
else if(car == '\"') f->name = allocAndCopy(getQuotedString(in));
else f->name = allocAndCopy(getName(in));
}
- }
+ }
}
char *getNameAttribute(parse_file_t *in)
{
char * token;
char *name = NULL;
- char car;
+ int car;
while(1) {
token = getToken(in);
@@ -356,28 +418,49 @@ char *getNameAttribute(parse_file_t *in)
-//for , value is an option
-char * getValueStrAttribute(parse_file_t *in)
+//for