diff options
author | Will Estes <wlestes@users.sourceforge.net> | 2003-03-25 16:39:08 +0000 |
---|---|---|
committer | Will Estes <wlestes@users.sourceforge.net> | 2003-03-25 16:39:08 +0000 |
commit | 2ea243b80a5a443c533e5f621b0d5a52790a97dc (patch) | |
tree | 143d0b83ae5384eee2a8751331d87a5804e71dfa /flexdef.h | |
parent | 7b2d2bd3f031a8c85feafb106cf9ddf0efe28698 (diff) |
merge millaway's m4 branch work
Diffstat (limited to 'flexdef.h')
-rw-r--r-- | flexdef.h | 61 |
1 files changed, 58 insertions, 3 deletions
@@ -42,9 +42,11 @@ #ifdef STDC_HEADERS #include <stdio.h> #include <stdlib.h> +#include <stdarg.h> #include <setjmp.h> #include <ctype.h> #include <string.h> +#include <math.h> #endif #ifdef HAVE_LIMITS_H #include <limits.h> @@ -54,6 +56,8 @@ #include <unistd.h> #endif +#include <regex.h> + /* We use gettext. So, when we write strings which should be translated, we mark them with _() */ #ifdef ENABLE_NLS #ifdef HAVE_LOCALE_H @@ -349,6 +353,7 @@ * otherwise, a standard C scanner * reentrant - if true (-R), generate a reentrant C scanner. * bison_bridge - if true (--bison-bridge), bison pure calling convention. + * bison_bridge_locations - if true (--bison-locations), bison yylloc. * long_align - if true (-Ca flag), favor long-word alignment. * use_read - if true (-f, -F, or -Cr) then use read() for scanner input; * otherwise, use fread(). @@ -375,7 +380,8 @@ extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, extern int interactive, caseins, lex_compat, posix_compat, do_yylineno; extern int useecs, fulltbl, usemecs, fullspd; extern int gen_line_dirs, performance_report, backing_up_report; -extern int reentrant, bison_bridge; +extern int reentrant, bison_bridge, bison_bridge_locations; +extern bool ansi_func_defs, ansi_func_protos; extern int C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap; extern int csize; extern int yymore_used, reject, real_reject, continued_action, in_rule; @@ -916,6 +922,7 @@ PROTO ((const char *, const char *, const char *, const char *)); extern void out_str_dec PROTO ((const char *, const char *, int)); extern void outc PROTO ((int)); extern void outn PROTO ((const char *)); +extern void out_m4_define (const char* def, const char* val); /* Return a printable version of the given character, which might be * 8-bit. @@ -1077,12 +1084,16 @@ 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_concat PROTO((struct Buf* dest, const struct Buf* src)); 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)); extern struct Buf *buf_prints PROTO((struct Buf *buf, const char *fmt, const char* s)); +extern struct Buf *buf_m4_define PROTO((struct Buf *buf, const char* def, const char* val)); +extern struct Buf *buf_m4_undefine PROTO((struct Buf *buf, const char* def)); +extern struct Buf *buf_print_strings PROTO((struct Buf * buf, FILE* out)); /* a string buffer for #define's generated by user-options on cmd line. */ extern struct Buf userdef_buf; @@ -1093,9 +1104,12 @@ extern struct Buf defs_buf; /* a string buffer to hold yydmap elements */ extern struct Buf yydmap_buf; +/* Holds m4 definitions. */ +extern struct Buf m4defs_buf; + /* For blocking out code from the header file. */ -#define OUT_BEGIN_CODE() out_str("#ifndef %sIN_HEADER /* YY-DISCARD-FROM-HEADER */\n",prefix) -#define OUT_END_CODE() out_str("#endif /* !%sIN_HEADER YY-END-DISCARD-FROM-HEADER */\n",prefix); +#define OUT_BEGIN_CODE() outn("m4_ifdef( [[M4_YY_IN_HEADER]],,[[") +#define OUT_END_CODE() outn("]])") /* For setjmp/longjmp (instead of calling exit(2)). Linkage in main.c */ extern jmp_buf flex_main_jmp_buf; @@ -1129,4 +1143,45 @@ int reverse_case(int c); /* return false if [c1-c2] is ambiguous for a caseless scanner. */ bool range_covers_case (int c1, int c2); +/* + * From "filter.c" + */ + +/** A single stdio filter to execute. + * The filter may be external, such as "sed", or it + * may be internal, as a function call. + */ +struct filter { + int (*filter_func)(struct filter*); /**< internal filter function */ + void * extra; /**< extra data passed to filter_func */ + int argc; /**< arg count */ + const char ** argv; /**< arg vector, \0-terminated */ + struct filter * next; /**< next filter or NULL */ +}; + +/* output filter chain */ +extern struct filter * output_chain; +extern struct filter *filter_create_ext PROTO((struct filter * chain, const char *cmd, ...)); +struct filter *filter_create_int PROTO((struct filter *chain, + int (*filter_func) (struct filter *), + void *extra)); +extern bool filter_apply_chain PROTO((struct filter * chain)); +extern int filter_truncate (struct filter * chain, int max_len); +extern int filter_tee_header PROTO((struct filter *chain)); +extern int filter_fix_linedirs PROTO((struct filter *chain)); + + +/* + * From "regex.c" + */ + +extern regex_t regex_linedir, regex_blank_line; +bool flex_init_regex(void); +void flex_regcomp(regex_t *preg, const char *regex, int cflags); +char *regmatch_dup (regmatch_t * m, const char *src); +char *regmatch_cpy (regmatch_t * m, char *dest, const char *src); +int regmatch_len (regmatch_t * m); +int regmatch_strtol (regmatch_t * m, const char *src, char **endptr, int base); +bool regmatch_empty (regmatch_t * m); + #endif /* not defined FLEXDEF_H */ |