Logo AND Algorithmique Numérique Distribuée

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