X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Fgengtype.h;h=0e527c2706debefd1b5278fa5c69dcf479dc72e9;hb=f5734d36e9d0cf7d7f0186e40ad9915da244bc84;hp=1e8eec7cc40343012c40b192c65ca504dbe05b0b;hpb=6e0ed7a2ec845c3beecc397b5064d66be891df6e;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/gengtype.h b/gcc/gengtype.h index 1e8eec7cc40..0e527c2706d 100644 --- a/gcc/gengtype.h +++ b/gcc/gengtype.h @@ -1,5 +1,5 @@ /* Process source files and output type information. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GCC. @@ -15,8 +15,8 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ /* A file position, mostly for error messages. The FILE element may be compared using pointer equality. */ @@ -37,17 +37,24 @@ enum typekind { TYPE_PARAM_STRUCT }; +typedef struct pair *pair_p; +typedef struct type *type_p; +typedef unsigned lang_bitmap; + +/* Option data for the 'nested_ptr' option. */ +struct nested_ptr_data { + type_p type; + const char *convert_to; + const char *convert_from; +}; + /* A way to pass data through to the output end. */ typedef struct options { struct options *next; const char *name; - void *info; + const char *info; } *options_p; -typedef struct pair *pair_p; -typedef struct type *type_p; -typedef unsigned lang_bitmap; - /* A name and a type. */ struct pair { pair_p next; @@ -57,17 +64,22 @@ struct pair { options_p opt; }; +#define NUM_PARAM 10 + /* A description of a type. */ -struct type { - enum typekind kind; - type_p next; - type_p pointer_to; - enum gc_used_enum { +enum gc_used_enum + { GC_UNUSED = 0, GC_USED, GC_MAYBE_POINTED_TO, GC_POINTED_TO - } gc_used; + }; + +struct type { + enum typekind kind; + type_p next; + type_p pointer_to; + enum gc_used_enum gc_used; union { type_p p; struct { @@ -85,7 +97,7 @@ struct type { } a; struct { type_p stru; - type_p param; + type_p param[NUM_PARAM]; struct fileloc line; } param_struct; } u; @@ -109,49 +121,68 @@ extern struct fileloc lexer_line; /* Print an error message. */ extern void error_at_line - PARAMS ((struct fileloc *pos, const char *msg, ...)) ATTRIBUTE_PRINTF_2; + (struct fileloc *pos, const char *msg, ...) ATTRIBUTE_PRINTF_2; + +/* Combines xmalloc() and vasprintf(). */ +extern int xvasprintf (char **, const char *, va_list) + ATTRIBUTE_PRINTF (2, 0); +/* Like the above, but more convenient for quick coding. */ +extern char * xasprintf (const char *, ...) + ATTRIBUTE_PRINTF_1; /* Constructor routines for types. */ -extern void do_typedef PARAMS ((const char *s, type_p t, struct fileloc *pos)); -extern type_p resolve_typedef PARAMS ((const char *s, struct fileloc *pos)); -extern void new_structure PARAMS ((const char *name, int isunion, - struct fileloc *pos, pair_p fields, - options_p o)); -extern type_p find_structure PARAMS ((const char *s, int isunion)); -extern type_p create_scalar_type PARAMS ((const char *name, size_t name_len)); -extern type_p create_pointer PARAMS ((type_p t)); -extern type_p create_array PARAMS ((type_p t, const char *len)); -extern type_p adjust_field_type PARAMS ((type_p, options_p)); -extern void note_variable PARAMS ((const char *s, type_p t, options_p o, - struct fileloc *pos)); -extern void note_yacc_type PARAMS ((options_p o, pair_p fields, - pair_p typeinfo, struct fileloc *pos)); +extern void do_typedef (const char *s, type_p t, struct fileloc *pos); +extern type_p resolve_typedef (const char *s, struct fileloc *pos); +extern void new_structure (const char *name, int isunion, + struct fileloc *pos, pair_p fields, + options_p o); +extern type_p find_structure (const char *s, int isunion); +extern type_p create_scalar_type (const char *name, size_t name_len); +extern type_p create_pointer (type_p t); +extern type_p create_array (type_p t, const char *len); +extern options_p create_option (const char *name, void *info); +extern type_p adjust_field_type (type_p, options_p); +extern void note_variable (const char *s, type_p t, options_p o, + struct fileloc *pos); +extern void note_yacc_type (options_p o, pair_p fields, + pair_p typeinfo, struct fileloc *pos); /* Lexer and parser routines, most automatically generated. */ -extern int yylex PARAMS((void)); -extern void yyerror PARAMS ((const char *)); -extern int yyparse PARAMS ((void)); -extern void parse_file PARAMS ((char *name)); +extern int yylex (void); +extern void yyerror (const char *); +extern int yyparse (void); +extern void parse_file (const char *name); /* Output file handling. */ -FILE *get_output_file PARAMS ((const char *input_file)); -const char *get_output_file_name PARAMS ((const char *)); +/* Structure representing an output file. */ +struct outf +{ + struct outf *next; + const char *name; + size_t buflength; + size_t bufused; + char *buf; +}; -/* The output header file that is included into pretty much every - source file. */ -extern FILE *header_file; +typedef struct outf * outf_p; /* An output file, suitable for definitions, that can see declarations made in INPUT_FILE and is linked into every language that uses INPUT_FILE. */ -extern FILE *get_output_file_with_visibility PARAMS ((const char *input_file)); +extern outf_p get_output_file_with_visibility + (const char *input_file); +const char *get_output_file_name (const char *); /* A list of output files suitable for definitions. There is one BASE_FILES entry for each language. */ -extern FILE *base_files[]; +extern outf_p base_files[]; /* A bitmap that specifies which of BASE_FILES should be used to output a definition that is different for each language and must be defined once in each language that uses INPUT_FILE. */ -extern lang_bitmap get_base_file_bitmap PARAMS ((const char *input_file)); +extern lang_bitmap get_base_file_bitmap (const char *input_file); + +/* Print, like fprintf, to O. */ +extern void oprintf (outf_p o, const char *S, ...) + ATTRIBUTE_PRINTF_2;