From 44cac8a9d536a16515bd298516fc7f7a97c34ecc Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 6 Jun 2005 20:52:42 +0000 Subject: [PATCH] fix multiple enums git-svn-id: http://ltt.polymtl.ca/svn@940 04897980-b3bd-0310-b5e0-8ef037075253 --- genevent/genevent.c | 13 +++++++++++-- genevent/parser.c | 1 + genevent/parser.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/genevent/genevent.c b/genevent/genevent.c index 5adf8788..83e10ff2 100644 --- a/genevent/genevent.c +++ b/genevent/genevent.c @@ -197,7 +197,8 @@ void generateEnumEvent(FILE *fp, char *facName, int * nbEvent, unsigned long che fprintf(fp,"#include \n\n"); fprintf(fp,"/**** facility handle ****/\n\n"); - fprintf(fp,"extern trace_facility_t ltt_facility_%s_%X;\n\n\n",facName, checksum); + fprintf(fp,"extern trace_facility_t ltt_facility_%s_%X;\n",facName, checksum); + fprintf(fp,"extern trace_facility_t ltt_facility_%s;\n\n\n",facName, checksum); fprintf(fp,"/**** event type ****/\n\n"); fprintf(fp,"enum %s_event {\n",facName); @@ -310,6 +311,8 @@ generateTypeDefs(FILE * fp) void generateEnumDefinition(FILE * fp, type_descriptor * type){ int pos; + if(type->already_printed) return; + fprintf(fp,"enum {\n"); for(pos = 0; pos < type->labels.position; pos++){ fprintf(fp,"\t%s", type->labels.array[pos]); @@ -320,6 +323,8 @@ void generateEnumDefinition(FILE * fp, type_descriptor * type){ fprintf(fp,"\n"); } fprintf(fp,"};\n\n\n"); + + type->already_printed = 1; } /***************************************************************************** @@ -585,10 +590,14 @@ void generateLoaderfile(FILE * fp, char * facName, int nbEvent, unsigned long ch fprintf(fp, "#define _LTT_FACILITY_LOADER_%s_H_\n\n",capname); fprintf(fp,"#include \n", facName, checksum); fprintf(fp,"#include \n\n", facName, checksum); + fprintf(fp,"ltt_facility_t\tltt_facility_%s;\n", facName, checksum); fprintf(fp,"ltt_facility_t\tltt_facility_%s_%X;\n\n", facName, checksum); + fprintf(fp,"EXPORT_SYMBOL(ltt_facility_%s);\n\n",facName, checksum); fprintf(fp,"EXPORT_SYMBOL(ltt_facility_%s_%X);\n\n",facName, checksum); - fprintf(fp,"#define LTT_FACILITY_SYMBOL\t\t\t\tltt_facility_%s_%X\n", + fprintf(fp,"#define LTT_FACILITY_SYMBOL\t\t\t\tltt_facility_%s\n", + facName); + fprintf(fp,"#define LTT_FACILITY_CHECKSUM_SYMBOL\t\t\t\tltt_facility_%s_%X\n", facName, checksum); fprintf(fp,"#define LTT_FACILITY_CHECKSUM\t\t\t0x%X\n", checksum); fprintf(fp,"#define LTT_FACILITY_NAME\t\t\t\t\t\"%s\"\n", facName); diff --git a/genevent/parser.c b/genevent/parser.c index 5a756211..d998c813 100644 --- a/genevent/parser.c +++ b/genevent/parser.c @@ -514,6 +514,7 @@ type_descriptor *parseType(parse_file *in, type_descriptor *inType, t->type = ENUM; sequence_init(&(t->labels)); sequence_init(&(t->labels_description)); + t->already_printed = 0; t->size = getSizeAttribute(in); t->fmt = allocAndCopy(getFormatAttribute(in)); getRAnglebracket(in); diff --git a/genevent/parser.h b/genevent/parser.h index 5383b11a..83777c34 100644 --- a/genevent/parser.h +++ b/genevent/parser.h @@ -104,6 +104,7 @@ typedef struct _type_descriptor { int size; sequence labels; // for enumeration sequence labels_description; + int already_printed; sequence fields; // for structure struct _type_descriptor *nested_type; // for array and sequence } type_descriptor; -- 2.34.1