X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=genevent-new%2Fparser.c;h=b8f2a6a2fc03d924847d5dda9d045c8f0c873f2b;hb=15b0e8a4b1e8921acc5016156118a85cee1f46c9;hp=a2a07e212c054adaca1dea3b9e95152b6a3f91aa;hpb=a67cd958dd88555bd8f2352d8ecfe2bc678e9d6f;p=lttv.git diff --git a/genevent-new/parser.c b/genevent-new/parser.c index a2a07e21..b8f2a6a2 100644 --- a/genevent-new/parser.c +++ b/genevent-new/parser.c @@ -3,14 +3,15 @@ parser.c: Generate helper declarations and functions to trace events from an event description file. -Copyright (C) 2002, Xianxiu Yang -Copyright (C) 2002, Michel Dagenais -This program is free software; you can redistribute it and/or modify + Copyright (C) 2005, Mathieu Desnoyers + Copyright (C) 2002, Xianxiu Yang + Copyright (C) 2002, Michel Dagenais + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; version 2 of the License. + the Free Software Foundation; version 2 of the License. -This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -181,7 +182,6 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t, t->fmt = NULL; t->size = 0; - t->alignment = 0; while(1) { token = getToken(in); @@ -202,9 +202,6 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t, } else if(!strcmp("size",token)) { getEqual(in); t->size = getSize(in); - } else if(!strcmp("align",token)) { - getEqual(in); - t->alignment = getNumber(in); } } } @@ -557,11 +554,6 @@ void parseFields(parse_file_t *in, field_t *f, getLAnglebracket(in); f->type = parseType(in,NULL, unnamed_types, named_types); - /* Those will be set later by preset_field_type_size */ - f->fixed_root = FIELD_UNKNOWN; - f->fixed_parent = FIELD_UNKNOWN; - f->fixed_size = FIELD_UNKNOWN; - if(tag) { getLAnglebracket(in); getForwardslash(in); @@ -664,7 +656,7 @@ type_descriptor_t *parseType(parse_file_t *in, type_descriptor_t *inType, getForwardslash(in); getRAnglebracket(in); // - getLAnglebracket(in); // + //getLAnglebracket(in); // /* subfield */ f = (field_t *)memAlloc(sizeof(field_t)); sequence_push(&(t->fields),f); @@ -686,13 +678,13 @@ type_descriptor_t *parseType(parse_file_t *in, type_descriptor_t *inType, //getForwardslash(in); getRAnglebracket(in); // - getLAnglebracket(in); // + //getLAnglebracket(in); // /* subfield */ f = (field_t *)memAlloc(sizeof(field_t)); sequence_push(&(t->fields),f); parseFields(in, f, unnamed_types, named_types, 0); - getLAnglebracket(in); // + //getLAnglebracket(in); // /* subfield */ f = (field_t *)memAlloc(sizeof(field_t)); sequence_push(&(t->fields),f); @@ -727,34 +719,38 @@ type_descriptor_t *parseType(parse_file_t *in, type_descriptor_t *inType, getRAnglebracket(in); // } else if(strcmp(token,"enum") == 0) { - char * str, *str1; + char * str; + int value = -1; + t->type = ENUM; sequence_init(&(t->labels)); + sequence_init(&(t->labels_values)); sequence_init(&(t->labels_description)); t->already_printed = 0; getTypeAttributes(in, t, unnamed_types, named_types); //if(t->size == 0) in->error(in, "Sequence has empty size"); - //Mathieu : we fix enum size to 4 bytes. GCC is always like this. + //Mathieu : we fix enum size to target int size. GCC is always like this. //fox copy optimisation. - if(t->size != 0) in->error(in, "Enum has fixed size of 4."); - t->size = 4; + if(t->size != 0) in->error(in, "Enum has fixed size of target int."); + t->size = 0; getRAnglebracket(in); //