diff options
author | Will Estes <wlestes@users.sourceforge.net> | 2001-10-17 14:29:52 +0000 |
---|---|---|
committer | Will Estes <wlestes@users.sourceforge.net> | 2001-10-17 14:29:52 +0000 |
commit | 16fe6f376abdc0e84ea99f010b007aa018b6bf9f (patch) | |
tree | bf1473e55e2a54d10ac08d583f86b1e11a795277 /flexdef.h | |
parent | 6e841250e0f2d884f1d8f360ce56003f15d93bd1 (diff) |
merge latest batch of millaway's changes
Diffstat (limited to 'flexdef.h')
-rw-r--r-- | flexdef.h | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -31,8 +31,12 @@ /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ /* PURPOSE. */ +#ifndef FLEXDEF_H +#define FLEXDEF_H 1 + #include <stdio.h> #include <ctype.h> +#include <limits.h> #include "config.h" @@ -390,6 +394,7 @@ extern int yymore_really_used, reject_really_used; * backing_up_file - file to summarize backing-up states to * infilename - name of input file * outfilename - name of output file + * headerfilename - name of the .h file to generate * did_outfilename - whether outfilename was explicitly set * prefix - the prefix used for externally visible names ("yy" by default) * yyclass - yyFlexLexer subclass to use for YY_DECL @@ -413,7 +418,7 @@ extern int datapos, dataline, linenum, out_linenum; extern FILE *skelfile, *yyin, *backing_up_file; extern const char *skel[]; extern int skel_ind; -extern char *infilename, *outfilename; +extern char *infilename, *outfilename, *headerfilename; extern int did_outfilename; extern char *prefix, *yyclass; extern int do_stdinit, use_stdout; @@ -1022,3 +1027,27 @@ extern void stack1 PROTO((int, int, int, int)); /* from file yylex.c */ extern int yylex PROTO((void)); + +/* A growable array. See buf.c. */ +struct Buf { + void * elts; /* elements. */ + int nelts; /* number of elements. */ + size_t elt_size; /* in bytes. */ + int nmax; /* max capacity of elements. */ +}; + +extern void buf_init PROTO((struct Buf* buf, size_t elem_size)); +extern void buf_destroy PROTO((struct Buf* buf)); +extern struct Buf* buf_append PROTO((struct Buf* buf, const void* ptr, int n_elem)); +extern struct Buf* buf_strappend PROTO((struct Buf*, const char* str)); +extern struct Buf* buf_strnappend PROTO((struct Buf*, const char* str, int nchars)); +extern struct Buf* buf_strdefine PROTO((struct Buf* buf, const char* str, const char* def)); + +/* buffer for #define's generated by user-options on cmd line. */ +extern struct Buf userdef_buf; + +/* For blocking out code from the header file. */ +#define OUT_BEGIN_CODE() out_str("#ifndef %sIN_HEADER\n",prefix) +#define OUT_END_CODE() out_str("#endif /* !%sIN_HEADER */\n",prefix); + +#endif /* not defined FLEXDEF_H */ |