home *** CD-ROM | disk | FTP | other *** search
- /* $Id: cproto.h 3.3 92/03/14 11:57:14 cthuang Exp $
- *
- * Declarations for C function prototype generator
- */
- #include "config.h"
-
- /* Boolean type */
- typedef char boolean;
- #define FALSE 0
- #define TRUE 1
-
- /* Source file text */
- typedef struct text {
- char text[MAX_TEXT_SIZE]; /* source text */
- long begin; /* offset in temporary output file */
- } Text;
-
- /* This is a list of function parameters. */
- typedef struct parameter_list {
- struct parameter *first; /* pointer to first parameter in list */
- struct parameter *last; /* pointer to last parameter in list */
- long begin_comment; /* begin offset of comment */
- long end_comment; /* end offset of comment */
- char *comment; /* comment at start of parameter list */
- } ParameterList;
-
- /* Declaration specifier flags */
- #define DS_EXTERN 0 /* default: external declaration */
- #define DS_STATIC 1 /* visible only in current file */
- #define DS_CHAR 2 /* "char" type specifier in declaration */
- #define DS_SHORT 4 /* "short" type specifier in declaration */
- #define DS_FLOAT 8 /* "float" type specifier in declaration */
- #define DS_JUNK 16 /* we're not interested in this declaration */
-
- /* This structure stores information about a declaration specifier. */
- typedef struct decl_spec {
- unsigned short flags; /* flags defined above */
- char *text; /* source text */
- long begin; /* offset in output file */
- } DeclSpec;
-
- /* Styles of function definitions */
- typedef enum {
- FUNC_NONE, /* not a function definition */
- FUNC_TRADITIONAL, /* traditional style */
- FUNC_ANSI /* ANSI style */
- } FuncDefStyle;
-
- /* This structure stores information about a declarator. */
- typedef struct declarator {
- char *name; /* name of variable or function */
- char *text; /* source text */
- long begin; /* offset in temporary file */
- long begin_comment; /* begin offset of comment */
- long end_comment; /* end offset of comment */
- FuncDefStyle func_def; /* style of function definition */
- ParameterList params; /* function parameters */
- struct declarator *head; /* head function declarator */
- struct declarator *func_stack; /* stack of function declarators */
- struct declarator *next; /* next declarator in list */
- } Declarator;
-
- /* This is a list of declarators. */
- typedef struct declarator_list {
- Declarator *first; /* pointer to first declarator in list */
- Declarator *last; /* pointer to last declarator in list */
- } DeclaratorList;
-
- /* This structure stores information about a function parameter. */
- typedef struct parameter {
- struct parameter *next; /* next parameter in list */
- DeclSpec decl_spec;
- Declarator *declarator;
- char *comment; /* comment following the parameter */
- } Parameter;
-
- /* parser stack entry type */
- typedef union {
- Text text;
- DeclSpec decl_spec;
- Parameter parameter;
- ParameterList param_list;
- Declarator *declarator;
- DeclaratorList decl_list;
- } YYSTYPE;
-
- /* Prototype styles */
- typedef enum {
- PROTO_NONE, /* do not output any prototypes */
- PROTO_TRADITIONAL, /* comment out parameters */
- PROTO_ABSTRACT, /* comment out parameter names */
- PROTO_ANSI, /* ANSI C prototype */
- PROTO_MACRO, /* preprocessor macro around parameters */
- } PrototypeStyle;
-
- /* The role of a function declarator */
- typedef enum {
- FUNC_OTHER, /* declarator for a miscellaneous declaration */
- FUNC_PROTO, /* declarator for a prototype */
- FUNC_DEF /* declarator for a function definition */
- } FuncDeclRole;
-
- /* Prototype/function definition output formats */
- typedef enum {
- FMT_OTHER, /* miscellaneous */
- FMT_PROTO, /* prototype */
- FMT_FUNC, /* function definition */
- FMT_FUNC_COMMENT /* function definition with parameter comments */
- } FuncFormatType;
-
- /* Prototype/function definition output format */
- typedef struct {
- char *decl_spec_prefix; /* output before declaration specifier */
- char *declarator_prefix; /* output before declarator name */
- char *declarator_suffix; /* output before '(' of parameter list */
- char *first_param_prefix; /* output before first parameter */
- char *middle_param_prefix; /* output before each subsequent parameter */
- char *last_param_suffix; /* output after last parameter */
- } FuncFormat;
-
- /* Program options */
- extern boolean extern_out;
- extern boolean static_out;
- extern boolean variables_out;
- extern boolean promote_param;
- extern PrototypeStyle proto_style;
- extern FuncDefStyle func_style;
- extern boolean define_macro;
- extern char *macro_name;
- extern boolean file_comment_out;
- extern int num_inc_dir;
- extern char *inc_dir[];
- extern FuncFormat fmt[4];
-
- /* Global declarations */
- extern char progname[];
- extern long begin_comment, end_comment;
-
- extern char *xmalloc(), *xstrdup(), *trim_path_sep();
- extern void put_error();
- extern void init_parser(), process_file(), pop_file();
- extern char *cur_file_name();
- extern unsigned cur_line_num();
- extern FILE *cur_tmp_file();
- extern void cur_file_changed();
-