fprintf(fd, " {\n");
for(unsigned int i=0;i<td->labels.position;i++){
print_tabs(1, fd);
- fprintf(fd, "LTTNG_%s", ((char*)(td->labels.array[i])));
+ fprintf(fd, "LTTNG_%s = %d", ((char*)td->labels.array[i]),
+ (*(int*)td->labels_values.array[i]));
fprintf(fd, ",\n");
}
fprintf(fd, "};\n");
getRAnglebracket(in); //</sequence>
}
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);
getLAnglebracket(in);
token = getToken(in); //"label" or "/"
while(strcmp("label",token) == 0){
+ int *label_value = malloc(sizeof(int));
+
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);
+
+ sequence_push(&(t->labels),str);
+
+ if(token) value = strtol(token, NULL, 0);
+ else value++;
+
+ *label_value = value;
+ sequence_push(&(t->labels_values), label_value);
getForwardslash(in);
getRAnglebracket(in);
free(tp->labels.array[pos2]);
}
sequence_dispose(&(tp->labels));
+ for(pos2 = 0; pos2 < tp->labels_values.position; pos2++) {
+ free(tp->labels_values.array[pos2]);
+ }
+ sequence_dispose(&(tp->labels_values));
}
if(tp->type == STRUCT) {
for(pos2 = 0; pos2 < tp->fields.position; pos2++) {
char *fmt;
size_t size;
sequence_t labels; // for enumeration
+ sequence_t labels_values; // for enumeration
sequence_t labels_description;
int already_printed;
sequence_t fields; // for structure, array and sequence
char * capname;
char * description;
sequence_t events;
- sequence_t unnamed_types;
+ sequence_t unnamed_types; //FIXME : remove
table_t named_types;
unsigned int checksum;
} facility_t;