Annotation of researchv10dc/cmd/flex/MISC, revision 1.1

1.1     ! root        1: Miscellaneous flex stuff.  In here you'll find an out-of-date VMS makefile
        !             2: for flex and notes someone sent me regarding converting flex to deal with
        !             3: 8 bit characters.  This stuff is provided so that ambitious folks can pick
        !             4: it up and turn it into something viable.  I'd appreciate being sent any
        !             5: updates resulting from work on this.
        !             6: 
        !             7: The makefile is from Fred Brehm ([email protected]); the 8 bit chars
        !             8: from Earle Horton ([email protected]).
        !             9: 
        !            10: 
        !            11: 
        !            12: ############################ VMS MAKEFILE ##############################
        !            13: 
        !            14: # VMS make file for "flex" tool
        !            15: 
        !            16: # Redefine the following for your own environment
        !            17: BIN = tools$$exe
        !            18: LIB = tools$$library
        !            19: INC = tools$$include
        !            20: MAN = tools$$manual
        !            21: LINKFLAGS = ,$(LIB):cc/opt
        !            22: 
        !            23: SKELETON_FILE = "DEFAULT_SKELETON_FILE=""$(LIB):FLEX.SKEL"""
        !            24: F_SKELETON_FILE = "FAST_SKELETON_FILE=""$(LIB):FLEX.FASTSKEL"""
        !            25: 
        !            26: CCFLAGS = VMS
        !            27: FLEX_FLAGS = -is
        !            28: 
        !            29: FLEXOBJS = ccl.obj dfa.obj ecs.obj main.obj misc.obj nfa.obj parse.obj \
        !            30: scan.obj sym.obj tblcmp.obj yylex.obj
        !            31: 
        !            32: OBJ = ccl.obj,dfa.obj,ecs.obj,main.obj,misc.obj,nfa.obj,parse.obj,\
        !            33: scan.obj,sym.obj,tblcmp.obj,yylex.obj
        !            34: 
        !            35: default : flex
        !            36: install : inc lib bin man
        !            37: inc : $(INC):flexskeldef.h $(INC):fastskeldef.h $(INC):flexskelcom.h
        !            38: lib : $(LIB):flex.skel $(LIB):flex.fastskel
        !            39: bin : $(BIN):flex
        !            40:        flex :== $$ $(BIN):flex
        !            41: man : $(MAN):flex.doc
        !            42: 
        !            43: $(INC):flexskeldef.h : flexskeldef.h
        !            44:        copy flexskeldef.h $(INC)
        !            45: $(INC):fastskeldef.h : fastskeldef.h
        !            46:        copy fastskeldef.h $(INC)
        !            47: $(INC):flexskelcom.h : flexskelcom.h
        !            48:        copy flexskelcom.h $(INC)
        !            49: $(LIB):flex.skel : flex.skel
        !            50:        copy flex.skel $(LIB)
        !            51: $(LIB):flex.fastskel : flex.fastskel
        !            52:        copy flex.fastskel $(LIB)
        !            53: $(BIN):flex.exe : flex.exe
        !            54:        copy flex.exe $(BIN)
        !            55: $(MAN):flex.doc : flex.doc
        !            56:        copy flex.doc $(MAN)
        !            57: 
        !            58: flex : flex.exe
        !            59:        flex :== $$ 'f$$environment("default")'flex
        !            60: 
        !            61: flex.exe : $(FLEXOBJS)
        !            62:        link /exe=flex $(OBJ) $(LINKFLAGS)
        !            63: 
        !            64: parse.h : parse.c
        !            65: 
        !            66: parse.c : parse.y
        !            67:        yacc :== $$ sys$$sysroot:[shellexe]yacc
        !            68:        yacc -d parse.y
        !            69:        copy y_tab.c parse.c
        !            70:        copy y_tab.h parse.h
        !            71:        del y_tab.h;*,y_tab.c;*
        !            72: 
        !            73: #scan.c : scan.l
        !            74: #      flex $(FLEX_FLAGS) scan.l
        !            75: #      copy lex_yy.c scan.c
        !            76: #      del lex_yy.c;*
        !            77: scan.c : scan.dist
        !            78:        copy scan.dist scan.c
        !            79: 
        !            80: ccl.obj : ccl.c flexdef.h
        !            81:        cc /define=$(CCFLAGS) ccl.c
        !            82: dfa.obj : dfa.c flexdef.h
        !            83:        cc /define=$(CCFLAGS) dfa.c
        !            84: ecs.obj : ecs.c flexdef.h
        !            85:        cc /define=$(CCFLAGS) ecs.c
        !            86: main.obj : main.c flexdef.h
        !            87:        cc /define=($(CCFLAGS),$(SKELETON_FILE),$(F_SKELETON_FILE)) main.c
        !            88: misc.obj : misc.c flexdef.h
        !            89:        cc /define=$(CCFLAGS) misc.c
        !            90: nfa.obj : nfa.c flexdef.h
        !            91:        cc /define=$(CCFLAGS) nfa.c
        !            92: parse.obj : parse.c flexdef.h
        !            93:        cc /define=$(CCFLAGS) parse.c
        !            94: scan.obj : scan.c parse.h flexdef.h
        !            95:        cc /define=$(CCFLAGS) scan.c
        !            96: sym.obj : sym.c flexdef.h
        !            97:        cc /define=$(CCFLAGS) sym.c
        !            98: tblcmp.obj : tblcmp.c flexdef.h
        !            99:        cc /define=$(CCFLAGS) tblcmp.c
        !           100: yylex.obj : yylex.c parse.h flexdef.h
        !           101:        cc /define=$(CCFLAGS) yylex.c
        !           102: 
        !           103: clean :
        !           104:        del flex.exe;*
        !           105:        del scan.c;*
        !           106:        del parse.c;*
        !           107:        del parse.h;*
        !           108:        del lex_yy.c;*
        !           109:        del *.obj;*
        !           110:        del flex*.tmp;*
        !           111:        del *.diff;*
        !           112:        del y_tab.*;*
        !           113:        del makefile.;*
        !           114:        purge/log
        !           115:        copy makefile.vms makefile.
        !           116: 
        !           117: makefile : makefile.vms
        !           118:        copy makefile.vms makefile.
        !           119: 
        !           120: test : flex
        !           121:        define tools$$lib 'f$$environment("default")'
        !           122:        flex $(FLEX_FLAGS) scan.l
        !           123:        define tools$$lib tools$$sys:[lib]
        !           124:        diff/out=flex.diff scan.dist lex_yy.c
        !           125:        type/page flex.diff
        !           126: 
        !           127: 
        !           128: 
        !           129: ######################### Stuff for 8 Bit chars ########################
        !           130: 
        !           131: 
        !           132: Earle Horton has made a version of flex run on the MacIntosh under MPW.  Not
        !           133: being content to scan regular ascii, he deals with all 8 bits.  I also have
        !           134: wanted to write VMS filters that recognize <CSI>, etc. so I contacted him
        !           135: about his work.  He seems to be unable to reach you directly--the rest of
        !           136: this is his note...
        !           137: ---------------------------Note from Earle------------------
        !           138: >From [email protected] Fri May 27 11:33:09 1988
        !           139: Received: from DARTVAX.DARTMOUTH.EDU by megaron.arizona.edu; Fri, 27 May 88 10:55:39 MST
        !           140: Received: from eleazar.dartmouth.edu by dartvax.dartmouth.edu (5.59/3.4ROOT)
        !           141:        id AA17044; Fri, 27 May 88 13:53:18 EDT
        !           142: Received: by eleazar.dartmouth.edu (5.59/3.2LEAF)
        !           143:        id AA15906; Fri, 27 May 88 13:53:04 EDT
        !           144: Date: Fri, 27 May 88 13:53:04 EDT
        !           145: From: [email protected] (Earle R. Horton)
        !           146: Message-Id: <[email protected]>
        !           147: To: eleazar!earleh, [email protected], naucse!jdc
        !           148: Subject: Re: Flex and DEC multi-nationals, help!
        !           149: Status: R
        !           150: 
        !           151: John,
        !           152: 
        !           153:      I have posted the diffs to comp.sources.unix, and I think that
        !           154: they could be used to generate a VAX C version which scans DEC
        !           155: multi-nationals with little extra effort.  I tried the address which
        !           156: you give for Vern several times, only to have it bounce back to me for
        !           157: some mysterious reason known only to a mail daemon somewhere.  I would
        !           158: indeed appreciate it if you could forward this to him.
        !           159: 
        !           160:      I have found that the full internal representation of all
        !           161: characters as shorts is not necessary.  Rather, it is only necessary to
        !           162: 
        !           163:      a)  Prevent conversion of valid characters to negative ints.  I
        !           164:          do this with a mask, defined for the Mac and UNIX as 
        !           165:          "#define BYTEMASK 0xFF".  Any time a char is converted to an
        !           166:          int, AND it with the mask.  Then you don't have to declare
        !           167:          chars as unsigned chars, which is tiresome.
        !           168: 
        !           169:      b)  The routine mkeccl() uses negation of characters for a flag
        !           170:          to determine whether they have been processed.  I used a
        !           171:          debugger to estimate how many times this routine is actually
        !           172:          called when Flex scans scan.l.  Based on what this looked
        !           173:          like to me, I decided that it would be appropriate to have
        !           174:          only the routine mkeccl() use an array of shorts for its
        !           175:          internal processing.  When mkeccl() is called, it gets a
        !           176:          pointer to an array of shorts using alloca(), and then reads
        !           177:          the characters which it is to process into this array using
        !           178:          the method in (a).  When mkeccl() is done, the shorts are put
        !           179:          back into chars, and things proceed.  The internal processing
        !           180:          done by mkeccl() is the same.
        !           181: 
        !           182:      Flex compiled with these changes correctly scans all characters
        !           183: in the Macintosh character set, to the best of my ability to test it.
        !           184: In addition, it correctly scans chars with values > 127 on a UNIX VAX!
        !           185: Contrary to "common knowledge", text files which exist on a UNIX
        !           186: machine may have valid characters in the range [\0177-\0377].  An
        !           187: example is if I want to write a program to run on a UNIX machine which
        !           188: converts German characters to ASCII.  The ess-tset (I believe that is
        !           189: the name) can be converted to "ss" with little loss of sense in most cases.
        !           190:          
        !           191:      The only question I have about my procedure is that it looks
        !           192: expensive to convert the ccltbl array to shorts and back every time
        !           193: mkeccl() is called.  However, the routine is not called an inordinately
        !           194: large number of times, and this conversion is probably not more
        !           195: expensive than a couple of calls to strcpy(), for instance.  To
        !           196: determine whether this is the most efficient method, one would have to
        !           197: go through the effort to convert Flex to use shorts for all internal
        !           198: representation, then profile the two methods.  Not my idea of a good
        !           199: time.
        !           200: 
        !           201:      Flex is a real nice program.  I couldn't find anything else wrong
        !           202: with it.
        !           203: 
        !           204: Earle Horton
        !           205: 
        !           206: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.