correctly add -lm for math lib
[lttv.git] / ltt / branches / poly / ltt / parser.h
index 5e0c421bb7eae2b1e7104ae9ae5d82ff4b19858c..37dd38bb10bfeff71f3ba8850fa8b47ba8b6d5fc 100644 (file)
@@ -1,3 +1,24 @@
+/*
+
+parser.c: Generate helper declarations and functions to trace events
+  from an event description file.
+
+Copyright (C) 2002, Xianxiu Yang
+Copyright (C) 2002, Michel Dagenais 
+This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+*/
+
 #ifndef PARSER_H
 #define PARSER_H
 
@@ -34,10 +55,9 @@ void *table_find_int(table *t, int *key);
 
 typedef enum _token_type {
   ENDFILE,
-  COMA,
-  LPARENTHESIS,
-  RPARENTHESIS,
-  SEMICOLON,
+  FORWARDSLASH,
+  LANGLEBRACKET,
+  RANGLEBRACKET,
   EQUAL,
   QUOTEDSTRING,
   NUMBER,
@@ -58,19 +78,17 @@ typedef struct _parse_file {
 
 void ungetToken(parse_file * in);
 char *getToken(parse_file *in);
-char *getComa(parse_file *in);
-char *getLParenthesis(parse_file *in);
-char *getRParenthesis(parse_file *in);
-char *getSemiColon(parse_file *in);
+char *getForwardslash(parse_file *in);
+char *getLAnglebracket(parse_file *in);
+char *getRAnglebracket(parse_file *in);
 char *getQuotedString(parse_file *in);
 char *getName(parse_file *in);
-int getNumber(parse_file *in);
-char * getEqual(parse_file *in);
+int   getNumber(parse_file *in);
+char *getEqual(parse_file *in);
+char  seekNextChar(parse_file *in);
 
 void skipComment(parse_file * in);
 void skipEOL(parse_file * in);
-int isalpha(char car);
-int isalnum(char car);
 
 /* Some constants */
 
@@ -88,6 +106,7 @@ typedef enum _data_type {
   ARRAY,
   SEQUENCE,
   STRUCT,
+  UNION,
   NONE
 } data_type;
 
@@ -107,33 +126,50 @@ typedef struct _type_descriptor {
 
 /* Fields within types */
 
-typedef struct _field{
+typedef struct _type_fields{
   char *name;
   char *description;
   type_descriptor *type;
-} field;
+} type_fields;
 
 
 /* Events definitions */
 
-typedef struct _event {  
+typedef struct _event_t {  
   char *name;
   char *description;
   type_descriptor *type; 
-  int nested;
-} event;
+} event_t;
+
+typedef struct _facility_t {
+  char * name;
+  char * description;
+  sequence events;
+  sequence unnamed_types;
+  table named_types;
+} facility_t;
 
 int getSize(parse_file *in);
-unsigned long getTypeChecksum(unsigned long aCrc, type_descriptor * type, int * nestedStruct);
+unsigned long getTypeChecksum(unsigned long aCrc, type_descriptor * type);
 
-void parseEvent(parse_file *in, event *ev, sequence * unnamed_types, table * named_types);
+void parseFacility(parse_file *in, facility_t * fac);
+void parseEvent(parse_file *in, event_t *ev, sequence * unnamed_types, table * named_types);
 void parseTypeDefinition(parse_file *in, sequence * unnamed_types, table * named_types);
 type_descriptor *parseType(parse_file *in, type_descriptor *t, sequence * unnamed_types, table * named_types);
 void parseFields(parse_file *in, type_descriptor *t, sequence * unnamed_types, table * named_types);
-void checkNamedTypesImplemented(table * namedTypes);
+int checkNamedTypesImplemented(table * namedTypes);
 type_descriptor * find_named_type(char *name, table * named_types);
-void generateChecksum(char * facName, unsigned long * checksum, sequence * events);
+int generateChecksum(char * facName, unsigned long * checksum, sequence * events);
+
+
+/* get attributes */
+char * getNameAttribute(parse_file *in);
+char * getFormatAttribute(parse_file *in);
+int    getSizeAttribute(parse_file *in);
+int    getValueAttribute(parse_file *in);
+char * getValueStrAttribute(parse_file *in);
 
+char * getDescription(parse_file *in);
 
 
 static char *intOutputTypes[] = {
This page took 0.023471 seconds and 4 git commands to generate.