diff -crN ram:flex-2.4.7/Makefile.amiga dh1:flex-2.4.7/Makefile.amiga *** ram:flex-2.4.7/Makefile.amiga --- dh1:flex-2.4.7/Makefile.amiga Mon Aug 22 20:17:25 1994 *************** *** 0 **** --- 1,162 ---- + # Makefile for flex 2.4.7 for the Amiga using SAS/C 6.51 + # 08/17/94 by Carsten Steger + # + # If you build flex from scratch, you will have to call smake twice because + # of a bug in smake that tries to generate scan.c by using flex, although + # the rule for .bootstrap has already copied initscan.c to scan.c. + + + MAKE = smake + MAKEFILE = Makefile.amiga + + CFLAGS = data=f parm=r + CLFLAGS = parm=b + OFLAGS = opt ign=304 + DEFS = def=HAVE_STRING_H=1 + LDFLAGS = link + LIBS = + + BINDIR = SC:c/ + LIBDIR = LIB: + INCLUDEDIR = CXXINCLUDE: + + YACC = yacc + CC = sc + AR = oml + + + CPPFLAGS = $(DEFS) + + .c.o: + $(CC) $(CPPFLAGS) $(CFLAGS) $(OFLAGS) $< + + HEADERS = flexdef.h version.h + + SOURCES = ccl.c dfa.c ecs.c gen.c main.c misc.c nfa.c parse.y \ + scan.l skel.c sym.c tblcmp.c yylex.c + OBJECTS = ccl.o dfa.o ecs.o gen.o main.o misc.o nfa.o parse.o \ + scan.o skel.o sym.o tblcmp.o yylex.o alloca.o + + LIBSRCS = libmain.c libyywrap.c + LIBOBJS = libmain.o libyywrap.o + + FLEX = flex + FLEX_FLAGS = -ist $(PERF_REPORT) + COMPRESSION = + PERF_REPORT = -p + + FLEXLIB = fl.lib + + + all: flex + + flex: .bootstrap $(OBJECTS) $(FLEXLIB) + $(CC) $(OBJECTS) to=flex $(CFLAGS) $(LDFLAGS) lib=$(FLEXLIB) $(LIBS) + + .bootstrap: initscan.c + @-delete scan.c quiet + copy initscan.c scan.c + @touch .bootstrap + + parse.c: parse.y + $(YACC) -d parse.y + sed "/extern char.*malloc/d" parse.c + @-delete y.tab.c quiet + @copy y.tab.h parse.h + @-delete y.tab.h quiet + + parse.h: parse.c + + scan.c: scan.l + $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) scan.l >scan.c + + scan.o: scan.c parse.h flexdef.h + yylex.o: yylex.c parse.h flexdef.h + + skel.c: flex.skl mkskel.amiga + execute mkskel.amiga flex.skl skel.c + + main.o: main.c flexdef.h version.h + ccl.o: ccl.c flexdef.h + dfa.o: dfa.c flexdef.h + ecs.o: ecs.c flexdef.h + gen.o: gen.c flexdef.h + misc.o: misc.c flexdef.h + nfa.o: nfa.c flexdef.h + parse.o: parse.c flexdef.h + skel.o: skel.c flexdef.h + sym.o: sym.c flexdef.h + tblcmp.o: tblcmp.c flexdef.h + + alloca.o: alloca.c config.h + $(CC) $(CPPFLAGS) $(CFLAGS) $(OFLAGS) def=STACK_DIRECTION=-1 \ + def=xmalloc=yy_flex_xmalloc def=HAVE_CONFIG_H=1 alloca.c + + alloca.c: MISC/alloca.c + @-delete alloca.c quiet + @-copy MISC/alloca.c alloca.c + + config.h: config.h.amiga + copy config.h.amiga config.h + + libmain.o: libmain.c + $(CC) $(CPPFLAGS) $(CLFLAGS) $(OFLAGS) $< + + libyywrap.o: libyywrap.c + $(CC) $(CPPFLAGS) $(CLFLAGS) $(OFLAGS) $< + + test: check + check: flex + flex $(FLEX_FLAGS) $(COMPRESSION) scan.l >scan.tmp + diff scan.c scan.tmp + @echo "*E[33mCheck successful, using COMPRESSION=$(COMPRESSION)*E[0m" + @-delete scan.tmp quiet + + bigcheck: + @-delete scan.c quiet + $(MAKE) -f $(MAKEFILE) COMPRESSION=-C OFLAGS= check + @-delete scan.c quiet + $(MAKE) -f $(MAKEFILE) COMPRESSION=-Ce OFLAGS= check + @-delete scan.c quiet + $(MAKE) -f $(MAKEFILE) COMPRESSION=-Cm OFLAGS= check + @-delete scan.c quiet + $(MAKE) -f $(MAKEFILE) COMPRESSION=-Cfea OFLAGS= check + @-delete scan.c quiet + $(MAKE) -f $(MAKEFILE) COMPRESSION=-CFer OFLAGS= check + @-delete scan.c quiet + $(MAKE) -f $(MAKEFILE) COMPRESSION=-l PERF_REPORT= OFLAGS= check + @-delete scan.c quiet + $(MAKE) -f $(MAKEFILE) + @echo "*E[33mAll checks successful*E[0m" + + $(FLEXLIB): $(LIBOBJS) + $(AR) $(FLEXLIB) r $(LIBOBJS) + + flex.man: flex.1 + groff -Tascii -man flex.1 >flex.man + + flexdoc.man: flexdoc.1 + groff -Tascii -man flexdoc.1 >flexdoc.man + + install: flex $(FLEXLIB) + copy flex $(BINDIR)flex + copy flex "$(BINDIR)flex++" + copy fl.lib $(LIBDIR)fl.lib + copy FlexLexer.h $(INCLUDEDIR)FlexLexer.h + + uninstall: + -delete $(BINDIR)flex $(BINDIR)flex++ quiet + -delete $(LIBDIR)fl.lib quiet + -delete $(INCLUDEDIR)FlexLexer.h quiet + + mostlyclean: + -delete scan.tmp quiet + + clean: mostlyclean + -delete parse.c parse.h \#?.o alloca.c flex.lnk $(FLEXLIB) quiet + + distclean: clean + -delete .bootstrap flex scan.c config.h quiet + + realclean: distclean + -delete flex.man flexdoc.man quiet diff -crN ram:flex-2.4.7/config.h.amiga dh1:flex-2.4.7/config.h.amiga *** ram:flex-2.4.7/config.h.amiga --- dh1:flex-2.4.7/config.h.amiga Mon Aug 22 20:17:26 1994 *************** *** 0 **** --- 1,11 ---- + /* This is a kludge to get the prototypes for alloca.c right on the Amiga + * so it can be compiled with the parm=r or parm=b option. + */ + + #ifdef __SASC + #include /* Get prototype for free() */ + #include "flexdef.h" /* Get prototype for yy_flex_xmalloc() */ + #undef NULL /* NULL is defined in and redefined in alloca.c */ + + extern void *alloca(unsigned size); + #endif diff -crN ram:flex-2.4.7/dfa.c dh1:flex-2.4.7/dfa.c *** ram:flex-2.4.7/dfa.c Tue Jan 04 23:33:16 1994 --- dh1:flex-2.4.7/dfa.c Mon Aug 22 20:17:27 1994 *************** *** 37,42 **** --- 37,49 ---- void dump_transitions PROTO((FILE*, int[])); void sympartition PROTO((int[], int, int[], int[])); int symfollowset PROTO((int[], int, int, int[])); + void check_for_backing_up PROTO((int ds,int state[])); + void check_trailing_context PROTO((int *nfa_states, int num_states, + int *accset, register int nacc)); + int *epsclosure PROTO((int *t, int *ns_addr, int accset[], int *nacc_addr, + int *hv_addr)); + int snstods PROTO((int sns[], int numstates, int accset[], int nacc, + int hashval, int *newds_addr)); /* check_for_backing_up - check a DFA state for backing up diff -crN ram:flex-2.4.7/flex.skl dh1:flex-2.4.7/flex.skl *** ram:flex-2.4.7/flex.skl Wed Aug 03 20:37:36 1994 --- dh1:flex-2.4.7/flex.skl Mon Aug 22 20:17:28 1994 *************** *** 8,13 **** --- 8,16 ---- %- #include + #if defined(__SASC) && defined(_AMIGA) + #include + #endif %* diff -crN ram:flex-2.4.7/flexdef.h dh1:flex-2.4.7/flexdef.h *** ram:flex-2.4.7/flexdef.h Tue Jan 04 23:33:14 1994 --- dh1:flex-2.4.7/flexdef.h Mon Aug 22 20:17:30 1994 *************** *** 781,786 **** --- 781,788 ---- /* Set a region of memory to 0. */ extern void zero_out PROTO((char *, int)); + /* Replace upper-case letter to lower-case */ + extern Char clower PROTO((int c)); /* from file nfa.c */ *************** *** 823,829 **** --- 825,839 ---- extern void new_rule PROTO((void)); /* initialize for a new rule */ + /* Returns a dynamically allocated copy of a string */ + extern char *copy_string PROTO((register char *str)); + /* Returns a dynamically allocated copy of a (potentially) unsigned string */ + extern Char *copy_unsigned_string PROTO((register Char *str)); + + /* Return character corresponding to escape sequence */ + extern Char myesc PROTO((Char array[])); + /* from file parse.y */ /* Write out a message formatted with one string, pinpointing its location. */ *************** *** 866,871 **** --- 876,883 ---- extern int ccllookup PROTO((Char [])); extern void ndinstal PROTO((char[], Char[])); /* install a name definition */ + extern Char *ndlookup PROTO((char nd[])); /* lookup a name definition */ + /* Increase maximum number of SC's. */ extern void scextend PROTO((void)); extern void scinstal PROTO((char[], int)); /* make a start condition */ diff -crN ram:flex-2.4.7/gen.c dh1:flex-2.4.7/gen.c *** ram:flex-2.4.7/gen.c Wed Aug 03 20:37:50 1994 --- dh1:flex-2.4.7/gen.c Mon Aug 22 20:19:27 1994 *************** *** 37,42 **** --- 37,53 ---- void genecs PROTO((void)); void indent_put2s PROTO((char [], char [])); void indent_puts PROTO((char [])); + void do_indent PROTO((void)); + void gen_backing_up PROTO((void)); + void gen_bu_action PROTO((void)); + void genctbl PROTO((void)); + void gen_find_action PROTO((void)); + void genftbl PROTO((void)); + void gen_next_compressed_state PROTO((char *char_map)); + void gen_next_match PROTO((void)); + void gen_NUL_trans PROTO((void)); + void gen_start_state PROTO((void)); + void gentabs PROTO((void)); static int indent_level = 0; /* each level is 8 spaces */ *************** *** 170,175 **** --- 181,187 ---- /* So that "make test" won't show arb. differences. */ nxt[tblend + 2] = 0; + dfaacc[0].dfaacc_state = 0; /* Make sure every state has an end-of-buffer transition and an * action #. *************** *** 755,766 **** { int i, j, k, *accset, nacc, *acc_array, total_states; int end_of_buffer_action = num_rules + 1; - - /* *Everything* is done in terms of arrays starting at 1, so provide - * a null entry for the zero element of all C arrays. - */ - static char C_char_decl[] = - "static const YY_CHAR %s[%d] =\n { 0,\n"; /* } for vi */ acc_array = allocate_integer_array( current_max_dfas ); nummt = 0; --- 767,772 ---- diff -crN ram:flex-2.4.7/initscan.c dh1:flex-2.4.7/initscan.c *** ram:flex-2.4.7/initscan.c Wed Aug 03 20:42:46 1994 --- dh1:flex-2.4.7/initscan.c Mon Aug 22 20:17:33 1994 *************** *** 7,12 **** --- 7,15 ---- #define FLEX_SCANNER #include + #if defined(__SASC) && defined(_AMIGA) + #include + #endif /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ diff -crN ram:flex-2.4.7/libmain.c dh1:flex-2.4.7/libmain.c *** ram:flex-2.4.7/libmain.c Fri Sep 17 05:32:36 1993 --- dh1:flex-2.4.7/libmain.c Mon Aug 22 20:17:33 1994 *************** *** 2,8 **** --- 2,12 ---- /* $Header: /home/daffy/u0/vern/flex/RCS/libmain.c,v 1.3 93/04/14 22:41:55 vern Exp $ */ + #ifdef __STDC__ + extern int yylex(void); + #else extern int yylex(); + #endif int main( argc, argv ) int argc; diff -crN ram:flex-2.4.7/libyywrap.c dh1:flex-2.4.7/libyywrap.c *** ram:flex-2.4.7/libyywrap.c Sat Oct 02 23:23:18 1993 --- dh1:flex-2.4.7/libyywrap.c Mon Aug 22 20:17:34 1994 *************** *** 2,7 **** --- 2,11 ---- /* $Header: /home/daffy/u0/vern/flex/RCS/libyywrap.c,v 1.1 93/10/02 15:23:09 vern Exp $ */ + #ifdef __STDC__ + int yywrap(void); + #endif + int yywrap() { return 1; diff -crN ram:flex-2.4.7/misc.c dh1:flex-2.4.7/misc.c *** ram:flex-2.4.7/misc.c Tue Jan 04 23:33:10 1994 --- dh1:flex-2.4.7/misc.c Mon Aug 22 20:17:37 1994 *************** *** 36,41 **** --- 36,43 ---- void dataflush PROTO((void)); int otoi PROTO((Char [])); + int htoi PROTO((Char str[])); + int is_hex_digit PROTO((int ch)); void add_action( new_text ) *************** *** 355,361 **** (void) sscanf( (char *) str, "%x", &result ); ! return result; } --- 357,363 ---- (void) sscanf( (char *) str, "%x", &result ); ! return (int)result; } *************** *** 585,591 **** unsigned int result; (void) sscanf( (char *) str, "%o", &result ); ! return result; } --- 587,593 ---- unsigned int result; (void) sscanf( (char *) str, "%o", &result ); ! return (int)result; } diff -crN ram:flex-2.4.7/mkskel.amiga dh1:flex-2.4.7/mkskel.amiga *** ram:flex-2.4.7/mkskel.amiga --- dh1:flex-2.4.7/mkskel.amiga Mon Aug 22 20:17:38 1994 *************** *** 0 **** --- 1,19 ---- + .key IN,OUT + .bra ( + .ket ) + + echo "/** File created from flex.skel via mkskel.sh **/" >(OUT) + echo "" >>(OUT) + echo "#include *"flexdef.h*"" >>(OUT) + echo "" >>(OUT) + echo "char **skel[] = {" >>(OUT) + + sed s/\\/&&/g <(IN) >t:tmp1 + sed s/"/\\"/g t:tmp2 + sed s/.*/"&",/ t:tmp3 + sed "s/^/ /" >(OUT) + + echo " 0" >>(OUT) + echo "};" >>(OUT) + + delete t:tmp1 t:tmp2 t:tmp3 quiet force diff -crN ram:flex-2.4.7/parse.y dh1:flex-2.4.7/parse.y *** ram:flex-2.4.7/parse.y Thu Dec 09 22:57:32 1993 --- dh1:flex-2.4.7/parse.y Mon Aug 22 20:17:39 1994 *************** *** 62,69 **** int trlcontxt, xcluflg, cclsorted, varlength, variable_trail_rule; int *active_ss; Char clower(); ! void build_eof_action(); ! void yyerror(); static int madeany = false; /* whether we've made the '.' character class */ int previous_continued_action; /* whether the previous rule's action was '|' */ --- 62,69 ---- int trlcontxt, xcluflg, cclsorted, varlength, variable_trail_rule; int *active_ss; Char clower(); ! void build_eof_action PROTO((void)); ! void yyerror PROTO((char msg[])); static int madeany = false; /* whether we've made the '.' character class */ int previous_continued_action; /* whether the previous rule's action was '|' */ diff -crN ram:flex-2.4.7/skel.c dh1:flex-2.4.7/skel.c *** ram:flex-2.4.7/skel.c Wed Aug 03 20:38:32 1994 --- dh1:flex-2.4.7/skel.c Mon Aug 22 20:17:40 1994 *************** *** 13,18 **** --- 13,21 ---- "", "%-", "#include ", + "#if defined(__SASC) && defined(_AMIGA)", + "#include ", + "#endif", "%*", "", "", diff -crN ram:flex-2.4.7/sym.c dh1:flex-2.4.7/sym.c *** ram:flex-2.4.7/sym.c Tue Jan 04 23:33:08 1994 --- dh1:flex-2.4.7/sym.c Mon Aug 22 20:17:41 1994 *************** *** 34,46 **** /* declare functions that have forward references */ int hashfunct PROTO((register char[], int)); struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE]; struct hash_entry *sctbl[START_COND_HASH_SIZE]; struct hash_entry *ccltab[CCL_HASH_SIZE]; - - struct hash_entry *findsym(); /* addsym - add symbol and definitions to symbol table --- 34,48 ---- /* declare functions that have forward references */ int hashfunct PROTO((register char[], int)); + struct hash_entry *findsym PROTO((register char sym[], hash_table table, + int table_size)); + int addsym PROTO((register char sym[], char *str_def, int int_def, + hash_table table, int table_size)); struct hash_entry *ndtbl[NAME_TABLE_HASH_SIZE]; struct hash_entry *sctbl[START_COND_HASH_SIZE]; struct hash_entry *ccltab[CCL_HASH_SIZE]; /* addsym - add symbol and definitions to symbol table diff -crN ram:flex-2.4.7/tblcmp.c dh1:flex-2.4.7/tblcmp.c *** ram:flex-2.4.7/tblcmp.c Tue Dec 07 19:18:34 1993 --- dh1:flex-2.4.7/tblcmp.c Mon Aug 22 20:17:43 1994 *************** *** 38,43 **** --- 38,44 ---- void mktemplate PROTO((int[], int, int)); void mv2front PROTO((int)); int tbldiff PROTO((int[], int, int[])); + int find_table_space PROTO((int *state, int numtrans)); /* bldtbl - build table entries for dfa state