version 1.8, 2015/10/10 05:47:54 |
version 1.9, 2015/11/19 19:43:40 |
|
|
|
|
/* flexdef - definitions file for flex */ |
/* flexdef - definitions file for flex */ |
|
|
/*- |
/* Copyright (c) 1990 The Regents of the University of California. */ |
* Copyright (c) 1990 The Regents of the University of California. |
/* All rights reserved. */ |
* All rights reserved. |
|
* |
|
* This code is derived from software contributed to Berkeley by |
|
* Vern Paxson. |
|
* |
|
* The United States Government has rights in this work pursuant |
|
* to contract no. DE-AC03-76SF00098 between the United States |
|
* Department of Energy and the University of California. |
|
* |
|
* Redistribution and use in source and binary forms, with or without |
|
* modification, are permitted provided that the following conditions |
|
* are met: |
|
* |
|
* 1. Redistributions of source code must retain the above copyright |
|
* notice, this list of conditions and the following disclaimer. |
|
* 2. Redistributions in binary form must reproduce the above copyright |
|
* notice, this list of conditions and the following disclaimer in the |
|
* documentation and/or other materials provided with the distribution. |
|
* |
|
* Neither the name of the University nor the names of its contributors |
|
* may be used to endorse or promote products derived from this software |
|
* without specific prior written permission. |
|
* |
|
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
* PURPOSE. |
|
*/ |
|
|
|
/* @(#) $Header$ (LBL) */ |
/* This code is derived from software contributed to Berkeley by */ |
|
/* Vern Paxson. */ |
|
|
#include <stdio.h> |
/* The United States Government has rights in this work pursuant */ |
#include <ctype.h> |
/* to contract no. DE-AC03-76SF00098 between the United States */ |
|
/* Department of Energy and the University of California. */ |
|
|
#include "config.h" |
/* This file is part of flex. */ |
|
|
#ifdef __TURBOC__ |
/* Redistribution and use in source and binary forms, with or without */ |
#define HAVE_STRING_H 1 |
/* modification, are permitted provided that the following conditions */ |
#define MS_DOS 1 |
/* are met: */ |
#ifndef __STDC__ |
|
#define __STDC__ 1 |
/* 1. Redistributions of source code must retain the above copyright */ |
|
/* notice, this list of conditions and the following disclaimer. */ |
|
/* 2. Redistributions in binary form must reproduce the above copyright */ |
|
/* notice, this list of conditions and the following disclaimer in the */ |
|
/* documentation and/or other materials provided with the distribution. */ |
|
|
|
/* Neither the name of the University nor the names of its contributors */ |
|
/* may be used to endorse or promote products derived from this software */ |
|
/* without specific prior written permission. */ |
|
|
|
/* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */ |
|
/* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */ |
|
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */ |
|
/* PURPOSE. */ |
|
|
|
#ifndef FLEXDEF_H |
|
#define FLEXDEF_H 1 |
|
|
|
#ifdef HAVE_CONFIG_H |
|
#include <config.h> |
#endif |
#endif |
#pragma warn -pro |
|
#pragma warn -rch |
/* AIX requires this to be the first thing in the file. */ |
#pragma warn -use |
#ifndef __GNUC__ |
#pragma warn -aus |
# if HAVE_ALLOCA_H |
#pragma warn -par |
# include <alloca.h> |
#pragma warn -pia |
# else |
|
# ifdef _AIX |
|
#pragma alloca |
|
# else |
|
# ifndef alloca /* predefined by HP cc +Olibcalls */ |
|
char *alloca (); |
|
# endif |
|
# endif |
|
# endif |
#endif |
#endif |
|
|
#ifdef HAVE_STRING_H |
#ifdef STDC_HEADERS |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
#include <stdarg.h> |
|
#include <setjmp.h> |
|
#include <ctype.h> |
#include <string.h> |
#include <string.h> |
|
#include <math.h> |
|
#endif |
|
#ifdef HAVE_ASSERT_H |
|
#include <assert.h> |
#else |
#else |
#include <strings.h> |
#define assert(Pred) |
#endif |
#endif |
|
|
#ifdef HAVE_SYS_TYPES_H |
#ifdef HAVE_LIMITS_H |
#include <sys/types.h> |
#include <limits.h> |
#endif |
#endif |
|
#ifdef HAVE_UNISTD_H |
#ifdef STDC_HEADERS |
|
#include <stdlib.h> |
|
#include <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_WAIT_H |
|
#include <sys/wait.h> |
|
#endif |
|
#ifdef HAVE_STDBOOL_H |
|
#include <stdbool.h> |
#else |
#else |
#ifdef HAVE_MALLOC_H |
#define bool int |
#include <malloc.h> |
#define true 1 |
|
#define false 0 |
#endif |
#endif |
|
#ifdef HAVE_REGEX_H |
|
#include <regex.h> |
#endif |
#endif |
|
#include "flexint.h" |
|
|
|
/* We use gettext. So, when we write strings which should be translated, we mark them with _() */ |
|
#ifdef ENABLE_NLS |
|
#ifdef HAVE_LOCALE_H |
|
#include <locale.h> |
|
#endif /* HAVE_LOCALE_H */ |
|
#include "gettext.h" |
|
#define _(String) gettext (String) |
|
#else |
|
#define _(STRING) STRING |
|
#endif /* ENABLE_NLS */ |
|
|
/* As an aid for the internationalization patch to flex, which |
|
* is maintained outside this distribution for copyright reasons. |
|
*/ |
|
#define _(String) (String) |
|
|
|
/* Always be prepared to generate an 8-bit scanner. */ |
/* Always be prepared to generate an 8-bit scanner. */ |
#define CSIZE 256 |
#define CSIZE 256 |
#define Char unsigned char |
#define Char unsigned char |
|
|
#endif |
#endif |
|
|
#ifndef PROTO |
#ifndef PROTO |
#ifdef __STDC__ |
#if defined(__STDC__) |
#define PROTO(proto) proto |
#define PROTO(proto) proto |
#else |
#else |
#define PROTO(proto) () |
#define PROTO(proto) () |
|
|
#define isascii(c) ((c) <= 0177) |
#define isascii(c) ((c) <= 0177) |
#endif |
#endif |
|
|
|
|
#define true 1 |
|
#define false 0 |
|
#define unspecified -1 |
#define unspecified -1 |
|
|
|
|
/* Special chk[] values marking the slots taking by end-of-buffer and action |
/* Special chk[] values marking the slots taking by end-of-buffer and action |
* numbers. |
* numbers. |
*/ |
*/ |
|
|
*/ |
*/ |
#define NIL 0 |
#define NIL 0 |
|
|
#define JAM -1 /* to mark a missing DFA transition */ |
#define JAM -1 /* to mark a missing DFA transition */ |
#define NO_TRANSITION NIL |
#define NO_TRANSITION NIL |
#define UNIQUE -1 /* marks a symbol as an e.c. representative */ |
#define UNIQUE -1 /* marks a symbol as an e.c. representative */ |
#define INFINITY -1 /* for x{5,} constructions */ |
#define INFINITE_REPEAT -1 /* for x{5,} constructions */ |
|
|
#define INITIAL_MAX_CCLS 100 /* max number of unique character classes */ |
#define INITIAL_MAX_CCLS 100 /* max number of unique character classes */ |
#define MAX_CCLS_INCREMENT 100 |
#define MAX_CCLS_INCREMENT 100 |
|
|
#define INITIAL_MAX_DFAS 1000 /* default maximum number of dfa states */ |
#define INITIAL_MAX_DFAS 1000 /* default maximum number of dfa states */ |
#define MAX_DFAS_INCREMENT 1000 |
#define MAX_DFAS_INCREMENT 1000 |
|
|
#define JAMSTATE -32766 /* marks a reference to the state that always jams */ |
#define JAMSTATE -32766 /* marks a reference to the state that always jams */ |
|
|
/* Maximum number of NFA states. */ |
/* Maximum number of NFA states. */ |
#define MAXIMUM_MNS 31999 |
#define MAXIMUM_MNS 31999 |
|
#define MAXIMUM_MNS_LONG 1999999999 |
|
|
/* Enough so that if it's subtracted from an NFA state number, the result |
/* Enough so that if it's subtracted from an NFA state number, the result |
* is guaranteed to be negative. |
* is guaranteed to be negative. |
*/ |
*/ |
#define MARKER_DIFFERENCE (MAXIMUM_MNS+2) |
#define MARKER_DIFFERENCE (maximum_mns+2) |
|
|
/* Maximum number of nxt/chk pairs for non-templates. */ |
/* Maximum number of nxt/chk pairs for non-templates. */ |
#define INITIAL_MAX_XPAIRS 2000 |
#define INITIAL_MAX_XPAIRS 2000 |
|
|
#define MAX_SCS_INCREMENT 40 /* amount to bump by if it's not enough */ |
#define MAX_SCS_INCREMENT 40 /* amount to bump by if it's not enough */ |
|
|
#define ONE_STACK_SIZE 500 /* stack of states with only one out-transition */ |
#define ONE_STACK_SIZE 500 /* stack of states with only one out-transition */ |
#define SAME_TRANS -1 /* transition is the same as "default" entry for state */ |
#define SAME_TRANS -1 /* transition is the same as "default" entry for state */ |
|
|
/* The following percentages are used to tune table compression: |
/* The following percentages are used to tune table compression: |
|
|
|
|
|
|
/* The percentage the number of homogeneous out-transitions of a state |
/* The percentage the number of homogeneous out-transitions of a state |
* must be of the number of total out-transitions of the state in order |
* must be of the number of total out-transitions of the state in order |
* that the state's transition table is first compared with a potential |
* that the state's transition table is first compared with a potential |
* template of the most common out-transition instead of with the first |
* template of the most common out-transition instead of with the first |
* proto in the proto queue. |
* proto in the proto queue. |
*/ |
*/ |
|
|
*/ |
*/ |
#define PROT_SAVE_SIZE 2000 |
#define PROT_SAVE_SIZE 2000 |
|
|
#define MSP 50 /* maximum number of saved protos (protos on the proto queue) */ |
#define MSP 50 /* maximum number of saved protos (protos on the proto queue) */ |
|
|
/* Maximum number of out-transitions a state can have that we'll rummage |
/* Maximum number of out-transitions a state can have that we'll rummage |
* around through the interior of the internal fast table looking for a |
* around through the interior of the internal fast table looking for a |
|
|
|
|
/* Declarations for global variables. */ |
/* Declarations for global variables. */ |
|
|
/* Variables for symbol tables: |
|
* sctbl - start-condition symbol table |
|
* ndtbl - name-definition symbol table |
|
* ccltab - character class text symbol table |
|
*/ |
|
|
|
struct hash_entry |
|
{ |
|
struct hash_entry *prev, *next; |
|
char *name; |
|
char *str_val; |
|
int int_val; |
|
} ; |
|
|
|
typedef struct hash_entry **hash_table; |
|
|
|
#define NAME_TABLE_HASH_SIZE 101 |
|
#define START_COND_HASH_SIZE 101 |
|
#define CCL_HASH_SIZE 101 |
|
|
|
extern struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE]; |
|
extern struct hash_entry *sctbl[START_COND_HASH_SIZE]; |
|
extern struct hash_entry *ccltab[CCL_HASH_SIZE]; |
|
|
|
|
|
/* Variables for flags: |
/* Variables for flags: |
* printstats - if true (-v), dump statistics |
* printstats - if true (-v), dump statistics |
* syntaxerror - true if a syntax error has been found |
* syntaxerror - true if a syntax error has been found |
|
|
* nowarn - if true (-w), do not generate warnings |
* nowarn - if true (-w), do not generate warnings |
* spprdflt - if true (-s), suppress the default rule |
* spprdflt - if true (-s), suppress the default rule |
* interactive - if true (-I), generate an interactive scanner |
* interactive - if true (-I), generate an interactive scanner |
* caseins - if true (-i), generate a case-insensitive scanner |
|
* lex_compat - if true (-l), maximize compatibility with AT&T lex |
* lex_compat - if true (-l), maximize compatibility with AT&T lex |
|
* posix_compat - if true (-X), maximize compatibility with POSIX lex |
* do_yylineno - if true, generate code to maintain yylineno |
* do_yylineno - if true, generate code to maintain yylineno |
* useecs - if true (-Ce flag), use equivalence classes |
* useecs - if true (-Ce flag), use equivalence classes |
* fulltbl - if true (-Cf flag), don't compress the DFA state table |
* fulltbl - if true (-Cf flag), don't compress the DFA state table |
|
|
* listing backing-up states |
* listing backing-up states |
* C_plus_plus - if true (i.e., -+ flag), generate a C++ scanner class; |
* C_plus_plus - if true (i.e., -+ flag), generate a C++ scanner class; |
* otherwise, a standard C scanner |
* otherwise, a standard C scanner |
|
* reentrant - if true (-R), generate a reentrant C scanner. |
|
* bison_bridge_lval - if true (--bison-bridge), bison pure calling convention. |
|
* bison_bridge_lloc - if true (--bison-locations), bison yylloc. |
* long_align - if true (-Ca flag), favor long-word alignment. |
* long_align - if true (-Ca flag), favor long-word alignment. |
* use_read - if true (-f, -F, or -Cr) then use read() for scanner input; |
* use_read - if true (-f, -F, or -Cr) then use read() for scanner input; |
* otherwise, use fread(). |
* otherwise, use fread(). |
|
|
* reject_really_used - same for REJECT |
* reject_really_used - same for REJECT |
*/ |
*/ |
|
|
extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, spprdflt; |
extern int printstats, syntaxerror, eofseen, ddebug, trace, nowarn, |
extern int interactive, caseins, lex_compat, do_yylineno; |
spprdflt; |
|
extern int interactive, lex_compat, posix_compat, do_yylineno; |
extern int useecs, fulltbl, usemecs, fullspd; |
extern int useecs, fulltbl, usemecs, fullspd; |
extern int gen_line_dirs, performance_report, backing_up_report; |
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 C_plus_plus, long_align, use_read, yytext_is_array, do_yywrap; |
extern int csize; |
extern int csize; |
extern int yymore_used, reject, real_reject, continued_action, in_rule; |
extern int yymore_used, reject, real_reject, continued_action, in_rule; |
|
|
* dataline - number of contiguous lines of data in current data |
* dataline - number of contiguous lines of data in current data |
* statement. Used to generate readable -f output |
* statement. Used to generate readable -f output |
* linenum - current input line number |
* linenum - current input line number |
* out_linenum - current output line number |
|
* skelfile - the skeleton file |
* skelfile - the skeleton file |
* skel - compiled-in skeleton array |
* skel - compiled-in skeleton array |
* skel_ind - index into "skel" array, if skelfile is nil |
* skel_ind - index into "skel" array, if skelfile is nil |
|
|
* backing_up_file - file to summarize backing-up states to |
* backing_up_file - file to summarize backing-up states to |
* infilename - name of input file |
* infilename - name of input file |
* outfilename - name of output file |
* outfilename - name of output file |
|
* headerfilename - name of the .h file to generate |
* did_outfilename - whether outfilename was explicitly set |
* did_outfilename - whether outfilename was explicitly set |
* prefix - the prefix used for externally visible names ("yy" by default) |
* prefix - the prefix used for externally visible names ("yy" by default) |
* yyclass - yyFlexLexer subclass to use for YY_DECL |
* yyclass - yyFlexLexer subclass to use for YY_DECL |
|
|
* use_stdout - the -t flag |
* use_stdout - the -t flag |
* input_files - array holding names of input files |
* input_files - array holding names of input files |
* num_input_files - size of input_files array |
* num_input_files - size of input_files array |
* program_name - name with which program was invoked |
* program_name - name with which program was invoked |
* |
* |
* action_array - array to hold the rule actions |
* action_array - array to hold the rule actions |
* action_size - size of action_array |
* action_size - size of action_array |
|
|
* to "action_array" |
* to "action_array" |
*/ |
*/ |
|
|
extern int datapos, dataline, linenum, out_linenum; |
extern int datapos, dataline, linenum; |
extern FILE *skelfile, *yyin, *backing_up_file; |
extern FILE *skelfile, *yyin, *backing_up_file; |
extern const char *skel[]; |
extern const char *skel[]; |
extern int skel_ind; |
extern int skel_ind; |
extern char *infilename, *outfilename; |
extern char *infilename, *outfilename, *headerfilename; |
extern int did_outfilename; |
extern int did_outfilename; |
extern char *prefix, *yyclass; |
extern char *prefix, *yyclass, *extra_type; |
extern int do_stdinit, use_stdout; |
extern int do_stdinit, use_stdout; |
extern char **input_files; |
extern char **input_files; |
extern int num_input_files; |
extern int num_input_files; |
|
|
|
|
|
|
/* Variables for nfa machine data: |
/* Variables for nfa machine data: |
|
* maximum_mns - maximal number of NFA states supported by tables |
* current_mns - current maximum on number of NFA states |
* current_mns - current maximum on number of NFA states |
* num_rules - number of the last accepting state; also is number of |
* num_rules - number of the last accepting state; also is number of |
* rules created so far |
* rules created so far |
|
|
* context |
* context |
* rule_linenum - line number associated with rule |
* rule_linenum - line number associated with rule |
* rule_useful - true if we've determined that the rule can be matched |
* rule_useful - true if we've determined that the rule can be matched |
|
* rule_has_nl - true if rule could possibly match a newline |
|
* ccl_has_nl - true if current ccl could match a newline |
|
* nlch - default eol char |
*/ |
*/ |
|
|
extern int current_mns, current_max_rules; |
extern int maximum_mns, current_mns, current_max_rules; |
extern int num_rules, num_eof_rules, default_rule, lastnfa; |
extern int num_rules, num_eof_rules, default_rule, lastnfa; |
extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2; |
extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2; |
extern int *accptnum, *assoc_rule, *state_type; |
extern int *accptnum, *assoc_rule, *state_type; |
extern int *rule_type, *rule_linenum, *rule_useful; |
extern int *rule_type, *rule_linenum, *rule_useful; |
|
extern bool *rule_has_nl, *ccl_has_nl; |
|
extern int nlch; |
|
|
/* Different types of states; values are useful as masks, as well, for |
/* Different types of states; values are useful as masks, as well, for |
* routines like check_trailing_context(). |
* routines like check_trailing_context(). |
|
|
extern int current_max_dfa_size, current_max_xpairs; |
extern int current_max_dfa_size, current_max_xpairs; |
extern int current_max_template_xpairs, current_max_dfas; |
extern int current_max_template_xpairs, current_max_dfas; |
extern int lastdfa, *nxt, *chk, *tnxt; |
extern int lastdfa, *nxt, *chk, *tnxt; |
extern int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss, *dfasiz; |
extern int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss, |
extern union dfaacc_union |
*dfasiz; |
{ |
extern union dfaacc_union { |
int *dfaacc_set; |
int *dfaacc_set; |
int dfaacc_state; |
int dfaacc_state; |
} *dfaacc; |
} *dfaacc; |
extern int *accsiz, *dhash, numas; |
extern int *accsiz, *dhash, numas; |
extern int numsnpairs, jambase, jamstate; |
extern int numsnpairs, jambase, jamstate; |
extern int end_of_buffer_state; |
extern int end_of_buffer_state; |
|
|
extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave; |
extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave; |
extern int num_backing_up, bol_needed; |
extern int num_backing_up, bol_needed; |
|
|
void *allocate_array PROTO((int, size_t)); |
void *allocate_array PROTO ((int, size_t)); |
void *reallocate_array PROTO((void*, int, size_t)); |
void *reallocate_array PROTO ((void *, int, size_t)); |
|
|
void *flex_alloc PROTO((size_t)); |
void *flex_alloc PROTO ((size_t)); |
void *flex_realloc PROTO((void*, size_t)); |
void *flex_realloc PROTO ((void *, size_t)); |
void flex_free PROTO((void*)); |
void flex_free PROTO ((void *)); |
|
|
#define allocate_integer_array(size) \ |
#define allocate_integer_array(size) \ |
(int *) allocate_array( size, sizeof( int ) ) |
(int *) allocate_array( size, sizeof( int ) ) |
|
|
#define reallocate_integer_array(array,size) \ |
#define reallocate_integer_array(array,size) \ |
(int *) reallocate_array( (void *) array, size, sizeof( int ) ) |
(int *) reallocate_array( (void *) array, size, sizeof( int ) ) |
|
|
|
#define allocate_bool_array(size) \ |
|
(bool *) allocate_array( size, sizeof( bool ) ) |
|
|
|
#define reallocate_bool_array(array,size) \ |
|
(bool *) reallocate_array( (void *) array, size, sizeof( bool ) ) |
|
|
#define allocate_int_ptr_array(size) \ |
#define allocate_int_ptr_array(size) \ |
(int **) allocate_array( size, sizeof( int * ) ) |
(int **) allocate_array( size, sizeof( int * ) ) |
|
|
|
|
|
|
/* from file ccl.c */ |
/* from file ccl.c */ |
|
|
extern void ccladd PROTO((int, int)); /* add a single character to a ccl */ |
extern void ccladd PROTO ((int, int)); /* add a single character to a ccl */ |
extern int cclinit PROTO((void)); /* make an empty ccl */ |
extern int cclinit PROTO ((void)); /* make an empty ccl */ |
extern void cclnegate PROTO((int)); /* negate a ccl */ |
extern void cclnegate PROTO ((int)); /* negate a ccl */ |
|
extern int ccl_set_diff (int a, int b); /* set difference of two ccls. */ |
|
extern int ccl_set_union (int a, int b); /* set union of two ccls. */ |
|
|
/* List the members of a set of characters in CCL form. */ |
/* List the members of a set of characters in CCL form. */ |
extern void list_character_set PROTO((FILE*, int[])); |
extern void list_character_set PROTO ((FILE *, int[])); |
|
|
|
|
/* from file dfa.c */ |
/* from file dfa.c */ |
|
|
/* Check a DFA state for backing up. */ |
/* Check a DFA state for backing up. */ |
extern void check_for_backing_up PROTO((int, int[])); |
extern void check_for_backing_up PROTO ((int, int[])); |
|
|
/* Check to see if NFA state set constitutes "dangerous" trailing context. */ |
/* Check to see if NFA state set constitutes "dangerous" trailing context. */ |
extern void check_trailing_context PROTO((int*, int, int*, int)); |
extern void check_trailing_context PROTO ((int *, int, int *, int)); |
|
|
/* Construct the epsilon closure of a set of ndfa states. */ |
/* Construct the epsilon closure of a set of ndfa states. */ |
extern int *epsclosure PROTO((int*, int*, int[], int*, int*)); |
extern int *epsclosure PROTO ((int *, int *, int[], int *, int *)); |
|
|
/* Increase the maximum number of dfas. */ |
/* Increase the maximum number of dfas. */ |
extern void increase_max_dfas PROTO((void)); |
extern void increase_max_dfas PROTO ((void)); |
|
|
extern void ntod PROTO((void)); /* convert a ndfa to a dfa */ |
extern void ntod PROTO ((void)); /* convert a ndfa to a dfa */ |
|
|
/* Converts a set of ndfa states into a dfa state. */ |
/* Converts a set of ndfa states into a dfa state. */ |
extern int snstods PROTO((int[], int, int[], int, int, int*)); |
extern int snstods PROTO ((int[], int, int[], int, int, int *)); |
|
|
|
|
/* from file ecs.c */ |
/* from file ecs.c */ |
|
|
/* Convert character classes to set of equivalence classes. */ |
/* Convert character classes to set of equivalence classes. */ |
extern void ccl2ecl PROTO((void)); |
extern void ccl2ecl PROTO ((void)); |
|
|
/* Associate equivalence class numbers with class members. */ |
/* Associate equivalence class numbers with class members. */ |
extern int cre8ecs PROTO((int[], int[], int)); |
extern int cre8ecs PROTO ((int[], int[], int)); |
|
|
/* Update equivalence classes based on character class transitions. */ |
/* Update equivalence classes based on character class transitions. */ |
extern void mkeccl PROTO((Char[], int, int[], int[], int, int)); |
extern void mkeccl PROTO ((Char[], int, int[], int[], int, int)); |
|
|
/* Create equivalence class for single character. */ |
/* Create equivalence class for single character. */ |
extern void mkechar PROTO((int, int[], int[])); |
extern void mkechar PROTO ((int, int[], int[])); |
|
|
|
|
/* from file gen.c */ |
/* from file gen.c */ |
|
|
extern void do_indent PROTO((void)); /* indent to the current level */ |
extern void do_indent PROTO ((void)); /* indent to the current level */ |
|
|
/* Generate the code to keep backing-up information. */ |
/* Generate the code to keep backing-up information. */ |
extern void gen_backing_up PROTO((void)); |
extern void gen_backing_up PROTO ((void)); |
|
|
/* Generate the code to perform the backing up. */ |
/* Generate the code to perform the backing up. */ |
extern void gen_bu_action PROTO((void)); |
extern void gen_bu_action PROTO ((void)); |
|
|
/* Generate full speed compressed transition table. */ |
/* Generate full speed compressed transition table. */ |
extern void genctbl PROTO((void)); |
extern void genctbl PROTO ((void)); |
|
|
/* Generate the code to find the action number. */ |
/* Generate the code to find the action number. */ |
extern void gen_find_action PROTO((void)); |
extern void gen_find_action PROTO ((void)); |
|
|
extern void genftbl PROTO((void)); /* generate full transition table */ |
extern void genftbl PROTO ((void)); /* generate full transition table */ |
|
|
/* Generate the code to find the next compressed-table state. */ |
/* Generate the code to find the next compressed-table state. */ |
extern void gen_next_compressed_state PROTO((char*)); |
extern void gen_next_compressed_state PROTO ((char *)); |
|
|
/* Generate the code to find the next match. */ |
/* Generate the code to find the next match. */ |
extern void gen_next_match PROTO((void)); |
extern void gen_next_match PROTO ((void)); |
|
|
/* Generate the code to find the next state. */ |
/* Generate the code to find the next state. */ |
extern void gen_next_state PROTO((int)); |
extern void gen_next_state PROTO ((int)); |
|
|
/* Generate the code to make a NUL transition. */ |
/* Generate the code to make a NUL transition. */ |
extern void gen_NUL_trans PROTO((void)); |
extern void gen_NUL_trans PROTO ((void)); |
|
|
/* Generate the code to find the start state. */ |
/* Generate the code to find the start state. */ |
extern void gen_start_state PROTO((void)); |
extern void gen_start_state PROTO ((void)); |
|
|
/* Generate data statements for the transition tables. */ |
/* Generate data statements for the transition tables. */ |
extern void gentabs PROTO((void)); |
extern void gentabs PROTO ((void)); |
|
|
/* Write out a formatted string at the current indentation level. */ |
/* Write out a formatted string at the current indentation level. */ |
extern void indent_put2s PROTO((char[], char[])); |
extern void indent_put2s PROTO ((const char *, const char *)); |
|
|
/* Write out a string + newline at the current indentation level. */ |
/* Write out a string + newline at the current indentation level. */ |
extern void indent_puts PROTO((char[])); |
extern void indent_puts PROTO ((const char *)); |
|
|
extern void make_tables PROTO((void)); /* generate transition tables */ |
extern void make_tables PROTO ((void)); /* generate transition tables */ |
|
|
|
|
/* from file main.c */ |
/* from file main.c */ |
|
|
extern void check_options PROTO((void)); |
extern void check_options PROTO ((void)); |
extern void flexend PROTO((int)); |
extern void flexend PROTO ((int)); |
extern void usage PROTO((void)); |
extern void usage PROTO ((void)); |
|
|
|
|
/* from file misc.c */ |
/* from file misc.c */ |
|
|
/* Add a #define to the action file. */ |
/* Add a #define to the action file. */ |
extern void action_define PROTO(( char *defname, int value )); |
extern void action_define PROTO ((const char *defname, int value)); |
|
|
/* Add the given text to the stored actions. */ |
/* Add the given text to the stored actions. */ |
extern void add_action PROTO(( char *new_text )); |
extern void add_action PROTO ((const char *new_text)); |
|
|
/* True if a string is all lower case. */ |
/* True if a string is all lower case. */ |
extern int all_lower PROTO((register char *)); |
extern int all_lower PROTO ((char *)); |
|
|
/* True if a string is all upper case. */ |
/* True if a string is all upper case. */ |
extern int all_upper PROTO((register char *)); |
extern int all_upper PROTO ((char *)); |
|
|
/* Bubble sort an integer array. */ |
/* Compare two integers for use by qsort. */ |
extern void bubble PROTO((int [], int)); |
extern int intcmp PROTO ((const void *, const void *)); |
|
|
/* Check a character to make sure it's in the expected range. */ |
/* Check a character to make sure it's in the expected range. */ |
extern void check_char PROTO((int c)); |
extern void check_char PROTO ((int c)); |
|
|
/* Replace upper-case letter to lower-case. */ |
/* Replace upper-case letter to lower-case. */ |
extern Char clower PROTO((int)); |
extern Char clower PROTO ((int)); |
|
|
/* Returns a dynamically allocated copy of a string. */ |
/* Returns a dynamically allocated copy of a string. */ |
extern char *copy_string PROTO((register const char *)); |
extern char *copy_string PROTO ((const char *)); |
|
|
/* Returns a dynamically allocated copy of a (potentially) unsigned string. */ |
/* Returns a dynamically allocated copy of a (potentially) unsigned string. */ |
extern Char *copy_unsigned_string PROTO((register Char *)); |
extern Char *copy_unsigned_string PROTO ((Char *)); |
|
|
/* Shell sort a character array. */ |
/* Compare two characters for use by qsort with '\0' sorting last. */ |
extern void cshell PROTO((Char [], int, int)); |
extern int cclcmp PROTO ((const void *, const void *)); |
|
|
/* Finish up a block of data declarations. */ |
/* Finish up a block of data declarations. */ |
extern void dataend PROTO((void)); |
extern void dataend PROTO ((void)); |
|
|
/* Flush generated data statements. */ |
/* Flush generated data statements. */ |
extern void dataflush PROTO((void)); |
extern void dataflush PROTO ((void)); |
|
|
/* Report an error message and terminate. */ |
/* Report an error message and terminate. */ |
extern void flexerror PROTO((const char[])); |
extern void flexerror PROTO ((const char *)); |
|
|
/* Report a fatal error message and terminate. */ |
/* Report a fatal error message and terminate. */ |
extern void flexfatal PROTO((const char[])); |
extern void flexfatal PROTO ((const char *)); |
|
|
|
/* Report a fatal error with a pinpoint, and terminate */ |
|
#if HAVE_DECL___FUNC__ |
|
#define flex_die(msg) \ |
|
do{ \ |
|
fprintf (stderr,\ |
|
_("%s: fatal internal error at %s:%d (%s): %s\n"),\ |
|
program_name, __FILE__, (int)__LINE__,\ |
|
__func__,msg);\ |
|
FLEX_EXIT(1);\ |
|
}while(0) |
|
#else /* ! HAVE_DECL___FUNC__ */ |
|
#define flex_die(msg) \ |
|
do{ \ |
|
fprintf (stderr,\ |
|
_("%s: fatal internal error at %s:%d %s\n"),\ |
|
program_name, __FILE__, (int)__LINE__,\ |
|
msg);\ |
|
FLEX_EXIT(1);\ |
|
}while(0) |
|
#endif /* ! HAVE_DECL___func__ */ |
|
|
/* Convert a hexadecimal digit string to an integer value. */ |
/* Convert a hexadecimal digit string to an integer value. */ |
extern int htoi PROTO((Char[])); |
extern int htoi PROTO ((Char[])); |
|
|
/* Report an error message formatted with one integer argument. */ |
/* Report an error message formatted with one integer argument. */ |
extern void lerrif PROTO((const char[], int)); |
extern void lerrif PROTO ((const char *, int)); |
|
|
/* Report an error message formatted with one string argument. */ |
/* Report an error message formatted with one string argument. */ |
extern void lerrsf PROTO((const char[], const char[])); |
extern void lerrsf PROTO ((const char *, const char *)); |
|
|
|
/* Like lerrsf, but also exit after displaying message. */ |
|
extern void lerrsf_fatal PROTO ((const char *, const char *)); |
|
|
/* Spit out a "#line" statement. */ |
/* Spit out a "#line" statement. */ |
extern void line_directive_out PROTO((FILE*, int)); |
extern void line_directive_out PROTO ((FILE *, int)); |
|
|
/* Mark the current position in the action array as the end of the section 1 |
/* Mark the current position in the action array as the end of the section 1 |
* user defs. |
* user defs. |
*/ |
*/ |
extern void mark_defs1 PROTO((void)); |
extern void mark_defs1 PROTO ((void)); |
|
|
/* Mark the current position in the action array as the end of the prolog. */ |
/* Mark the current position in the action array as the end of the prolog. */ |
extern void mark_prolog PROTO((void)); |
extern void mark_prolog PROTO ((void)); |
|
|
/* Generate a data statment for a two-dimensional array. */ |
/* Generate a data statment for a two-dimensional array. */ |
extern void mk2data PROTO((int)); |
extern void mk2data PROTO ((int)); |
|
|
extern void mkdata PROTO((int)); /* generate a data statement */ |
extern void mkdata PROTO ((int)); /* generate a data statement */ |
|
|
/* Return the integer represented by a string of digits. */ |
/* Return the integer represented by a string of digits. */ |
extern int myctoi PROTO((char [])); |
extern int myctoi PROTO ((const char *)); |
|
|
/* Return character corresponding to escape sequence. */ |
/* Return character corresponding to escape sequence. */ |
extern Char myesc PROTO((Char[])); |
extern Char myesc PROTO ((Char[])); |
|
|
/* Convert an octal digit string to an integer value. */ |
/* Convert an octal digit string to an integer value. */ |
extern int otoi PROTO((Char [] )); |
extern int otoi PROTO ((Char[])); |
|
|
/* Output a (possibly-formatted) string to the generated scanner. */ |
/* Output a (possibly-formatted) string to the generated scanner. */ |
extern void out PROTO((const char [])); |
extern void out PROTO ((const char *)); |
extern void out_dec PROTO((const char [], int)); |
extern void out_dec PROTO ((const char *, int)); |
extern void out_dec2 PROTO((const char [], int, int)); |
extern void out_dec2 PROTO ((const char *, int, int)); |
extern void out_hex PROTO((const char [], unsigned int)); |
extern void out_hex PROTO ((const char *, unsigned int)); |
extern void out_line_count PROTO((const char [])); |
extern void out_str PROTO ((const char *, const char *)); |
extern void out_str PROTO((const char [], const char [])); |
|
extern void out_str3 |
extern void out_str3 |
PROTO((const char [], const char [], const char [], const char [])); |
PROTO ((const char *, const char *, const char *, const char *)); |
extern void out_str_dec PROTO((const char [], const char [], int)); |
extern void out_str_dec PROTO ((const char *, const char *, int)); |
extern void outc PROTO((int)); |
extern void outc PROTO ((int)); |
extern void outn PROTO((const char [])); |
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 |
/* Return a printable version of the given character, which might be |
* 8-bit. |
* 8-bit. |
*/ |
*/ |
extern char *readable_form PROTO((int)); |
extern char *readable_form PROTO ((int)); |
|
|
/* Write out one section of the skeleton file. */ |
/* Write out one section of the skeleton file. */ |
extern void skelout PROTO((void)); |
extern void skelout PROTO ((void)); |
|
|
/* Output a yy_trans_info structure. */ |
/* Output a yy_trans_info structure. */ |
extern void transition_struct_out PROTO((int, int)); |
extern void transition_struct_out PROTO ((int, int)); |
|
|
/* Only needed when using certain broken versions of bison to build parse.c. */ |
/* Only needed when using certain broken versions of bison to build parse.c. */ |
extern void *yy_flex_xmalloc PROTO(( int )); |
extern void *yy_flex_xmalloc PROTO ((int)); |
|
|
/* Set a region of memory to 0. */ |
/* Set a region of memory to 0. */ |
extern void zero_out PROTO((char *, size_t)); |
extern void zero_out PROTO ((char *, size_t)); |
|
|
|
|
/* from file nfa.c */ |
/* from file nfa.c */ |
|
|
/* Add an accepting state to a machine. */ |
/* Add an accepting state to a machine. */ |
extern void add_accept PROTO((int, int)); |
extern void add_accept PROTO ((int, int)); |
|
|
/* Make a given number of copies of a singleton machine. */ |
/* Make a given number of copies of a singleton machine. */ |
extern int copysingl PROTO((int, int)); |
extern int copysingl PROTO ((int, int)); |
|
|
/* Debugging routine to write out an nfa. */ |
/* Debugging routine to write out an nfa. */ |
extern void dumpnfa PROTO((int)); |
extern void dumpnfa PROTO ((int)); |
|
|
/* Finish up the processing for a rule. */ |
/* Finish up the processing for a rule. */ |
extern void finish_rule PROTO((int, int, int, int)); |
extern void finish_rule PROTO ((int, int, int, int, int)); |
|
|
/* Connect two machines together. */ |
/* Connect two machines together. */ |
extern int link_machines PROTO((int, int)); |
extern int link_machines PROTO ((int, int)); |
|
|
/* Mark each "beginning" state in a machine as being a "normal" (i.e., |
/* Mark each "beginning" state in a machine as being a "normal" (i.e., |
* not trailing context associated) state. |
* not trailing context associated) state. |
*/ |
*/ |
extern void mark_beginning_as_normal PROTO((register int)); |
extern void mark_beginning_as_normal PROTO ((int)); |
|
|
/* Make a machine that branches to two machines. */ |
/* Make a machine that branches to two machines. */ |
extern int mkbranch PROTO((int, int)); |
extern int mkbranch PROTO ((int, int)); |
|
|
extern int mkclos PROTO((int)); /* convert a machine into a closure */ |
extern int mkclos PROTO ((int)); /* convert a machine into a closure */ |
extern int mkopt PROTO((int)); /* make a machine optional */ |
extern int mkopt PROTO ((int)); /* make a machine optional */ |
|
|
/* Make a machine that matches either one of two machines. */ |
/* Make a machine that matches either one of two machines. */ |
extern int mkor PROTO((int, int)); |
extern int mkor PROTO ((int, int)); |
|
|
/* Convert a machine into a positive closure. */ |
/* Convert a machine into a positive closure. */ |
extern int mkposcl PROTO((int)); |
extern int mkposcl PROTO ((int)); |
|
|
extern int mkrep PROTO((int, int, int)); /* make a replicated machine */ |
extern int mkrep PROTO ((int, int, int)); /* make a replicated machine */ |
|
|
/* Create a state with a transition on a given symbol. */ |
/* Create a state with a transition on a given symbol. */ |
extern int mkstate PROTO((int)); |
extern int mkstate PROTO ((int)); |
|
|
extern void new_rule PROTO((void)); /* initialize for a new rule */ |
extern void new_rule PROTO ((void)); /* initialize for a new rule */ |
|
|
|
|
/* from file parse.y */ |
/* from file parse.y */ |
|
|
/* Build the "<<EOF>>" action for the active start conditions. */ |
/* Build the "<<EOF>>" action for the active start conditions. */ |
extern void build_eof_action PROTO((void)); |
extern void build_eof_action PROTO ((void)); |
|
|
/* Write out a message formatted with one string, pinpointing its location. */ |
/* Write out a message formatted with one string, pinpointing its location. */ |
extern void format_pinpoint_message PROTO((char[], char[])); |
extern void format_pinpoint_message PROTO ((const char *, const char *)); |
|
|
/* Write out a message, pinpointing its location. */ |
/* Write out a message, pinpointing its location. */ |
extern void pinpoint_message PROTO((char[])); |
extern void pinpoint_message PROTO ((const char *)); |
|
|
/* Write out a warning, pinpointing it at the given line. */ |
/* Write out a warning, pinpointing it at the given line. */ |
extern void line_warning PROTO(( char[], int )); |
extern void line_warning PROTO ((const char *, int)); |
|
|
/* Write out a message, pinpointing it at the given line. */ |
/* Write out a message, pinpointing it at the given line. */ |
extern void line_pinpoint PROTO(( char[], int )); |
extern void line_pinpoint PROTO ((const char *, int)); |
|
|
/* Report a formatted syntax error. */ |
/* Report a formatted syntax error. */ |
extern void format_synerr PROTO((char [], char[])); |
extern void format_synerr PROTO ((const char *, const char *)); |
extern void synerr PROTO((char [])); /* report a syntax error */ |
extern void synerr PROTO ((const char *)); /* report a syntax error */ |
extern void format_warn PROTO((char [], char[])); |
extern void format_warn PROTO ((const char *, const char *)); |
extern void warn PROTO((char [])); /* report a warning */ |
extern void warn PROTO ((const char *)); /* report a warning */ |
extern void yyerror PROTO((char [])); /* report a parse error */ |
extern void yyerror PROTO ((const char *)); /* report a parse error */ |
extern int yyparse PROTO((void)); /* the YACC parser */ |
extern int yyparse PROTO ((void)); /* the YACC parser */ |
|
|
|
|
/* from file scan.l */ |
/* from file scan.l */ |
|
|
/* The Flex-generated scanner for flex. */ |
/* The Flex-generated scanner for flex. */ |
extern int flexscan PROTO((void)); |
extern int flexscan PROTO ((void)); |
|
|
/* Open the given file (if NULL, stdin) for scanning. */ |
/* Open the given file (if NULL, stdin) for scanning. */ |
extern void set_input_file PROTO((char*)); |
extern void set_input_file PROTO ((char *)); |
|
|
/* Wrapup a file in the lexical analyzer. */ |
/* Wrapup a file in the lexical analyzer. */ |
extern int yywrap PROTO((void)); |
extern int yywrap PROTO ((void)); |
|
|
|
|
/* from file sym.c */ |
/* from file sym.c */ |
|
|
/* Add symbol and definitions to symbol table. */ |
|
extern int addsym PROTO((register char[], char*, int, hash_table, int)); |
|
|
|
/* Save the text of a character class. */ |
/* Save the text of a character class. */ |
extern void cclinstal PROTO ((Char [], int)); |
extern void cclinstal PROTO ((Char[], int)); |
|
|
/* Lookup the number associated with character class. */ |
/* Lookup the number associated with character class. */ |
extern int ccllookup PROTO((Char [])); |
extern int ccllookup PROTO ((Char[])); |
|
|
/* Find symbol in symbol table. */ |
extern void ndinstal PROTO ((const char *, Char[])); /* install a name definition */ |
extern struct hash_entry *findsym PROTO((register char[], hash_table, int )); |
extern Char *ndlookup PROTO ((const char *)); /* lookup a name definition */ |
|
|
extern void ndinstal PROTO((char[], Char[])); /* install a name definition */ |
|
extern Char *ndlookup PROTO((char[])); /* lookup a name definition */ |
|
|
|
/* Increase maximum number of SC's. */ |
/* Increase maximum number of SC's. */ |
extern void scextend PROTO((void)); |
extern void scextend PROTO ((void)); |
extern void scinstal PROTO((char[], int)); /* make a start condition */ |
extern void scinstal PROTO ((const char *, int)); /* make a start condition */ |
|
|
/* Lookup the number associated with a start condition. */ |
/* Lookup the number associated with a start condition. */ |
extern int sclookup PROTO((char[])); |
extern int sclookup PROTO ((const char *)); |
|
|
|
|
/* from file tblcmp.c */ |
/* from file tblcmp.c */ |
|
|
/* Build table entries for dfa state. */ |
/* Build table entries for dfa state. */ |
extern void bldtbl PROTO((int[], int, int, int, int)); |
extern void bldtbl PROTO ((int[], int, int, int, int)); |
|
|
extern void cmptmps PROTO((void)); /* compress template table entries */ |
extern void cmptmps PROTO ((void)); /* compress template table entries */ |
extern void expand_nxt_chk PROTO((void)); /* increase nxt/chk arrays */ |
extern void expand_nxt_chk PROTO ((void)); /* increase nxt/chk arrays */ |
|
|
/* Finds a space in the table for a state to be placed. */ |
/* Finds a space in the table for a state to be placed. */ |
extern int find_table_space PROTO((int*, int)); |
extern int find_table_space PROTO ((int *, int)); |
extern void inittbl PROTO((void)); /* initialize transition tables */ |
extern void inittbl PROTO ((void)); /* initialize transition tables */ |
|
|
/* Make the default, "jam" table entries. */ |
/* Make the default, "jam" table entries. */ |
extern void mkdeftbl PROTO((void)); |
extern void mkdeftbl PROTO ((void)); |
|
|
/* Create table entries for a state (or state fragment) which has |
/* Create table entries for a state (or state fragment) which has |
* only one out-transition. |
* only one out-transition. |
*/ |
*/ |
extern void mk1tbl PROTO((int, int, int, int)); |
extern void mk1tbl PROTO ((int, int, int, int)); |
|
|
/* Place a state into full speed transition table. */ |
/* Place a state into full speed transition table. */ |
extern void place_state PROTO((int*, int, int)); |
extern void place_state PROTO ((int *, int, int)); |
|
|
/* Save states with only one out-transition to be processed later. */ |
/* Save states with only one out-transition to be processed later. */ |
extern void stack1 PROTO((int, int, int, int)); |
extern void stack1 PROTO ((int, int, int, int)); |
|
|
|
|
/* from file yylex.c */ |
/* from file yylex.c */ |
|
|
extern int yylex PROTO((void)); |
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_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)); |
|
extern struct Buf *buf_linedir PROTO((struct Buf *buf, const char* filename, int lineno)); |
|
|
|
extern struct Buf userdef_buf; /* a string buffer for #define's generated by user-options on cmd line. */ |
|
extern struct Buf defs_buf; /* a char* buffer to save #define'd some symbols generated by flex. */ |
|
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. */ |
|
|
|
/* For blocking out code from the header file. */ |
|
#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; |
|
|
|
#define FLEX_EXIT(status) longjmp(flex_main_jmp_buf,(status)+1) |
|
|
|
/* Removes all \n and \r chars from tail of str. returns str. */ |
|
extern char *chomp (char *str); |
|
|
|
/* ctype functions forced to return boolean */ |
|
#define b_isalnum(c) (isalnum(c)?true:false) |
|
#define b_isalpha(c) (isalpha(c)?true:false) |
|
#define b_isascii(c) (isascii(c)?true:false) |
|
#define b_isblank(c) (isblank(c)?true:false) |
|
#define b_iscntrl(c) (iscntrl(c)?true:false) |
|
#define b_isdigit(c) (isdigit(c)?true:false) |
|
#define b_isgraph(c) (isgraph(c)?true:false) |
|
#define b_islower(c) (islower(c)?true:false) |
|
#define b_isprint(c) (isprint(c)?true:false) |
|
#define b_ispunct(c) (ispunct(c)?true:false) |
|
#define b_isspace(c) (isspace(c)?true:false) |
|
#define b_isupper(c) (isupper(c)?true:false) |
|
#define b_isxdigit(c) (isxdigit(c)?true:false) |
|
|
|
/* return true if char is uppercase or lowercase. */ |
|
bool has_case(int c); |
|
|
|
/* Change case of character if possible. */ |
|
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); |
|
|
|
/* From "scanflags.h" */ |
|
typedef unsigned int scanflags_t; |
|
extern scanflags_t* _sf_stk; |
|
extern size_t _sf_top_ix, _sf_max; /**< stack of scanner flags. */ |
|
#define _SF_CASE_INS 0x0001 |
|
#define _SF_DOT_ALL 0x0002 |
|
#define _SF_SKIP_WS 0x0004 |
|
#define sf_top() (_sf_stk[_sf_top_ix]) |
|
#define sf_case_ins() (sf_top() & _SF_CASE_INS) |
|
#define sf_dot_all() (sf_top() & _SF_DOT_ALL) |
|
#define sf_skip_ws() (sf_top() & _SF_SKIP_WS) |
|
#define sf_set_case_ins(X) ((X) ? (sf_top() |= _SF_CASE_INS) : (sf_top() &= ~_SF_CASE_INS)) |
|
#define sf_set_dot_all(X) ((X) ? (sf_top() |= _SF_DOT_ALL) : (sf_top() &= ~_SF_DOT_ALL)) |
|
#define sf_set_skip_ws(X) ((X) ? (sf_top() |= _SF_SKIP_WS) : (sf_top() &= ~_SF_SKIP_WS)) |
|
extern void sf_init(void); |
|
extern void sf_push(void); |
|
extern void sf_pop(void); |
|
|
|
|
|
#endif /* not defined FLEXDEF_H */ |