fprintf(hFp, "#endif //_LTT_FACILITY_%s_H_\n",fac->capname);
/* generate .h file, calls to register the facility at init time */
- fprintf(lFp, "#ifndef _LTT_FACILITY_LOADER_%s_H_\n",fac->capname);
- fprintf(lFp, "#define _LTT_FACILITY_LOADER_%s_H_\n\n",fac->capname);
- generateLoaderfile(lFp,fac->name,nbEvent,checksum);
- fprintf(lFp, "#endif //_LTT_FACILITY_LOADER_%s_H_\n",fac->capname);
+ generateLoaderfile(lFp,fac->name,nbEvent,checksum,fac->capname);
fclose(hFp);
fclose(lFp);
fprintf(fp,"enum {\n");
for(pos = 0; pos < type->labels.position; pos++){
fprintf(fp,"\t%s", type->labels.array[pos]);
- if (pos != type->labels.position - 1) fprintf(fp,",\n");
+ if (pos != type->labels.position - 1) fprintf(fp,",");
+ if(type->labels_description.array[pos] != NULL)
+ fprintf(fp,"\t/* %s */\n",type->labels_description.array[pos]);
+ else
+ fprintf(fp,"\n");
}
- fprintf(fp,"\n};\n\n\n");
+ fprintf(fp,"};\n\n\n");
}
/*****************************************************************************
* nbEvent : number of events in the facility
* checksum : checksum for the facility
****************************************************************************/
-void generateLoaderfile(FILE * fp, char * facName, int nbEvent, unsigned long checksum){
- //will be removed later
+void generateLoaderfile(FILE * fp, char * facName, int nbEvent, unsigned long checksum, char *capname){
+ fprintf(fp, "#ifndef _LTT_FACILITY_LOADER_%s_H_\n",capname);
+ 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_%X;\n\n", facName, checksum);
fprintf(fp,"EXPORT_SYMBOL(ltt_facility_%s_%X);\n\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);
fprintf(fp,"#define LTT_FACILITY_NUM_EVENTS\t\t%d\n\n", nbEvent);
+ fprintf(fp, "#endif //_LTT_FACILITY_LOADER_%s_H_\n",capname);
}
void generateTypeDefs(FILE *);
void generateEnumEvent(FILE * fp,char * facName, int * nbEvent, unsigned long checksum);
void generateStructFunc(FILE * fp, char * facName, unsigned long checksum);
-void generateLoaderfile(FILE * fp, char * facName, int nbEvent, unsigned long checksum);
+void generateLoaderfile(FILE * fp, char * facName, int nbEvent, unsigned long checksum, char *capname);
void generateEnumDefinition(FILE * fp, type_descriptor * fHead);
char * getTypeStr(type_descriptor * td);
char * str, *str1;
t->type = ENUM;
sequence_init(&(t->labels));
+ sequence_init(&(t->labels_description));
t->size = getSizeAttribute(in);
t->fmt = allocAndCopy(getFormatAttribute(in));
getRAnglebracket(in);
str = allocAndCopy(getNameAttribute(in));
token = getValueStrAttribute(in);
if(token){
- str1 = appendString(str,"=");
- free(str);
- str = appendString(str1,token);
- free(str1);
- sequence_push(&(t->labels),str);
- }else
- sequence_push(&(t->labels),str);
+ str1 = appendString(str,"=");
+ free(str);
+ str = appendString(str1,token);
+ free(str1);
+ sequence_push(&(t->labels),str);
+ }
+ else
+ sequence_push(&(t->labels),str);
getForwardslash(in);
getRAnglebracket(in);
+ //read description if any. May be NULL.
+ str = allocAndCopy(getDescription(in));
+ sequence_push(&(t->labels_description),str);
+
//next label definition
getLAnglebracket(in);
token = getToken(in); //"label" or "/"
if(strcmp("/",token))in->error(in, "not a valid enum definition");
token = getName(in);
if(strcmp("enum",token))in->error(in, "not a valid enum definition");
- getRAnglebracket(in); //</label>
+ getRAnglebracket(in); //</label>
}
else if(strcmp(token,"int") == 0) {
t->type = INT;