1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
|
/* $Id: c2man.h,v 2.0.1.19 1996/03/21 08:23:27 greyham Exp $
*
* Definitions for C language manual page generator
*/
#ifndef _C2MAN_H
#define _C2MAN_H
#include "config.h"
#include "symbol.h"
#ifdef I_SYS_TYPES
#include <sys/types.h>
#endif
#ifdef I_STDLIB
#include <stdlib.h>
#endif
#ifdef I_STRING
#include <string.h>
#else
#include <strings.h>
#endif
#include <stdio.h>
#ifdef I_UNISTD
#include <unistd.h>
#endif
#ifdef I_STDDEF
#include <stddef.h>
#endif
#ifdef I_TIME
#include <time.h>
#endif
#ifdef I_SYS_TIME
#include <sys/time.h>
#endif
#ifdef NeXT
#include <libc.h>
#undef ECHO /* lex generates ECHO */
#endif
#ifdef DBMALLOC
#include </usr/local/debug_include/malloc.h>
#endif
#include "confmagic.h"
/* number of spaces in a tab */
#define NUM_TAB_SPACES 4
/* maximum include file nesting */
#define MAX_INC_DEPTH 15
/* maximum number of include directories */
#define MAX_INC_DIR 15
/* maximum number of characters in a text buffer */
#define MAX_TEXT_LENGTH 256
/* Boolean type */
typedef int boolean;
#ifndef TRUE
#define FALSE 0
#define TRUE 1
#endif
/* NULL char *, useful for passing NULL to functions wanting a char * */
#define NULLCP ((char *)0)
/* 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 */
} ParameterList;
/* Declaration specifier flags */
#define DS_NONE 0 /* default */
#define DS_EXTERN 1 /* contains "extern" specifier */
#define DS_STATIC 2 /* contains "static" specifier */
#define DS_CHAR 4 /* contains "char" type specifier */
#define DS_SHORT 8 /* contains "short" type specifier */
#define DS_FLOAT 16 /* contains "float" type specifier */
#define DS_JUNK 32 /* we're not interested in this declaration */
#define DS_INLINE 64 /* makes static look interesting */
/* This structure stores information about a declaration specifier. */
typedef struct _decl_spec {
unsigned short flags; /* flags defined above */
char *text; /* source text */
struct _enumerator_list *enum_list; /* associated enum (if any) */
} DeclSpec;
/* Styles of declaration/definition */
typedef enum {
DECL_SIMPLE, /* simple declaration */
DECL_COMPOUND, /* compound declaration */
DECL_FUNCTION, /* function declaration (prototype) */
DECL_FUNCDEF /* an actual function definition */
} DeclType;
/* This structure stores information about a declarator. */
typedef struct _declarator {
char *name; /* name of variable or function */
char *text; /* source text */
DeclType type; /* style of function declaration */
ParameterList params; /* function parameters */
char *comment; /* description of param or variable */
char *retcomment; /* description of return value */
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 declaration. */
typedef struct _declaration {
DeclSpec decl_spec;
DeclaratorList decl_list;
} Declaration;
/* this structure store information about an enumerator */
typedef struct _enumerator {
char *name; /* name of enum entry */
char *comment; /* description of entry */
char *group_comment; /* general descr. for next few enums in list */
struct _enumerator *next; /* next enumerator in list */
} Enumerator;
/* This is a list of enumerators. */
typedef struct _enumerator_list {
Enumerator *first; /* pointer to first enumerator in list */
Enumerator *last; /* pointer to last enumerator in list */
struct _enumerator_list *next; /* next list in a list-of-lists */
} EnumeratorList;
/* This structure stores information about a function parameter. */
typedef struct _parameter {
DeclSpec decl_spec;
Declarator *declarator;
boolean suppress; /* don't print in grouped page */
boolean duplicate; /* mention fn in grouped page */
struct _parameter *next; /* next parameter in list */
} Parameter;
/* this is an identifier, with surrounding comments (if any) */
typedef struct _identifier {
char *name;
char *comment_before, *comment_after;
} Identifier;
/* parser stack entry type */
typedef union {
char *text;
DeclSpec decl_spec;
Parameter parameter;
ParameterList param_list;
Declarator *declarator;
DeclaratorList decl_list;
Declaration declaration;
Enumerator enumerator;
EnumeratorList *enum_list;
Identifier identifier;
boolean boolean;
} yystype;
/* include files specified by user */
typedef struct _includefile
{
char *name;
struct _includefile *next;
} IncludeFile;
/* output object types */
enum Output_Object
{
#if 0 /* C++ stuff */
OBJECT_CLASS,
OBJECT_STRUCT,
OBJECT_ENUM,
OBJECT_TYPEDEF,
#endif
OBJECT_FUNCTION,
OBJECT_VARIABLE,
OBJECT_STATIC_FUNCTION,
OBJECT_STATIC_VARIABLE,
_OBJECT_NUM
};
struct Output_Object_Info
{
char flag; /* -O flag used to set it */
char *name; /* descriptive name for usage() */
char *extension; /* file extension */
char *subdir; /* subdirectory */
};
/* list of sections to exclude */
typedef struct ExcludeSection
{
char *name;
struct ExcludeSection *next;
} ExcludeSection;
#define YYSTYPE yystype
/* Program options */
extern boolean static_out;
extern boolean variables_out;
extern boolean promote_param;
extern boolean look_at_body_start;
extern boolean body_start_only;
extern const char *decl_spec_prefix, *declarator_prefix, *declarator_suffix;
extern const char *first_param_prefix, *middle_param_prefix, *last_param_suffix;
extern int num_inc_dir;
extern const char *inc_dir[];
extern char *manual_name;
extern const char *progname;
extern char *header_prefix;
extern IncludeFile *first_include;
extern ExcludeSection *first_excluded_section;
extern boolean fixup_comments;
extern char *group_terse;
extern boolean group_together;
extern boolean terse_specified;
extern boolean always_document_params;
extern char *output_dir;
/* Global declarations */
extern int line_num;
extern const char *basefile;
extern Time_t basetime;
extern boolean inbasefile;
extern boolean header_file;
extern SymbolTable *typedef_names;
extern void output_error();
extern void parse_file _((const char *start_file));
extern int errors;
extern const char *manual_section;
extern boolean use_input_name;
extern boolean make_embeddable;
extern struct Output_Object_Info output_object[_OBJECT_NUM];
/* Output a string to standard output. */
#define put_string(s) fputs(s, stdout)
/* a malloc that handles errors, and a free that handles NULL */
#ifndef DBMALLOC
void *safe_malloc _((size_t size));
#else
/* use macro so dbmalloc tells us where safe_malloc is called from */
#define safe_malloc(s) malloc(s)
#endif
#define safe_free(p) do { if (p) free(p); p = NULL; } while(0)
void outmem();
void print_includes _((FILE *f));/* write #include lines */
void yyerror _V((const char *fmt, ...));
char *strduplicate _((const char *s));
int strncmpi _((const char *s1, const char *s2, size_t n));
char *strtoupper _((char *s));
void my_perror _((const char *action, const char *filename));
char *alloc_string _((const char *start, const char *end));
#endif
|