update compat
[lttv.git] / genevent-new / parser.c
index b8f2a6a2fc03d924847d5dda9d045c8f0c873f2b..84a0b5f4d273517f6912f22a5129b8b93541921b 100644 (file)
@@ -182,6 +182,7 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
 
   t->fmt = NULL;
   t->size = 0;
+  t->custom_write = 0;
   
   while(1) {
     token = getToken(in); 
@@ -202,6 +203,8 @@ void getTypeAttributes(parse_file_t *in, type_descriptor_t *t,
     } else if(!strcmp("size",token)) {
       getEqual(in);
       t->size = getSize(in);
+    } else if(!strcmp("custom_write", token)) {
+      t->custom_write = 1;
     }
   }
 }
@@ -267,6 +270,7 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac)
   char car;
   
   fac->name = NULL;
+  fac->arch = NULL;
 
   while(1) {
     token = getToken(in); 
@@ -281,7 +285,12 @@ void getFacilityAttributes(parse_file_t *in, facility_t *fac)
       if(car == EOF) in->error(in,"name was expected");
       else if(car == '\"') fac->name = allocAndCopy(getQuotedString(in));
       else fac->name = allocAndCopy(getName(in));
-    }
+    } else if(!strcmp("arch", token)) {
+      getEqual(in);
+      car = seekNextChar(in);
+      if(car == '\"') fac->name = allocAndCopy(getQuotedString(in));
+                       else fac->arch = allocAndCopy(getName(in));
+               }
   }
 }
 
@@ -329,22 +338,20 @@ char *getNameAttribute(parse_file_t *in)
   
   while(1) {
     token = getToken(in); 
-    if(strcmp("/",token) == 0 || strcmp(">",token) == 0){
-      ungetToken(in);
-      break;
-    }
-
     if(!strcmp("name",token)) {
       getEqual(in);
       car = seekNextChar(in);
       if(car == EOF) in->error(in,"name was expected");
       else if(car == '\"') name = allocAndCopy(getQuotedString(in));
       else name = allocAndCopy(getName(in));
+    } else {
+      ungetToken(in);
+      break;
     }
+
   }
   if(name == NULL) in->error(in, "Name was expected");
   return name;
-  
 }
 
 
@@ -420,7 +427,7 @@ void parseFacility(parse_file_t *in, facility_t * fac)
   
   getFacilityAttributes(in, fac);
   if(fac->name == NULL) in->error(in, "Attribute not named");
-
+       
   fac->capname = allocAndCopy(fac->name);
        strupper(fac->capname);
   getRAnglebracket(in);    
@@ -674,8 +681,8 @@ type_descriptor_t *parseType(parse_file_t *in, type_descriptor_t *inType,
   else if(strcmp(token,"sequence") == 0) {
     t->type = SEQUENCE;
     sequence_init(&(t->fields));
-    //getTypeAttributes(in, t, unnamed_types, named_types);
-    //getForwardslash(in);
+    getTypeAttributes(in, t, unnamed_types, named_types);
+    getForwardslash(in);
     getRAnglebracket(in); //<sequence>
 
     //getLAnglebracket(in); //<sequence size type> 
@@ -1488,7 +1495,8 @@ void sequence_push(sequence_t *t, void *elem)
 
 void *sequence_pop(sequence_t *t) 
 {
-  return t->array[t->position--];
+       if(t->position == 0) printf("Error : trying to pop an empty sequence");
+  return t->array[--t->position];
 }
 
 
@@ -1551,5 +1559,3 @@ char *appendString(char *s, char *suffix)
   strcat(tmp,suffix);  
   return tmp;
 }
-
-
This page took 0.024967 seconds and 4 git commands to generate.