rsalz@bbn.com (Rich Salz) (10/11/90)
Submitted-by: Vern Paxson <vern@cs.cornell.edu> Posting-number: Volume 23, Issue 46 Archive-name: flex2.3/part10 #! /bin/sh # This is a shell archive. Remove anything before this line, then feed it # into a shell via "sh file" or similar. To overwrite existing files, # type "sh file -c". # The tool that generated this appeared in the comp.sources.unix newsgroup; # send mail to comp-sources-unix@uunet.uu.net if you want that tool. # Contents: MISC/Makefile.VMS Makefile ccl.c # Wrapped by rsalz@litchi.bbn.com on Wed Oct 10 13:24:06 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH echo If this archive is complete, you will see the following message: echo ' "shar: End of archive 10 (of 10)."' if test -f 'MISC/Makefile.VMS' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'MISC/Makefile.VMS'\" else echo shar: Extracting \"'MISC/Makefile.VMS'\" \(3537 characters\) sed "s/^X//" >'MISC/Makefile.VMS' <<'END_OF_FILE' X############################ VMS MAKEFILE ############################## X#IMPORTANT: Before you use this makefile fill in the contents of GNULIB. X# X# Define tools$$exe, tools$$library, and tools$$manual to reflect the X# locations where you would like to store the executables, library (flex.skel) X# and the manual pages. These names can be defined at the command line X# prompt: eg. X# $ define tools$$exe disk:[dir1.dir2.etc] X# X# Once these names have been defined the following commands X# can be executed at the command line: X# X# $ mms install X# $ mms test X# $ mms clean X# X# When "mms test" is executed the diff should not show any differences. In fact X# the same effect can be achieved by X# X# $ mms install, test, clean X# X# The filename of the the mms description file, i.e., this file, X# should either be "makefile." or "decrip.mms" X# X# VMS make file for "flex" tool X X# Redefine the following for your own environment XBIN = tools$$exe XLIB = tools$$library XMAN = tools$$manual XGNULIB = <******directory where you keep alloca.obj and bcopy.obj***> X XSKELETON_FILE = "DEFAULT_SKELETON_FILE=""$(LIB):FLEX.SKEL""" X XCCFLAGS = VMS,USG XFLEX_FLAGS = -is X XFLEXOBJS = ccl.obj dfa.obj ecs.obj gen.obj main.obj misc.obj nfa.obj - X parse.obj scan.obj sym.obj tblcmp.obj yylex.obj X XOBJ = ccl.obj,dfa.obj,ecs.obj,gen.obj,main.obj,misc.obj,nfa.obj,parse.obj, - X scan.obj,sym.obj,tblcmp.obj,yylex.obj X Xdefault : flex X ! installed FLEX X Xinstall : lib man bin X !Installed FLEX and LIBRARIES X Xlib : $(LIB):flex.skel X ! Installed $(LIB):flex.skel X Xbin : $(BIN):flex.exe X flex :== $ $(BIN):flex.exe X Xman : $(MAN):flex.doc X ! installed $(MAN):flex.doc X X$(LIB):flex.skel : flex.skel X copy flex.skel $(LIB):flex.skel X$(BIN):flex.exe : flex.exe X copy flex.exe $(BIN):flex.exe X$(MAN):flex.doc : flex.1 X copy flex.1 $(MAN):flex.doc X Xflex : flex.exe X copy flex.exe $(BIN):flex.exe X Xflex.exe : $(FLEXOBJS) X link /exe=flex.exe - X $(OBJ), - X $(GNULIB)alloca.obj, - X $(GNULIB)bcopy.obj X X Xparse.c : parse.y X bison/defines/verbose/fixed_outfiles parse.y X copy y_tab.c parse.c X del/noconfirm y_tab.c;* X Xparse.h : parse.c X copy y_tab.h parse.h X del/noconfirm y_tab.h;* X Xscan.c : initscan.c X copy initscan.c scan.c X Xccl.obj : ccl.c flexdef.h X cc /define=($(CCFLAGS)) ccl.c Xdfa.obj : dfa.c flexdef.h X cc /define=($(CCFLAGS)) dfa.c Xecs.obj : ecs.c flexdef.h X cc /define=($(CCFLAGS)) ecs.c Xgen.obj : gen.c flexdef.h X cc /define=($(CCFLAGS)) gen.c Xmain.obj : main.c flexdef.h X cc /define=($(CCFLAGS),$(SKELETON_FILE)) main.c Xmisc.obj : misc.c flexdef.h X cc /define=($(CCFLAGS)) misc.c Xnfa.obj : nfa.c flexdef.h X cc /define=($(CCFLAGS)) nfa.c Xparse.obj : parse.c flexdef.h parse.h X cc /define=($(CCFLAGS)) parse.c Xscan.obj : scan.c parse.h flexdef.h X cc /define=($(CCFLAGS)) scan.c Xsym.obj : sym.c flexdef.h X cc /define=($(CCFLAGS)) sym.c Xtblcmp.obj : tblcmp.c flexdef.h X cc /define=($(CCFLAGS)) tblcmp.c Xyylex.obj : yylex.c parse.h flexdef.h X cc /define=($(CCFLAGS)) yylex.c X Xclean : X ! Cleaning up by deleting unnecessary object files etc. X - delete/noconfirm scan.c;* X - delete/noconfirm parse.c;* X - delete/noconfirm parse.h;* X - delete/noconfirm lexyy.c;* X - delete/noconfirm *.obj;* X - delete/noconfirm flex*.tmp;* X - delete/noconfirm y.output;* X - delete/noconfirm *.diff;* X - delete/noconfirm y_tab.*;* X - purge/log X Xtest : $(BIN):flex.exe X flex :== $ $(BIN):flex.exe X define tools$$library 'f$environment("default")' X sho log tool$$library X flex $(FLEX_FLAGS) scan.l X diff/out=flex.diff initscan.c lexyy.c X type/page flex.diff END_OF_FILE if test 3537 -ne `wc -c <'MISC/Makefile.VMS'`; then echo shar: \"'MISC/Makefile.VMS'\" unpacked with wrong size! fi # end of 'MISC/Makefile.VMS' fi if test -f 'Makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'Makefile'\" else echo shar: Extracting \"'Makefile'\" \(4876 characters\) sed "s/^X//" >'Makefile' <<'END_OF_FILE' X# make file for "flex" tool X X# @(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/Makefile,v 2.9 90/05/26 17:28:44 vern Exp $ (LBL) X X# Porting considerations: X# X# For System V Unix machines, add -DUSG to CFLAGS (if it's not X# automatically defined) X# For Vax/VMS, add "-DVMS -DUSG" to CFLAGS. X# For MS-DOS, add "-DMS_DOS -DUSG" to CFLAGS. Create \tmp if not present. X# You will also want to rename flex.skel to something with a three X# character extension, change SKELETON_FILE below appropriately, X# See MSDOS.notes for more info. X# For Amiga, add "-DAMIGA -DUSG" to CFLAGS. X# For SCO Unix, add "-DSCO_UNIX" to CFLAGS. X# X# For C compilers which don't know about "void", add -Dvoid=int to CFLAGS. X# X# If your C compiler is ANSI standard but does not include the <stdlib.h> X# header file (some installations of gcc have this problem), then add X# -DDONT_HAVE_STDLIB_H to CFLAGS. X# X# By default, flex will be configured to generate 8-bit scanners only X# if the -8 flag is given. If you want it to always generate 8-bit X# scanners, add "-DDEFAULT_CSIZE=256" to CFLAGS. Note that doing X# so will double the size of all uncompressed scanners. X# X# If on your system you have trouble building flex due to 8-bit X# character problems, remove the -8 from FLEX_FLAGS and the X# "#define FLEX_8_BIT_CHARS" from the beginning of flexdef.h. X X X# the first time around use "make first_flex" X X X# Installation targeting. Files will be installed under the tree rooted X# at DESTDIR. User commands will be installed in BINDIR, library files X# in LIBDIR (which will be created if necessary), auxiliary files in X# AUXDIR, manual pages will be installed in MANDIR with extension MANEXT. X# Raw, unformatted troff source will be installed if INSTALLMAN=man, nroff X# preformatted versions will be installed if INSTALLMAN=cat. XDESTDIR = XBINDIR = /usr/local XLIBDIR = /usr/local/lib XAUXDIR = /usr/local/lib XMANDIR = /usr/man/manl XMANEXT = l XINSTALLMAN = man X X# MAKE = make X X XSKELETON_FILE = $(DESTDIR)$(AUXDIR)/flex.skel XSKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\" XCFLAGS = -O XLDFLAGS = -s X XCOMPRESSION = XFLEX_FLAGS = -ist8 -Sflex.skel X# which "flex" to use to generate scan.c from scan.l XFLEX = ./flex X# CC = cc X XAR = ar XRANLIB = ranlib X XFLEXOBJS = \ X ccl.o \ X dfa.o \ X ecs.o \ X gen.o \ X main.o \ X misc.o \ X nfa.o \ X parse.o \ X scan.o \ X sym.o \ X tblcmp.o \ X yylex.o X XFLEX_C_SOURCES = \ X ccl.c \ X dfa.c \ X ecs.c \ X gen.c \ X main.c \ X misc.c \ X nfa.c \ X parse.c \ X scan.c \ X sym.c \ X tblcmp.c \ X yylex.c X XFLEX_LIB_OBJS = \ X libmain.o X XFLEXLIB = flexlib.a X X Xall : flex $(FLEXLIB) X Xflex : $(FLEXOBJS) X $(CC) $(CFLAGS) -o flex $(LDFLAGS) $(FLEXOBJS) X Xfirst_flex: X cp initscan.c scan.c X $(MAKE) $(MFLAGS) flex X Xparse.h parse.c : parse.y X $(YACC) -d parse.y X @mv y.tab.c parse.c X @mv y.tab.h parse.h X Xscan.c : scan.l X $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) scan.l >scan.c X Xscan.o : scan.c parse.h flexdef.h X Xmain.o : main.c flexdef.h X $(CC) $(CFLAGS) -c $(SKELFLAGS) main.c X Xccl.o : ccl.c flexdef.h Xdfa.o : dfa.c flexdef.h Xecs.o : ecs.c flexdef.h Xgen.o : gen.c flexdef.h Xmisc.o : misc.c flexdef.h Xnfa.o : nfa.c flexdef.h Xparse.o : parse.c flexdef.h Xsym.o : sym.c flexdef.h Xtblcmp.o : tblcmp.c flexdef.h Xyylex.o : yylex.c flexdef.h X Xflex.man : flex.1 X nroff -man flex.1 >flex.man X X$(FLEXLIB) : $(FLEX_LIB_OBJS) X $(AR) cru $(FLEXLIB) $(FLEX_LIB_OBJS) X Xlint : $(FLEX_C_SOURCES) X lint $(FLEX_C_SOURCES) > flex.lint X Xdistrib : X mv scan.c initscan.c X chmod 444 initscan.c X $(MAKE) $(MFLAGS) clean X Xinstall: flex $(DESTDIR)$(LIBDIR) flex.skel install.$(INSTALLMAN) install-lib X install -s -m 755 flex $(DESTDIR)$(BINDIR)/flex X install -c -m 644 flex.skel $(SKELETON_FILE) X Xinstall-lib: $(DESTDIR)$(LIBDIR) $(FLEXLIB) X install -c -m 644 $(FLEXLIB) $(DESTDIR)$(LIBDIR)/libfl.a X $(RANLIB) $(DESTDIR)$(LIBDIR)/libfl.a X X$(DESTDIR)$(LIBDIR): X mkdir $@ X Xinstall.man: flex.1 flexdoc.1 X install -c -m 644 flex.1 $(DESTDIR)$(MANDIR)/flex.$(MANEXT) X install -c -m 644 flexdoc.1 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT) X Xinstall.cat: flex.1 flexdoc.1 X nroff -h -man flex.1 > $(DESTDIR)$(MANDIR)/flex.$(MANEXT) X nroff -h -man flexdoc.1 > $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT) X chmod 644 $(DESTDIR)$(MANDIR)/flex.$(MANEXT) X chmod 644 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT) X Xclean : X rm -f core errs flex *.o parse.c *.lint parse.h flex.man tags \ X $(FLEXLIB) X Xtags : X ctags $(FLEX_C_SOURCES) X Xvms : flex.man X $(MAKE) $(MFLAGS) distrib X Xtest : flex X ./flex $(FLEX_FLAGS) $(COMPRESSION) scan.l | diff scan.c - X Xbigtest : X rm -f scan.c ; $(MAKE) COMPRESSION="-C" test X rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test X rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test X rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test X rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test X rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test X rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test X rm -f scan.c ; $(MAKE) END_OF_FILE if test 4876 -ne `wc -c <'Makefile'`; then echo shar: \"'Makefile'\" unpacked with wrong size! fi # end of 'Makefile' fi if test -f 'ccl.c' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'ccl.c'\" else echo shar: Extracting \"'ccl.c'\" \(4115 characters\) sed "s/^X//" >'ccl.c' <<'END_OF_FILE' X/* ccl - routines for character classes */ X X/*- X * Copyright (c) 1990 The Regents of the University of California. X * All rights reserved. X * X * This code is derived from software contributed to Berkeley by X * Vern Paxson. X * X * The United States Government has rights in this work pursuant X * to contract no. DE-AC03-76SF00098 between the United States X * Department of Energy and the University of California. X * X * Redistribution and use in source and binary forms are permitted provided X * that: (1) source distributions retain this entire copyright notice and X * comment, and (2) distributions including binaries display the following X * acknowledgement: ``This product includes software developed by the X * University of California, Berkeley and its contributors'' in the X * documentation or other materials provided with the distribution and in X * all advertising materials mentioning features or use of this software. X * Neither the name of the University nor the names of its contributors may X * be used to endorse or promote products derived from this software without X * specific prior written permission. X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED X * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF X * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. X */ X X#ifndef lint Xstatic char rcsid[] = X "@(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/ccl.c,v 2.5 90/06/27 23:48:13 vern Exp $ (LBL)"; X#endif X X#include "flexdef.h" X X/* ccladd - add a single character to a ccl X * X * synopsis X * int cclp; X * int ch; X * ccladd( cclp, ch ); X */ X Xvoid ccladd( cclp, ch ) Xint cclp; Xint ch; X X { X int ind, len, newpos, i; X X len = ccllen[cclp]; X ind = cclmap[cclp]; X X /* check to see if the character is already in the ccl */ X X for ( i = 0; i < len; ++i ) X if ( ccltbl[ind + i] == ch ) X return; X X newpos = ind + len; X X if ( newpos >= current_max_ccl_tbl_size ) X { X current_max_ccl_tbl_size += MAX_CCL_TBL_SIZE_INCREMENT; X X ++num_reallocs; X X ccltbl = reallocate_character_array( ccltbl, current_max_ccl_tbl_size ); X } X X ccllen[cclp] = len + 1; X ccltbl[newpos] = ch; X } X X X/* cclinit - make an empty ccl X * X * synopsis X * int cclinit(); X * new_ccl = cclinit(); X */ X Xint cclinit() X X { X if ( ++lastccl >= current_maxccls ) X { X current_maxccls += MAX_CCLS_INCREMENT; X X ++num_reallocs; X X cclmap = reallocate_integer_array( cclmap, current_maxccls ); X ccllen = reallocate_integer_array( ccllen, current_maxccls ); X cclng = reallocate_integer_array( cclng, current_maxccls ); X } X X if ( lastccl == 1 ) X /* we're making the first ccl */ X cclmap[lastccl] = 0; X X else X /* the new pointer is just past the end of the last ccl. Since X * the cclmap points to the \first/ character of a ccl, adding the X * length of the ccl to the cclmap pointer will produce a cursor X * to the first free space X */ X cclmap[lastccl] = cclmap[lastccl - 1] + ccllen[lastccl - 1]; X X ccllen[lastccl] = 0; X cclng[lastccl] = 0; /* ccl's start out life un-negated */ X X return ( lastccl ); X } X X X/* cclnegate - negate a ccl X * X * synopsis X * int cclp; X * cclnegate( ccl ); X */ X Xvoid cclnegate( cclp ) Xint cclp; X X { X cclng[cclp] = 1; X } X X X/* list_character_set - list the members of a set of characters in CCL form X * X * synopsis X * int cset[CSIZE]; X * FILE *file; X * list_character_set( cset ); X * X * writes to the given file a character-class representation of those X * characters present in the given set. A character is present if it X * has a non-zero value in the set array. X */ X Xvoid list_character_set( file, cset ) XFILE *file; Xint cset[]; X X { X register int i; X char *readable_form(); X X putc( '[', file ); X X for ( i = 0; i < csize; ++i ) X { X if ( cset[i] ) X { X register int start_char = i; X X putc( ' ', file ); X X fputs( readable_form( i ), file ); X X while ( ++i < csize && cset[i] ) X ; X X if ( i - 1 > start_char ) X /* this was a run */ X fprintf( file, "-%s", readable_form( i - 1 ) ); X X putc( ' ', file ); X } X } X X putc( ']', file ); X } END_OF_FILE if test 4115 -ne `wc -c <'ccl.c'`; then echo shar: \"'ccl.c'\" unpacked with wrong size! fi # end of 'ccl.c' fi echo shar: End of archive 10 \(of 10\). cp /dev/null ark10isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 10 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still must unpack the following archives: echo " " ${MISSING} fi exit 0 exit 0 # Just in case... -- Please send comp.sources.unix-related mail to rsalz@uunet.uu.net. Use a domain-based address or give alternate paths, or you may lose out.