fix multiple enums
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 6 Jun 2005 20:52:42 +0000 (20:52 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Mon, 6 Jun 2005 20:52:42 +0000 (20:52 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@940 04897980-b3bd-0310-b5e0-8ef037075253

genevent/genevent.c
genevent/parser.c
genevent/parser.h

index 5adf87885fe9af8237f7c14e3bafc6ee5248754d..83e10ff2c0a85910c79e3c01f1a8d2456ef31e24 100644 (file)
@@ -197,7 +197,8 @@ void generateEnumEvent(FILE *fp, char *facName, int * nbEvent, unsigned long che
   fprintf(fp,"#include <linux/ltt-log.h>\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 <linux/ltt-facilities.h>\n", facName, checksum);
   fprintf(fp,"#include <linux/module.h>\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);
index 5a756211a8dd9b01f23fba8cc6132c13ded61441..d998c81381b17672b4bf0caf8de0fd45d03abaa7 100644 (file)
@@ -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);
index 5383b11ad8c575602a043dba64a39c15e642bff8..83777c34c0e544a9141cf698945d3827c44c94db 100644 (file)
@@ -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;
This page took 0.03019 seconds and 4 git commands to generate.