This is Unofficial EPICS BASE Doxygen Site
flexdef.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2002 The University of Chicago, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 /* flexdef - definitions file for flex */
10 
11 /*-
12  * Copyright (c) 1990 The Regents of the University of California.
13  * All rights reserved.
14  *
15  * This code is derived from software contributed to Berkeley by
16  * Vern Paxson.
17  *
18  * The United States Government has rights in this work pursuant
19  * to contract no. DE-AC03-76SF00098 between the United States
20  * Department of Energy and the University of California.
21  *
22  * Redistribution and use in source and binary forms are permitted provided
23  * that: (1) source distributions retain this entire copyright notice and
24  * comment, and (2) distributions including binaries display the following
25  * acknowledgement: ``This product includes software developed by the
26  * University of California, Berkeley and its contributors'' in the
27  * documentation or other materials provided with the distribution and in
28  * all advertising materials mentioning features or use of this software.
29  * Neither the name of the University nor the names of its contributors may
30  * be used to endorse or promote products derived from this software without
31  * specific prior written permission.
32  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
33  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
34  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
35  */
36 
37 #ifndef INC_flexdef_H
38 #define INC_flexdef_H
39 
40 #include <stdio.h>
41 #include <string.h>
42 #include <stddef.h>
43 #include <stdlib.h>
44 #include <ctype.h>
45 
46 #include <osiUnistd.h>
47 
48 #ifdef __GNUC__
49 #define NORETURN __attribute__((noreturn))
50 #else
51 #define NORETURN
52 #endif
53 
54 /* always be prepared to generate an 8-bit scanner */
55 #define FLEX_8_BIT_CHARS
56 
57 #ifdef FLEX_8_BIT_CHARS
58 #define CSIZE 256
59 #define Char unsigned char
60 #else
61 #define Char char
62 #define CSIZE 128
63 #endif
64 
65 /* size of input alphabet - should be size of ASCII set */
66 #ifndef DEFAULT_CSIZE
67 #define DEFAULT_CSIZE 128
68 #endif
69 
70 
71 /* maximum line length we'll have to deal with */
72 #define MAXLINE BUFSIZ
73 
74 /* maximum size of file name */
75 #define FILENAMESIZE 1024
76 
77 #ifndef min
78 #define min(x,y) ((x) < (y) ? (x) : (y))
79 #endif
80 #ifndef max
81 #define max(x,y) ((x) > (y) ? (x) : (y))
82 #endif
83 
84 #define true 1
85 #define false 0
86 
87 
88 #ifndef DEFAULT_SKELETON_FILE
89 #define DEFAULT_SKELETON_FILE "flex.skel"
90 #endif
91 
92 /* special chk[] values marking the slots taking by end-of-buffer and action
93  * numbers
94  */
95 #define EOB_POSITION -1
96 #define ACTION_POSITION -2
97 
98 /* number of data items per line for -f output */
99 #define NUMDATAITEMS 10
100 
101 /* number of lines of data in -f output before inserting a blank line for
102  * readability.
103  */
104 #define NUMDATALINES 10
105 
106 /* transition_struct_out() definitions */
107 #define TRANS_STRUCT_PRINT_LENGTH 15
108 
109 /* returns true if an nfa state has an epsilon out-transition slot
110  * that can be used. This definition is currently not used.
111  */
112 #define FREE_EPSILON(state) \
113  (transchar[state] == SYM_EPSILON && \
114  trans2[state] == NO_TRANSITION && \
115  finalst[state] != state)
116 
117 /* returns true if an nfa state has an epsilon out-transition character
118  * and both slots are free
119  */
120 #define SUPER_FREE_EPSILON(state) \
121  (transchar[state] == SYM_EPSILON && \
122  trans1[state] == NO_TRANSITION) \
123 
124 /* maximum number of NFA states that can comprise a DFA state. It's real
125  * big because if there's a lot of rules, the initial state will have a
126  * huge epsilon closure.
127  */
128 #define INITIAL_MAX_DFA_SIZE 750
129 #define MAX_DFA_SIZE_INCREMENT 750
130 
131 
132 /* a note on the following masks. They are used to mark accepting numbers
133  * as being special. As such, they implicitly limit the number of accepting
134  * numbers (i.e., rules) because if there are too many rules the rule numbers
135  * will overload the mask bits. Fortunately, this limit is \large/ (0x2000 ==
136  * 8192) so unlikely to actually cause any problems. A check is made in
137  * new_rule() to ensure that this limit is not reached.
138  */
139 
140 /* mask to mark a trailing context accepting number */
141 #define YY_TRAILING_MASK 0x2000
142 
143 /* mask to mark the accepting number of the "head" of a trailing context rule */
144 #define YY_TRAILING_HEAD_MASK 0x4000
145 
146 /* maximum number of rules, as outlined in the above note */
147 #define MAX_RULE (YY_TRAILING_MASK - 1)
148 
149 
150 /* NIL must be 0. If not, its special meaning when making equivalence classes
151  * (it marks the representative of a given e.c.) will be unidentifiable
152  */
153 #define NIL 0
154 
155 #define JAM -1 /* to mark a missing DFA transition */
156 #define NO_TRANSITION NIL
157 #define UNIQUE -1 /* marks a symbol as an e.c. representative */
158 #define INFINITY -1 /* for x{5,} constructions */
159 
160 #define INITIAL_MAX_CCLS 100 /* max number of unique character classes */
161 #define MAX_CCLS_INCREMENT 100
162 
163 /* size of table holding members of character classes */
164 #define INITIAL_MAX_CCL_TBL_SIZE 500
165 #define MAX_CCL_TBL_SIZE_INCREMENT 250
166 
167 #define INITIAL_MAX_RULES 100 /* default maximum number of rules */
168 #define MAX_RULES_INCREMENT 100
169 
170 #define INITIAL_MNS 2000 /* default maximum number of nfa states */
171 #define MNS_INCREMENT 1000 /* amount to bump above by if it's not enough */
172 
173 #define INITIAL_MAX_DFAS 1000 /* default maximum number of dfa states */
174 #define MAX_DFAS_INCREMENT 1000
175 
176 #define JAMSTATE -32766 /* marks a reference to the state that always jams */
177 
178 /* enough so that if it's subtracted from an NFA state number, the result
179  * is guaranteed to be negative
180  */
181 #define MARKER_DIFFERENCE 32000
182 #define MAXIMUM_MNS 31999
183 
184 /* maximum number of nxt/chk pairs for non-templates */
185 #define INITIAL_MAX_XPAIRS 2000
186 #define MAX_XPAIRS_INCREMENT 2000
187 
188 /* maximum number of nxt/chk pairs needed for templates */
189 #define INITIAL_MAX_TEMPLATE_XPAIRS 2500
190 #define MAX_TEMPLATE_XPAIRS_INCREMENT 2500
191 
192 #define SYM_EPSILON (CSIZE + 1) /* to mark transitions on the symbol epsilon */
193 
194 #define INITIAL_MAX_SCS 40 /* maximum number of start conditions */
195 #define MAX_SCS_INCREMENT 40 /* amount to bump by if it's not enough */
196 
197 #define ONE_STACK_SIZE 500 /* stack of states with only one out-transition */
198 #define SAME_TRANS -1 /* transition is the same as "default" entry for state */
199 
200 /* the following percentages are used to tune table compression:
201 
202  * the percentage the number of out-transitions a state must be of the
203  * number of equivalence classes in order to be considered for table
204  * compaction by using protos
205  */
206 #define PROTO_SIZE_PERCENTAGE 15
207 
208 /* the percentage the number of homogeneous out-transitions of a state
209  * must be of the number of total out-transitions of the state in order
210  * that the state's transition table is first compared with a potential
211  * template of the most common out-transition instead of with the first
212  * proto in the proto queue
213  */
214 #define CHECK_COM_PERCENTAGE 50
215 
216 /* the percentage the number of differences between a state's transition
217  * table and the proto it was first compared with must be of the total
218  * number of out-transitions of the state in order to keep the first
219  * proto as a good match and not search any further
220  */
221 #define FIRST_MATCH_DIFF_PERCENTAGE 10
222 
223 /* the percentage the number of differences between a state's transition
224  * table and the most similar proto must be of the state's total number
225  * of out-transitions to use the proto as an acceptable close match
226  */
227 #define ACCEPTABLE_DIFF_PERCENTAGE 50
228 
229 /* the percentage the number of homogeneous out-transitions of a state
230  * must be of the number of total out-transitions of the state in order
231  * to consider making a template from the state
232  */
233 #define TEMPLATE_SAME_PERCENTAGE 60
234 
235 /* the percentage the number of differences between a state's transition
236  * table and the most similar proto must be of the state's total number
237  * of out-transitions to create a new proto from the state
238  */
239 #define NEW_PROTO_DIFF_PERCENTAGE 20
240 
241 /* the percentage the total number of out-transitions of a state must be
242  * of the number of equivalence classes in order to consider trying to
243  * fit the transition table into "holes" inside the nxt/chk table.
244  */
245 #define INTERIOR_FIT_PERCENTAGE 15
246 
247 /* size of region set aside to cache the complete transition table of
248  * protos on the proto queue to enable quick comparisons
249  */
250 #define PROT_SAVE_SIZE 2000
251 
252 #define MSP 50 /* maximum number of saved protos (protos on the proto queue) */
253 
254 /* maximum number of out-transitions a state can have that we'll rummage
255  * around through the interior of the internal fast table looking for a
256  * spot for it
257  */
258 #define MAX_XTIONS_FULL_INTERIOR_FIT 4
259 
260 /* maximum number of rules which will be reported as being associated
261  * with a DFA state
262  */
263 #define MAX_ASSOC_RULES 100
264 
265 /* number that, if used to subscript an array, has a good chance of producing
266  * an error; should be small enough to fit into a short
267  */
268 #define BAD_SUBSCRIPT -32767
269 
270 /* absolute value of largest number that can be stored in a short, with a
271  * bit of slop thrown in for general paranoia.
272  */
273 #define MAX_SHORT 32766
274 
275 
276 /* Declarations for global variables. */
277 
278 /* variables for symbol tables:
279  * sctbl - start-condition symbol table
280  * ndtbl - name-definition symbol table
281  * ccltab - character class text symbol table
282  */
283 
285  {
286  struct hash_entry *prev, *next;
287  char *name;
288  char *str_val;
289  int int_val;
290  } ;
291 
292 typedef struct hash_entry *hash_table[];
293 
294 #define NAME_TABLE_HASH_SIZE 101
295 #define START_COND_HASH_SIZE 101
296 #define CCL_HASH_SIZE 101
297 
298 extern struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE];
299 extern struct hash_entry *sctbl[START_COND_HASH_SIZE];
300 extern struct hash_entry *ccltab[CCL_HASH_SIZE];
301 
302 
303 /* variables for flags:
304  * printstats - if true (-v), dump statistics
305  * syntaxerror - true if a syntax error has been found
306  * eofseen - true if we've seen an eof in the input file
307  * ddebug - if true (-d), make a "debug" scanner
308  * trace - if true (-T), trace processing
309  * spprdflt - if true (-s), suppress the default rule
310  * interactive - if true (-I), generate an interactive scanner
311  * caseins - if true (-i), generate a case-insensitive scanner
312  * useecs - if true (-Ce flag), use equivalence classes
313  * fulltbl - if true (-Cf flag), don't compress the DFA state table
314  * usemecs - if true (-Cm flag), use meta-equivalence classes
315  * fullspd - if true (-F flag), use Jacobson method of table representation
316  * gen_line_dirs - if true (i.e., no -L flag), generate #line directives
317  * performance_report - if true (i.e., -p flag), generate a report relating
318  * to scanner performance
319  * backtrack_report - if true (i.e., -b flag), generate "lex.backtrack" file
320  * listing backtracking states
321  * csize - size of character set for the scanner we're generating;
322  * 128 for 7-bit chars and 256 for 8-bit
323  * yymore_used - if true, yymore() is used in input rules
324  * reject - if true, generate backtracking tables for REJECT macro
325  * real_reject - if true, scanner really uses REJECT (as opposed to just
326  * having "reject" set for variable trailing context)
327  * continued_action - true if this rule's action is to "fall through" to
328  * the next rule's action (i.e., the '|' action)
329  * yymore_really_used - has a REALLY_xxx value indicating whether a
330  * %used or %notused was used with yymore()
331  * reject_really_used - same for REJECT
332  */
333 
335 extern int interactive, caseins, useecs, fulltbl, usemecs;
338 
339 #define REALLY_NOT_DETERMINED 0
340 #define REALLY_USED 1
341 #define REALLY_NOT_USED 2
343 
344 
345 /* variables used in the flex input routines:
346  * datapos - characters on current output line
347  * dataline - number of contiguous lines of data in current data
348  * statement. Used to generate readable -f output
349  * linenum - current input line number
350  * skelfile - the skeleton file
351  * yyin - input file
352  * temp_action_file - temporary file to hold actions
353  * backtrack_file - file to summarize backtracking states to
354  * infilename - name of input file
355  * input_files - array holding names of input files
356  * num_input_files - size of input_files array
357  * program_name - name with which program was invoked
358  */
359 
360 extern int datapos, dataline, linenum;
361 extern FILE *skelfile, *yyin, *temp_action_file, *backtrack_file;
362 extern char *infilename;
363 extern char **input_files;
364 extern int num_input_files;
365 extern char *program_name;
366 
367 
368 /* variables for stack of states having only one out-transition:
369  * onestate - state number
370  * onesym - transition symbol
371  * onenext - target state
372  * onedef - default base entry
373  * onesp - stack pointer
374  */
375 
378 
379 
380 /* variables for nfa machine data:
381  * current_mns - current maximum on number of NFA states
382  * num_rules - number of the last accepting state; also is number of
383  * rules created so far
384  * current_max_rules - current maximum number of rules
385  * lastnfa - last nfa state number created
386  * firstst - physically the first state of a fragment
387  * lastst - last physical state of fragment
388  * finalst - last logical state of fragment
389  * transchar - transition character
390  * trans1 - transition state
391  * trans2 - 2nd transition state for epsilons
392  * accptnum - accepting number
393  * assoc_rule - rule associated with this NFA state (or 0 if none)
394  * state_type - a STATE_xxx type identifying whether the state is part
395  * of a normal rule, the leading state in a trailing context
396  * rule (i.e., the state which marks the transition from
397  * recognizing the text-to-be-matched to the beginning of
398  * the trailing context), or a subsequent state in a trailing
399  * context rule
400  * rule_type - a RULE_xxx type identifying whether this a a ho-hum
401  * normal rule or one which has variable head & trailing
402  * context
403  * rule_linenum - line number associated with rule
404  */
405 
407 extern int *firstst, *lastst, *finalst, *transchar, *trans1, *trans2;
409 
410 /* different types of states; values are useful as masks, as well, for
411  * routines like check_trailing_context()
412  */
413 #define STATE_NORMAL 0x1
414 #define STATE_TRAILING_CONTEXT 0x2
415 
416 /* global holding current type of state we're making */
417 
418 extern int current_state_type;
419 
420 /* different types of rules */
421 #define RULE_NORMAL 0
422 #define RULE_VARIABLE 1
423 
424 /* true if the input rules include a rule with both variable-length head
425  * and trailing context, false otherwise
426  */
428 
429 
430 /* variables for protos:
431  * numtemps - number of templates created
432  * numprots - number of protos created
433  * protprev - backlink to a more-recently used proto
434  * protnext - forward link to a less-recently used proto
435  * prottbl - base/def table entry for proto
436  * protcomst - common state of proto
437  * firstprot - number of the most recently used proto
438  * lastprot - number of the least recently used proto
439  * protsave contains the entire state array for protos
440  */
441 
442 extern int numtemps, numprots, protprev[MSP], protnext[MSP], prottbl[MSP];
444 
445 
446 /* variables for managing equivalence classes:
447  * numecs - number of equivalence classes
448  * nextecm - forward link of Equivalence Class members
449  * ecgroup - class number or backward link of EC members
450  * nummecs - number of meta-equivalence classes (used to compress
451  * templates)
452  * tecfwd - forward link of meta-equivalence classes members
453  * tecbck - backward link of MEC's
454  * xlation - maps character codes to their translations, or nil if no %t table
455  * num_xlations - number of different xlation values
456  */
457 
458 /* reserve enough room in the equivalence class arrays so that we
459  * can use the CSIZE'th element to hold equivalence class information
460  * for the NUL character. Later we'll move this information into
461  * the 0th element.
462  */
463 extern int numecs, nextecm[CSIZE + 1], ecgroup[CSIZE + 1], nummecs;
464 
465 /* meta-equivalence classes are indexed starting at 1, so it's possible
466  * that they will require positions from 1 .. CSIZE, i.e., CSIZE + 1
467  * slots total (since the arrays are 0-based). nextecm[] and ecgroup[]
468  * don't require the extra position since they're indexed from 1 .. CSIZE - 1.
469  */
470 extern int tecfwd[CSIZE + 1], tecbck[CSIZE + 1];
471 
472 extern int *xlation;
473 extern int num_xlations;
474 
475 
476 /* variables for start conditions:
477  * lastsc - last start condition created
478  * current_max_scs - current limit on number of start conditions
479  * scset - set of rules active in start condition
480  * scbol - set of rules active only at the beginning of line in a s.c.
481  * scxclu - true if start condition is exclusive
482  * sceof - true if start condition has EOF rule
483  * scname - start condition name
484  * actvsc - stack of active start conditions for the current rule
485  */
486 
487 extern int lastsc, current_max_scs, *scset, *scbol, *scxclu, *sceof, *actvsc;
488 extern char **scname;
489 
490 
491 /* variables for dfa machine data:
492  * current_max_dfa_size - current maximum number of NFA states in DFA
493  * current_max_xpairs - current maximum number of non-template xtion pairs
494  * current_max_template_xpairs - current maximum number of template pairs
495  * current_max_dfas - current maximum number DFA states
496  * lastdfa - last dfa state number created
497  * nxt - state to enter upon reading character
498  * chk - check value to see if "nxt" applies
499  * tnxt - internal nxt table for templates
500  * base - offset into "nxt" for given state
501  * def - where to go if "chk" disallows "nxt" entry
502  * nultrans - NUL transition for each state
503  * NUL_ec - equivalence class of the NUL character
504  * tblend - last "nxt/chk" table entry being used
505  * firstfree - first empty entry in "nxt/chk" table
506  * dss - nfa state set for each dfa
507  * dfasiz - size of nfa state set for each dfa
508  * dfaacc - accepting set for each dfa state (or accepting number, if
509  * -r is not given)
510  * accsiz - size of accepting set for each dfa state
511  * dhash - dfa state hash value
512  * numas - number of DFA accepting states created; note that this
513  * is not necessarily the same value as num_rules, which is the analogous
514  * value for the NFA
515  * numsnpairs - number of state/nextstate transition pairs
516  * jambase - position in base/def where the default jam table starts
517  * jamstate - state number corresponding to "jam" state
518  * end_of_buffer_state - end-of-buffer dfa state number
519  */
520 
523 extern int lastdfa, lasttemp, *nxt, *chk, *tnxt;
524 extern int *base, *def, *nultrans, NUL_ec, tblend, firstfree, **dss, *dfasiz;
525 extern union dfaacc_union
526  {
529  } *dfaacc;
530 extern int *accsiz, *dhash, numas;
531 extern int numsnpairs, jambase, jamstate;
532 extern int end_of_buffer_state;
533 
534 /* variables for ccl information:
535  * lastccl - ccl index of the last created ccl
536  * current_maxccls - current limit on the maximum number of unique ccl's
537  * cclmap - maps a ccl index to its set pointer
538  * ccllen - gives the length of a ccl
539  * cclng - true for a given ccl if the ccl is negated
540  * cclreuse - counts how many times a ccl is re-used
541  * current_max_ccl_tbl_size - current limit on number of characters needed
542  * to represent the unique ccl's
543  * ccltbl - holds the characters in each ccl - indexed by cclmap
544  */
545 
547 extern int current_max_ccl_tbl_size;
548 extern Char *ccltbl;
549 
550 
551 /* variables for miscellaneous information:
552  * starttime - real-time when we started
553  * endtime - real-time when we ended
554  * nmstr - last NAME scanned by the scanner
555  * sectnum - section number currently being parsed
556  * nummt - number of empty nxt/chk table entries
557  * hshcol - number of hash collisions detected by snstods
558  * dfaeql - number of times a newly created dfa was equal to an old one
559  * numeps - number of epsilon NFA states created
560  * eps2 - number of epsilon states which have 2 out-transitions
561  * num_reallocs - number of times it was necessary to realloc() a group
562  * of arrays
563  * tmpuses - number of DFA states that chain to templates
564  * totnst - total number of NFA states used to make DFA states
565  * peakpairs - peak number of transition pairs we had to store internally
566  * numuniq - number of unique transitions
567  * numdup - number of duplicate transitions
568  * hshsave - number of hash collisions saved by checking number of states
569  * num_backtracking - number of DFA states requiring back-tracking
570  * bol_needed - whether scanner needs beginning-of-line recognition
571  */
572 
573 extern char *starttime, *endtime, nmstr[MAXLINE];
575 extern int tmpuses, totnst, peakpairs, numuniq, numdup, hshsave;
576 extern int num_backtracking, bol_needed;
577 
578 void *allocate_array(int size, int element_size);
579 void *reallocate_array(void *array, int size, int element_size);
580 
581 #define allocate_integer_array(size) \
582  (int *) allocate_array( size, sizeof( int ) )
583 
584 #define reallocate_integer_array(array,size) \
585  (int *) reallocate_array( (void *) array, size, sizeof( int ) )
586 
587 #define allocate_int_ptr_array(size) \
588  (int **) allocate_array( size, sizeof( int * ) )
589 
590 #define allocate_char_ptr_array(size) \
591  (char **) allocate_array( size, sizeof( char * ) )
592 
593 #define allocate_dfaacc_union(size) \
594  (union dfaacc_union *) \
595  allocate_array( size, sizeof( union dfaacc_union ) )
596 
597 #define reallocate_int_ptr_array(array,size) \
598  (int **) reallocate_array( (void *) array, size, sizeof( int * ) )
599 
600 #define reallocate_char_ptr_array(array,size) \
601  (char **) reallocate_array( (void *) array, size, sizeof( char * ) )
602 
603 #define reallocate_dfaacc_union(array, size) \
604  (union dfaacc_union *) \
605  reallocate_array( (void *) array, size, sizeof( union dfaacc_union ) )
606 
607 #define allocate_character_array(size) \
608  (Char *) allocate_array( size, sizeof( Char ) )
609 
610 #define reallocate_character_array(array,size) \
611  (Char *) reallocate_array( (void *) array, size, sizeof( Char ) )
612 
613 #if 0 /* JRW this might couse truuble... but not for IOC usage */
614 /* used to communicate between scanner and parser. The type should really
615  * be YYSTYPE, but we can't easily get our hands on it.
616  */
617 #ifdef __alpha /* inconsistency with parse.y, line 57... on Alpha */
618 extern long yylval;
619 #else
620 extern int yylval;
621 #endif
622 #endif
623 
624 
625 /* external functions that are cross-referenced among the flex source files */
626 
627 
628 /* from file ccl.c */
629 
630 extern void ccladd (int, int); /* Add a single character to a ccl */
631 extern int cclinit (void); /* make an empty ccl */
632 extern void cclnegate (int); /* negate a ccl */
633 
634 /* list the members of a set of characters in CCL form */
635 extern void list_character_set (FILE*, int[]);
636 
637 
638 /* from file dfa.c */
639 
640 /* increase the maximum number of dfas */
641 extern void increase_max_dfas (void);
642 
643 extern void ntod (void); /* convert a ndfa to a dfa */
644 
645 
646 /* from file ecs.c */
647 
648 /* convert character classes to set of equivalence classes */
649 extern void ccl2ecl (void);
650 
651 /* associate equivalence class numbers with class members */
652 extern int cre8ecs (int[], int[], int);
653 
654 /* associate equivalence class numbers using %t table */
655 extern int ecs_from_xlation (int[]);
656 
657 /* update equivalence classes based on character class transitions */
658 extern void mkeccl (Char[], int, int[], int[], int, int);
659 
660 /* create equivalence class for single character */
661 extern void mkechar (int, int[], int[]);
662 
663 
664 /* from file gen.c */
665 
666 extern void make_tables (void); /* generate transition tables */
667 
668 
669 /* from file main.c */
670 
671 extern void flexend (int) NORETURN;
672 
673 
674 /* from file misc.c */
675 
676 /* write out the actions from the temporary file to lex.yy.c */
677 extern void action_out (void);
678 
679 /* true if a string is all lower case */
680 extern int all_lower (Char *);
681 
682 /* true if a string is all upper case */
683 extern int all_upper (Char *);
684 
685 /* bubble sort an integer array */
686 extern void bubble (int [], int);
687 
688 /* shell sort a character array */
689 extern void cshell (Char [], int, int);
690 
691 extern void dataend (void); /* finish up a block of data declarations */
692 
693 /* report an error message and terminate */
694 extern void flexerror (char[]) NORETURN;
695 
696 /* report a fatal error message and terminate */
697 extern void flexfatal (char[]);
698 
699 /* report an error message formatted with one integer argument */
700 extern void lerrif (char[], int);
701 
702 /* report an error message formatted with one string argument */
703 extern void lerrsf (char[], char[]);
704 
705 /* spit out a "# line" statement */
706 extern void line_directive_out (FILE*);
707 
708 /* generate a data statment for a two-dimensional array */
709 extern void mk2data (int);
710 
711 extern void mkdata (int); /* generate a data statement */
712 
713 /* return the integer represented by a string of digits */
714 extern int myctoi (Char []);
715 
716 /* write out one section of the skeleton file */
717 extern void skelout (void);
718 
719 /* output a yy_trans_info structure */
720 extern void transition_struct_out (int, int);
721 
722 
723 /* from file nfa.c */
724 
725 /* add an accepting state to a machine */
726 extern void add_accept (int, int);
727 
728 /* make a given number of copies of a singleton machine */
729 extern int copysingl (int, int);
730 
731 /* debugging routine to write out an nfa */
732 extern void dumpnfa (int);
733 
734 /* finish up the processing for a rule */
735 extern void finish_rule (int, int, int, int);
736 
737 /* connect two machines together */
738 extern int link_machines (int, int);
739 
740 /* mark each "beginning" state in a machine as being a "normal" (i.e.,
741  * not trailing context associated) state
742  */
743 extern void mark_beginning_as_normal (int);
744 
745 /* make a machine that branches to two machines */
746 extern int mkbranch (int, int);
747 
748 extern int mkclos (int); /* convert a machine into a closure */
749 extern int mkopt (int); /* make a machine optional */
750 
751 /* make a machine that matches either one of two machines */
752 extern int mkor (int, int);
753 
754 /* convert a machine into a positive closure */
755 extern int mkposcl (int);
756 
757 extern int mkrep (int, int, int); /* make a replicated machine */
758 
759 /* create a state with a transition on a given symbol */
760 extern int mkstate (int);
761 
762 extern void new_rule (void); /* initialize for a new rule */
763 
764 
765 /* from file parse.y */
766 
767 /* write out a message formatted with one string, pinpointing its location */
768 extern void format_pinpoint_message (char[], char[]);
769 
770 /* write out a message, pinpointing its location */
771 extern void pinpoint_message (char[]);
772 
773 extern void synerr (char []); /* report a syntax error */
774 /* extern int yyparse ();*/ /* the YACC parser */
775 
776 
777 /* from file scan.l */
778 
779 extern int flexscan (); /* the Flex-generated scanner for flex */
780 
781 /* open the given file (if NULL, stdin) for scanning */
782 extern void set_input_file (char*);
783 
784 extern int yywrap (); /* wrapup a file in the lexical analyzer */
785 
786 
787 /* from file sym.c */
788 
789 /* save the text of a character class */
790 extern void cclinstal (Char [], int);
791 
792 /* lookup the number associated with character class */
793 extern int ccllookup (Char []);
794 
795 extern void ndinstal (char[], Char[]); /* install a name definition */
796 extern void scinstal (char[], int); /* make a start condition */
797 
798 /* lookup the number associated with a start condition */
799 extern int sclookup (char[]);
800 
801 
802 /* from file tblcmp.c */
803 
804 /* build table entries for dfa state */
805 extern void bldtbl (int[], int, int, int, int);
806 
807 extern void cmptmps (void); /* compress template table entries */
808 extern void inittbl (void); /* initialize transition tables */
809 extern void mkdeftbl (void); /* make the default, "jam" table entries */
810 
811 /* create table entries for a state (or state fragment) which has
812  * only one out-transition */
813 extern void mk1tbl (int, int, int, int);
814 
815 /* place a state into full speed transition table */
816 extern void place_state (int*, int, int);
817 
818 /* save states with only one out-transition to be processed later */
819 extern void stack1 (int, int, int, int);
820 
821 
822 /* from file yylex.c */
823 
824 extern int yylex ();
825 
826 #endif /* INC_flexdef_H */
int performance_report
Definition: flex.c:68
int current_max_scs
Definition: flex.c:87
char nmstr[MAXLINE]
Definition: flex.c:99
int * actvsc
Definition: flex.c:87
void ccl2ecl(void)
Definition: ecs.c:45
char ** scname
Definition: flex.c:88
FILE * skelfile
Definition: flex.c:72
int * state_type
Definition: flex.c:78
void ntod(void)
Definition: dfa.c:398
int lasttemp
int onesp
Definition: flex.c:75
int linenum
Definition: flex.c:71
#define PROT_SAVE_SIZE
Definition: flexdef.h:250
int * scset
Definition: flex.c:87
void scinstal(char[], int)
int * dhash
Definition: flex.c:94
int * assoc_rule
Definition: flex.c:78
char * endtime
Definition: flex.c:99
void stack1(int, int, int, int)
Definition: tblcmp.c:851
int mkposcl(int)
Definition: nfa.c:501
int current_mns
Definition: flex.c:76
int dfaeql
Definition: flex.c:100
#define NAME_TABLE_HASH_SIZE
Definition: flexdef.h:294
void finish_rule(int, int, int, int)
Definition: nfa.c:209
int yymore_really_used
Definition: flex.c:70
int yywrap()
int * nxt
Definition: flex.c:91
int mkclos(int)
Definition: nfa.c:385
int lastdfa
Definition: flex.c:91
void format_pinpoint_message(char[], char[])
int nextecm[CSIZE+1]
Definition: flex.c:83
int syntaxerror
Definition: flex.c:66
struct hash_entry * next
Definition: flexdef.h:286
int onedef[ONE_STACK_SIZE]
Definition: flex.c:75
int onesym[ONE_STACK_SIZE]
Definition: flex.c:74
#define START_COND_HASH_SIZE
Definition: flexdef.h:295
void cclinstal(Char[], int)
int mkopt(int)
Definition: nfa.c:405
void mk1tbl(int, int, int, int)
Definition: tblcmp.c:647
int lastccl
Definition: flex.c:96
int interactive
Definition: flex.c:67
int * accptnum
Definition: flex.c:78
int peakpairs
Definition: flex.c:101
int * base
Definition: flex.c:92
void mkechar(int, int[], int[])
Definition: ecs.c:328
int lastnfa
Definition: flex.c:76
struct hash_entry * ccltab[CCL_HASH_SIZE]
Definition: sym.c:47
int * chk
Definition: flex.c:91
char * name
Definition: flexdef.h:287
int * xlation
Definition: flex.c:85
int * rule_linenum
Definition: flex.c:78
struct hash_entry * ndtbl[NAME_TABLE_HASH_SIZE]
Definition: sym.c:45
FILE * yyin
Definition: scan.c:290
int hshcol
Definition: flex.c:100
void * allocate_array(int size, int element_size)
Definition: misc.c:76
int protcomst[MSP]
Definition: flex.c:82
void action_out(void)
Definition: misc.c:62
int num_reallocs
Definition: flex.c:100
int cre8ecs(int[], int[], int)
Definition: ecs.c:115
void cmptmps(void)
Definition: tblcmp.c:228
struct hash_entry * sctbl[START_COND_HASH_SIZE]
Definition: sym.c:46
void inittbl(void)
Definition: tblcmp.c:430
int * dfaacc_set
Definition: flexdef.h:527
void skelout(void)
Definition: misc.c:734
int numdup
Definition: flex.c:101
int * dfasiz
Definition: flex.c:92
int current_max_dfas
Definition: flex.c:90
Definition: flexdef.h:284
int NUL_ec
Definition: flex.c:92
#define NORETURN
Definition: flexdef.h:51
int protnext[MSP]
Definition: flex.c:81
int datapos
Definition: flex.c:71
int lastsc
Definition: flex.c:87
int gen_line_dirs
Definition: flex.c:68
int tmpuses
Definition: flex.c:101
int current_max_rules
Definition: flex.c:76
int yymore_used
Definition: flex.c:69
int tecfwd[CSIZE+1]
Definition: flex.c:83
int link_machines(int, int)
Definition: nfa.c:283
int * tnxt
Definition: flex.c:91
void mkeccl(Char[], int, int[], int[], int, int)
int * sceof
Definition: flex.c:87
#define ONE_STACK_SIZE
Definition: flexdef.h:197
int mkstate(int)
Definition: nfa.c:578
Char * ccltbl
Definition: flex.c:98
int cclinit(void)
Definition: ccl.c:83
int prottbl[MSP]
Definition: flex.c:81
FILE * backtrack_file
Definition: flex.c:104
int reject
Definition: flex.c:69
void increase_max_dfas(void)
Definition: dfa.c:370
int backtrack_report
Definition: flex.c:68
int onestate[ONE_STACK_SIZE]
Definition: flex.c:74
int tblend
Definition: flex.c:92
union dfaacc_union * dfaacc
int real_reject
Definition: flex.c:69
int mkrep(int, int, int)
Definition: nfa.c:532
int jambase
Definition: flex.c:95
int spprdflt
Definition: flex.c:66
void list_character_set(FILE *, int[])
Definition: ccl.c:140
int ** dss
Definition: flex.c:92
void mark_beginning_as_normal(int)
Definition: nfa.c:316
int printstats
Definition: flex.c:66
int csize
Definition: flex.c:68
int usemecs
Definition: flex.c:67
int * def
Definition: flex.c:92
int * accsiz
Definition: flex.c:94
void set_input_file(char *)
Definition: scan.c:2233
int * trans1
Definition: flex.c:77
void dataend(void)
Definition: misc.c:292
void synerr(char[])
char * starttime
Definition: flex.c:99
int num_rules
Definition: flex.c:76
#define CCL_HASH_SIZE
Definition: flexdef.h:296
void lerrsf(char[], char[])
int yylex()
Definition: yylex.c:56
void lerrif(char[], int)
int * scbol
Definition: flex.c:87
void flexend(int) NORETURN
Definition: flex.c:196
FILE * temp_action_file
Definition: flex.c:103
int numuniq
Definition: flex.c:101
void flexerror(char[]) NORETURN
void * reallocate_array(void *array, int size, int element_size)
Definition: misc.c:707
void bubble(int[], int)
Definition: misc.c:152
#define Char
Definition: flexdef.h:59
int all_upper(Char *)
Definition: misc.c:125
char * str_val
Definition: flexdef.h:288
int firstprot
Definition: flex.c:82
int numtemps
Definition: flex.c:81
int numeps
Definition: flex.c:100
int nummecs
Definition: flex.c:83
int fulltbl
Definition: flex.c:67
int nummt
Definition: flex.c:100
int * finalst
Definition: flex.c:77
int num_xlations
Definition: flex.c:86
int * lastst
Definition: flex.c:77
int lastprot
Definition: flex.c:82
int totnst
Definition: flex.c:101
void mkdata(int)
Definition: misc.c:524
#define MAXLINE
Definition: flexdef.h:72
int sclookup(char[])
int onenext[ONE_STACK_SIZE]
Definition: flex.c:75
void new_rule(void)
Definition: nfa.c:674
int current_max_ccl_tbl_size
Definition: flex.c:97
int ddebug
Definition: flex.c:66
int current_max_xpairs
Definition: flex.c:89
void add_accept(int, int)
Definition: nfa.c:55
int num_input_files
Definition: flex.c:107
int eofseen
Definition: flex.c:66
void line_directive_out(FILE *)
Definition: misc.c:479
int flexscan()
void ccladd(int, int)
Definition: ccl.c:47
int protsave[PROT_SAVE_SIZE]
Definition: flex.c:82
void flexfatal(char[])
int jamstate
Definition: flex.c:95
int * cclmap
Definition: flex.c:96
int * firstst
Definition: flex.c:77
char * program_name
Definition: flex.c:108
int * scxclu
Definition: flex.c:87
int myctoi(Char[])
int num_backtracking
Definition: flex.c:102
int variable_trailing_context_rules
Definition: flex.c:80
#define MSP
Definition: flexdef.h:252
int mkbranch(int, int)
Definition: nfa.c:358
int sectnum
Definition: flex.c:100
int * transchar
Definition: flex.c:77
char * infilename
Definition: flex.c:73
int ecgroup[CSIZE+1]
Definition: flex.c:83
int numas
Definition: flex.c:94
int current_max_dfa_size
Definition: flex.c:89
int hshsave
Definition: flex.c:101
int ccllookup(Char[])
void pinpoint_message(char[])
int reject_really_used
Definition: flex.c:70
void bldtbl(int[], int, int, int, int)
int tecbck[CSIZE+1]
Definition: flex.c:84
int current_maxccls
Definition: flex.c:96
int protprev[MSP]
Definition: flex.c:81
void ndinstal(char[], Char[])
int caseins
Definition: flex.c:67
void make_tables(void)
Definition: gen.c:994
int current_max_template_xpairs
Definition: flex.c:90
int ecs_from_xlation(int[])
Definition: ecs.c:150
struct hash_entry * hash_table[]
Definition: flexdef.h:292
int firstfree
Definition: flex.c:92
struct hash_entry * prev
Definition: flexdef.h:286
int * cclng
Definition: flex.c:96
int dfaacc_state
Definition: flexdef.h:528
void dumpnfa(int)
Definition: nfa.c:106
#define CSIZE
Definition: flexdef.h:58
void cshell(Char[], int, int)
int * ccllen
Definition: flex.c:96
char ** input_files
Definition: flex.c:106
int int_val
Definition: flexdef.h:289
int cclreuse
Definition: flex.c:96
int numecs
Definition: flex.c:83
int numsnpairs
Definition: flex.c:95
void mkdeftbl(void)
Definition: tblcmp.c:467
int fullspd
Definition: flex.c:68
int * nultrans
Definition: flex.c:92
int bol_needed
Definition: flex.c:102
int all_lower(Char *)
Definition: misc.c:104
int current_state_type
Definition: flex.c:79
int dataline
Definition: flex.c:71
int * rule_type
Definition: flex.c:78
void transition_struct_out(int, int)
Definition: misc.c:756
void cclnegate(int)
Definition: ccl.c:122
int numprots
Definition: flex.c:81
int continued_action
Definition: flex.c:69
int * trans2
Definition: flex.c:77
int copysingl(int, int)
Definition: nfa.c:86
int useecs
Definition: flex.c:67
int trace
Definition: flex.c:66
int eps2
Definition: flex.c:100
void mk2data(int)
Definition: misc.c:494
int mkor(int, int)
Definition: nfa.c:442
void place_state(int *, int, int)
Definition: tblcmp.c:807
int end_of_buffer_state
Definition: flex.c:105