Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
4dd72ef8a67c96aa008d7b021247d507d153526a
[simgrid.git] / src / gras / DataDesc / ddt_parse.yy.h
1 /* $Id$ */
2
3 /* ddt_parse.h -- automatic parsing of data structures                      */
4
5 /* Copyright (c) 2003 Arnaud Legrand.                                       */
6 /* Copyright (c) 2003, 2004 Martin Quinson.                                 */
7 /* All rights reserved.                                                     */
8
9 /* This program is free software; you can redistribute it and/or modify it
10  * under the terms of the license (GNU LGPL) which comes with this package. */
11
12 typedef enum {
13   GRAS_DDT_PARSE_TOKEN_EMPTY = 0,
14   GRAS_DDT_PARSE_TOKEN_LA = 512,        /* { 'A' for the french "accolade" since there is a name conflict in english (braket/brace) */
15   GRAS_DDT_PARSE_TOKEN_RA,      /* } */
16   GRAS_DDT_PARSE_TOKEN_LB,      /* [ */
17   GRAS_DDT_PARSE_TOKEN_RB,      /* ] */
18   GRAS_DDT_PARSE_TOKEN_LP,      /* ( */
19   GRAS_DDT_PARSE_TOKEN_RP,      /* ) */
20   GRAS_DDT_PARSE_TOKEN_WORD,
21   GRAS_DDT_PARSE_TOKEN_SPACE,
22   GRAS_DDT_PARSE_TOKEN_COMMENT,
23   GRAS_DDT_PARSE_TOKEN_ANNOTATE,
24   GRAS_DDT_PARSE_TOKEN_NEWLINE,
25   GRAS_DDT_PARSE_TOKEN_STAR,
26   GRAS_DDT_PARSE_TOKEN_SEMI_COLON,
27   GRAS_DDT_PARSE_TOKEN_COLON,   /* impossible since the macro think that it's a arg separator. 
28                                    But handle anyway for the *vicious* calling gras_ddt_parse manually */
29   GRAS_DDT_PARSE_TOKEN_ERROR
30 } gras_ddt_parse_token_t;
31
32 #define GRAS_DDT_PARSE_MAX_STR_CONST 4048
33
34 extern int gras_ddt_parse_line_pos;
35 extern int gras_ddt_parse_col_pos;
36 extern int gras_ddt_parse_char_pos;
37 extern int gras_ddt_parse_tok_num;
38
39 void gras_ddt_parse_dump(void);
40 int gras_ddt_parse_lex_n_dump(void);
41 void gras_ddt_parse_pointer_init(const char *file);
42 void gras_ddt_parse_pointer_close(void);
43 void gras_ddt_parse_pointer_string_init(const char *string_to_parse);
44 void gras_ddt_parse_pointer_string_close(void);
45
46 /* prototypes of the functions offered by flex */
47 int gras_ddt_parse_lex(void);
48 int gras_ddt_parse_get_lineno(void);
49 FILE *gras_ddt_parse_get_in(void);
50 FILE *gras_ddt_parse_get_out(void);
51 int gras_ddt_parse_get_leng(void);
52 char *gras_ddt_parse_get_text(void);
53 void gras_ddt_parse_set_lineno(int line_number);
54 void gras_ddt_parse_set_in(FILE * in_str);
55 void gras_ddt_parse_set_out(FILE * out_str);
56 int gras_ddt_parse_get_debug(void);
57 void gras_ddt_parse_set_debug(int bdebug);
58 int gras_ddt_parse_lex_destroy(void);
59
60 #define PARSE_ERROR_PRE do {
61 #define PARSE_ERROR_POST xbt_abort();} while (0)
62
63 #define PARSE_ERROR0(fmt)     PARSE_ERROR_PRE \
64                               ERROR3(fmt " at %d:%d of :\n%s", gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
65                               PARSE_ERROR_POST
66 #define PARSE_ERROR1(fmt,a)   PARSE_ERROR_PRE \
67                               ERROR4(fmt " at %d:%d of :\n%s",a, gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
68                               PARSE_ERROR_POST
69 #define PARSE_ERROR2(fmt,a,b) PARSE_ERROR_PRE \
70                               ERROR5(fmt " at %d:%d of :\n%s",a,b, gras_ddt_parse_line_pos,gras_ddt_parse_col_pos,definition);\
71                               PARSE_ERROR_POST