summaryrefslogtreecommitdiff
path: root/src/flexdef.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/flexdef.h')
-rw-r--r--src/flexdef.h41
1 files changed, 18 insertions, 23 deletions
diff --git a/src/flexdef.h b/src/flexdef.h
index 27ad610..a48c64d 100644
--- a/src/flexdef.h
+++ b/src/flexdef.h
@@ -44,7 +44,6 @@
#include <stdarg.h>
#include <setjmp.h>
#include <ctype.h>
-#include <libgen.h> /* for XPG version of basename(3) */
#include <string.h>
#include <math.h>
@@ -57,27 +56,30 @@
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
-#ifdef HAVE_UNISTD_H
+/* Required: dup() and dup2() in <unistd.h> */
#include <unistd.h>
-#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_SYS_PARAMS_H
#include <sys/params.h>
#endif
-#ifdef HAVE_SYS_STAT_H
+/* Required: stat() in <sys/stat.h> */
#include <sys/stat.h>
-#endif
+/* Required: wait() in <sys/wait.h> */
#include <sys/wait.h>
#include <stdbool.h>
-#ifdef HAVE_REGEX_H
+#include <stdarg.h>
+/* Required: regcomp(), regexec() and regerror() in <regex.h> */
#include <regex.h>
-#endif
+/* Required: strcasecmp() in <strings.h> */
+#include <strings.h>
#include "flexint.h"
-/* We use gettext. So, when we write strings which should be translated, we mark them with _() */
-#ifdef ENABLE_NLS
+/* We use gettext. So, when we write strings which should be translated, we
+ * mark them with _()
+ */
+#if defined(ENABLE_NLS) && ENABLE_NLS
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif /* HAVE_LOCALE_H */
@@ -108,6 +110,8 @@
#define ABS(x) ((x) < 0 ? -(x) : (x))
#endif
+/* Whether an integer is a power of two */
+#define is_power_of_2(n) ((n) > 0 && ((n) & ((n) - 1)) == 0)
#define unspecified -1
@@ -358,7 +362,6 @@ extern int interactive, 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_lval, bison_bridge_lloc;
-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;
@@ -629,10 +632,6 @@ extern int sectnum, nummt, hshcol, dfaeql, numeps, eps2, num_reallocs;
extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
extern int num_backing_up, bol_needed;
-#ifndef HAVE_REALLOCARRAY
-void *reallocarray(void *, size_t, size_t);
-#endif
-
void *allocate_array(int, size_t);
void *reallocate_array(void *, int, size_t);
@@ -843,9 +842,6 @@ extern void flexfatal(const char *);
}while(0)
#endif /* ! HAVE_DECL___func__ */
-/* Convert a hexadecimal digit string to an integer value. */
-extern int htoi(unsigned char[]);
-
/* Report an error message formatted */
extern void lerr(const char *, ...)
#if defined(__GNUC__) && __GNUC__ >= 3
@@ -882,9 +878,6 @@ extern int myctoi(const char *);
/* Return character corresponding to escape sequence. */
extern unsigned char myesc(unsigned char[]);
-/* Convert an octal digit string to an integer value. */
-extern int otoi(unsigned char[]);
-
/* Output a (possibly-formatted) string to the generated scanner. */
extern void out(const char *);
extern void out_dec(const char *, int);
@@ -975,8 +968,9 @@ extern void line_pinpoint(const char *, int);
extern void format_synerr(const char *, const char *);
extern void synerr(const char *); /* report a syntax error */
extern void format_warn(const char *, const char *);
-extern void warn(const char *); /* report a warning */
+extern void lwarn(const char *); /* report a warning */
extern void yyerror(const char *); /* report a parse error */
+extern int yyparse(void); /* the YACC parser */
/* from file scan.l */
@@ -1064,9 +1058,10 @@ extern struct Buf defs_buf; /* a char* buffer to save #define'd some symbols
extern struct Buf yydmap_buf; /* a string buffer to hold yydmap elements */
extern struct Buf m4defs_buf; /* Holds m4 definitions. */
extern struct Buf top_buf; /* contains %top code. String buffer. */
+extern bool no_section3_escape; /* True if the undocumented option --unsafe-no-m4-sect3-escape was passed */
/* For blocking out code from the header file. */
-#define OUT_BEGIN_CODE() outn("m4_ifdef( [[M4_YY_IN_HEADER]],,[[")
+#define OUT_BEGIN_CODE() outn("m4_ifdef( [[M4_YY_IN_HEADER]],,[[m4_dnl")
#define OUT_END_CODE() outn("]])")
/* For setjmp/longjmp (instead of calling exit(2)). Linkage in main.c */
@@ -1133,7 +1128,7 @@ extern int filter_fix_linedirs(struct filter *chain);
* From "regex.c"
*/
-extern regex_t regex_linedir, regex_blank_line;
+extern regex_t regex_linedir;
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);