1 /* Process source files and output type information.
2 Copyright (C) 2002 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
21 /* A file position, mostly for error messages.
22 The FILE element may be compared using pointer equality. */
28 /* Kinds of types we can understand. */
40 /* A way to pass data through to the output end. */
41 typedef struct options {
47 typedef struct pair *pair_p;
48 typedef struct type *type_p;
49 typedef unsigned lang_bitmap;
51 /* A name and a type. */
60 /* A description of a type. */
95 ((x)->kind == TYPE_UNION || \
96 ((x)->kind == TYPE_LANG_STRUCT \
97 && (x)->u.s.lang_struct->kind == TYPE_UNION))
98 #define UNION_OR_STRUCT_P(x) \
99 ((x)->kind == TYPE_UNION \
100 || (x)->kind == TYPE_STRUCT \
101 || (x)->kind == TYPE_LANG_STRUCT)
103 /* The one and only TYPE_STRING. */
104 extern struct type string_type;
106 /* Variables used to communicate between the lexer and the parser. */
107 extern int lexer_toplevel_done;
108 extern struct fileloc lexer_line;
110 /* Print an error message. */
111 extern void error_at_line
112 VPARAMS ((struct fileloc *pos, const char *msg, ...));
114 /* Constructor routines for types. */
115 extern void do_typedef PARAMS ((const char *s, type_p t, struct fileloc *pos));
116 extern type_p resolve_typedef PARAMS ((const char *s, struct fileloc *pos));
117 extern void new_structure PARAMS ((const char *name, int isunion,
118 struct fileloc *pos, pair_p fields,
120 extern type_p find_structure PARAMS ((const char *s, int isunion));
121 extern type_p create_scalar_type PARAMS ((const char *name, size_t name_len));
122 extern type_p create_pointer PARAMS ((type_p t));
123 extern type_p create_array PARAMS ((type_p t, const char *len));
124 extern type_p adjust_field_type PARAMS ((type_p, options_p));
125 extern void note_variable PARAMS ((const char *s, type_p t, options_p o,
126 struct fileloc *pos));
127 extern void note_yacc_type PARAMS ((options_p o, pair_p fields,
128 pair_p typeinfo, struct fileloc *pos));
130 /* Lexer and parser routines, most automatically generated. */
131 extern int yylex PARAMS((void));
132 extern void yyerror PARAMS ((const char *));
133 extern int yyparse PARAMS ((void));
134 extern void parse_file PARAMS ((char *name));
136 /* Output file handling. */
138 FILE *get_output_file PARAMS ((const char *input_file));
139 const char *get_output_file_name PARAMS ((const char *));
141 /* The output header file that is included into pretty much every
143 extern FILE *header_file;
145 /* An output file, suitable for definitions, that can see declarations
146 made in INPUT_FILE and is linked into every language that uses
148 extern FILE *get_output_file_with_visibility PARAMS ((const char *input_file));
150 /* A list of output files suitable for definitions. There is one
151 BASE_FILES entry for each language. */
152 extern FILE *base_files[];
154 /* A bitmap that specifies which of BASE_FILES should be used to
155 output a definition that is different for each language and must be
156 defined once in each language that uses INPUT_FILE. */
157 extern lang_bitmap get_base_file_bitmap PARAMS ((const char *input_file));