X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Fltt%2Fparser.c;h=2a7dd1e532311351baee1c0ed8577c61444283d2;hb=4a55f63e0cf1b3553de1ed7202fee05fe26808f2;hp=bcae82e1a4ab89e62948c998a6d7d088bf88c22f;hpb=9f2d599db2cff6ee2a1733e43966eb5aeebdd35e;p=lttv.git diff --git a/ltt/branches/poly/ltt/parser.c b/ltt/branches/poly/ltt/parser.c index bcae82e1..2a7dd1e5 100644 --- a/ltt/branches/poly/ltt/parser.c +++ b/ltt/branches/poly/ltt/parser.c @@ -96,24 +96,28 @@ int getSizeindex(unsigned int value) unsigned long long int getSize(parse_file_t *in) { - char *token; - int has_quotes = 0; - unsigned long long int ret; + char *token, *token2; + unsigned long long int ret; token = getToken(in); - if(token[0] == '"') { - has_quotes = 1; - token = getToken(in); - } + + + 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; } - if(has_quotes) { - token = getToken(in); - if(token[0] != '"') goto error; - } return ret; error: @@ -191,14 +195,15 @@ char *allocAndCopy(char *str) **************************************************************************/ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t, - sequence_t * unnamed_types, table_t * named_types) + 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; + t->network = 0; while(1) { token = getToken(in); @@ -221,9 +226,25 @@ 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("network", token)) { - t->network = 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; + } + } } } @@ -242,11 +263,16 @@ 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; + ev->high_priority = 0; + ev->force = 0; + ev->compact_data = 0; while(1) { token = getToken(in); @@ -261,12 +287,36 @@ 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; + else if(!strcmp(token, "high_priority")) + ev->high_priority = 1; + else if(!strcmp(token, "force")) + ev->force = 1; + else if(!strcmp(token, "compact_data")) + ev->compact_data = 1; } - } } @@ -285,10 +335,12 @@ 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->align = 1; + fac->user = 0; while(1) { token = getToken(in); @@ -303,12 +355,18 @@ 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)); - else fac->arch = allocAndCopy(getName(in)); - } + if(car == '\"') fac->arch = allocAndCopy(getQuotedString(in)); + else fac->arch = allocAndCopy(getName(in)); + } else if(!strcmp("align", token)) { + getEqual(in); + fac->align = getSize(in); + } + } } @@ -327,7 +385,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; @@ -352,7 +410,7 @@ char *getNameAttribute(parse_file_t *in) { char * token; char *name = NULL; - char car; + int car; while(1) { token = getToken(in); @@ -374,38 +432,39 @@ char *getNameAttribute(parse_file_t *in) -//for