New installation mechanism
authorceriel <none@none>
Mon, 26 Aug 1991 14:29:59 +0000 (14:29 +0000)
committerceriel <none@none>
Mon, 26 Aug 1991 14:29:59 +0000 (14:29 +0000)
lang/cem/cemcom.ansi/.distr
lang/cem/cemcom.ansi/cemcom.ansi.1 [new file with mode: 0644]
lang/cem/cemcom.ansi/proto.main [new file with mode: 0644]
lang/cem/cemcom.ansi/proto.make [new file with mode: 0644]

index 3581d2b..d69a5aa 100644 (file)
@@ -1,5 +1,6 @@
 Version.c
-Makefile
+proto.make
+proto.main
 Resolve
 nmclash.c
 LLlex.c
@@ -14,9 +15,7 @@ arith.h
 assert.h
 atw.h
 blocks.c
-cem.1
-cem.c
-cemcom.1
+cemcom.ansi.1
 ch3.c
 ch3bin.c
 ch3mon.c
@@ -75,7 +74,6 @@ make.hfiles
 make.next
 make.tokcase
 make.tokfile
-mcomm.c
 mes.h
 options
 options.c
diff --git a/lang/cem/cemcom.ansi/cemcom.ansi.1 b/lang/cem/cemcom.ansi/cemcom.ansi.1
new file mode 100644 (file)
index 0000000..f87376e
--- /dev/null
@@ -0,0 +1,103 @@
+.TH EM_CEMCOM.ANSI 6ACK
+.ad
+.SH NAME
+em_cemcom.ansi \- ANSI C to EM compiler
+.SH SYNOPSIS
+\fB~/em/lib.bin/em_cemcom.ansi\fP [\fIoptions\fP] \fIsource \fP[\fIdestination
+.SH DESCRIPTION
+\fICemcom\fP is a compiler that translates C programs
+into EM compact code.
+The input is taken from \fIsource\fP, while the
+EM code is written on \fIdestination\fP.
+If either of these two names is "\fB-\fP", standard input or output respectively
+is taken.
+When the preprocessor is invoked to run stand-alone, \fIdestination\fP
+needs not be specified.
+.br
+\fIOptions\fP is a, possibly empty, sequence of the following combinations:
+.IP \fB\-D\fIname\fR=\fItext\fR
+.br
+define \fIname\fR as a macro with \fItext\fR as its replacement text.
+.IP \fB\-D\fIname\fR
+.br
+the same as \fB\-D\fIname\fR=1.
+.IP \fB\-I\fIdirname\fR
+.br
+insert \fIdirname\fR in the list of include directories.
+.IP \fB\-M\fP\fIn\fP
+set maximum identifier length to \fIn\fP.
+.IP \fB\-g\fP
+produce a DBX-style symbol table.
+.IP \fB\-n\fR
+do not generate EM register messages.
+The user-declared variables are not stored into registers on the target
+machine.
+.IP \fB\-L\fR
+don't generate the EM \fBfil\fR and \fBlin\fR instructions 
+that usually are generated to enable
+an interpreter to keep track of the current location in the source code.
+.IP \fB\-p\fR
+generate code at each procedure entry to call the routine
+.BR procentry ,
+and at each return to call the routine
+.BE procexit .
+These routines are supplied with one parameter, a pointer to a
+string containing the name of the procedure.
+.IP \fB\-A\fR[\fIfile\fR]
+.br
+if \fIfile\fR is not given, generate a list
+of makefile dependencies and write them to the standard output.
+If \fIfile\fP is given,
+generate the list of makefile dependencies on file \fIfile\fP.
+.IP \fB-i\fR
+when generating makefile dependencies, do not include files from
+/usr/include.
+.IP \fB-m\fR
+when generating makefile dependencies, generate them in the following format:
+.RS
+.IP "file.o: file1.h"
+.RE
+.IP ""
+where "file.o" is derived from the source file name. Normally, only a list
+of files included is generated.
+.IP \fB\-R\fR
+interpret the input as restricted C (according to the language as 
+described in \fIThe C programming language\fR by Kernighan and Ritchie.)
+.IP \fB\-U\fIname\fR
+.br
+get rid of the compiler-predefined macro \fIname\fR.
+.IP \fB\-V\fIcm\fR.\fIn\fR,\ \fB\-V\fIcm\fR.\fIncm\fR.\fIn\fR\ ...
+.br
+set the size and alignment requirements.
+The letter \fIc\fR indicates the simple type, which is one of
+\fBs\fR(short), \fBi\fR(int), \fBl\fR(long), \fBf\fR(float), \fBd\fR(double),
+\fBx\fR(long double) or
+\fBp\fR(pointer).
+The \fIm\fR parameter can be used to specify the length of the type (in bytes)
+and the \fIn\fR parameter for the alignment of that type.
+Absence of \fIm\fR or \fIn\fR causes the default value to be retained.
+To specify that the bitfields should be right adjusted instead of the
+default left adjustment, specify \fBr\fR as \fIc\fR parameter.
+.IP \fB\-w\fR
+suppress warning messages.
+.IP \fB\-s\fR
+suppress stricts.
+.IP \fB\-a\fR
+suppress warnings and stricts.
+.IP \fB\-o\fR
+suppress warnings and stricts about old-style.
+.IP \fB\-\-\fItext\fR
+.br
+where \fItext\fR can be either of the above or
+a debug flag of the compiler (which is not useful for the common user.)
+This feature can be used in various shell scripts and surrounding programs
+to force a certain option to be handed over to \fBcemcom\fR.
+.LP
+.SH FILES
+.IR ~em/lib.bin/em_cemcom.ansi :
+the compiler
+.SH DIAGNOSTICS
+All warning and error messages are written on standard error output.
+.SH REFERENCE
+Baalbergen, E.H., D. Grune, M. Waage ;"\fIThe CEM compiler\fR", 
+Informatica Manual IM-4
diff --git a/lang/cem/cemcom.ansi/proto.main b/lang/cem/cemcom.ansi/proto.main
new file mode 100644 (file)
index 0000000..4116113
--- /dev/null
@@ -0,0 +1,64 @@
+# $Header$
+
+# C compilation part. Not to be called directly.
+# Instead, it is to be called by the Makefile.
+# SRC_DIR, UTIL_HOME, TARGET_HOME, CC, COPTIONS, LINT, LINTOPTIONS, LDOPTIONS,
+# CC_AND_MKDEP, SUF, LIBSUF should be set here.
+
+#PARAMS                do not remove this line!
+
+# PRODUCE is either e (readable EM) or k (compact EM)
+PRODUCE =      k
+
+MDIR =         $(TARGET_HOME)/modules
+LIBDIR =       $(MDIR)/lib
+LINTLIBDIR =   $(UTIL_HOME)/modules/lib
+
+MALLOC =       $(LIBDIR)/malloc.$(SUF)
+
+EMLIB =                $(LIBDIR)/libem_mes.$(LIBSUF) \
+               $(LIBDIR)/libem$(PRODUCE).$(LIBSUF)
+
+MODLIB =       $(LIBDIR)/libinput.$(LIBSUF) \
+               $(LIBDIR)/libassert.$(LIBSUF) \
+               $(LIBDIR)/liballoc.$(LIBSUF) \
+               $(MALLOC) \
+               $(LIBDIR)/libflt.$(LIBSUF) \
+               $(LIBDIR)/libprint.$(LIBSUF) \
+               $(LIBDIR)/libstring.$(LIBSUF) \
+               $(LIBDIR)/libsystem.$(LIBSUF)
+
+LIBS =         $(EMLIB) $(MODLIB)
+
+LINTLIBS =     $(LINTLIBDIR)/$(LINTPREF)em_mes.$(LINTSUF) \
+               $(LINTLIBDIR)/$(LINTPREF)emk.$(LINTSUF) \
+               $(LINTLIBDIR)/$(LINTPREF)input.$(LINTSUF) \
+               $(LINTLIBDIR)/$(LINTPREF)assert.$(LINTSUF) \
+               $(LINTLIBDIR)/$(LINTPREF)alloc.$(LINTSUF) \
+               $(LINTLIBDIR)/$(LINTPREF)flt.$(LINTSUF) \
+               $(LINTLIBDIR)/$(LINTPREF)print.$(LINTSUF) \
+               $(LINTLIBDIR)/$(LINTPREF)string.$(LINTSUF) \
+               $(LINTLIBDIR)/$(LINTPREF)system.$(LINTSUF)
+
+PROFILE =
+INCLUDES =     -I. -I$(SRC_DIR) -I$(TARGET_HOME)/modules/h -I$(TARGET_HOME)/h -I$(TARGET_HOME)/modules/pkg
+CFLAGS =       $(PROFILE) $(INCLUDES) $(COPTIONS)
+LINTFLAGS =    $(INCLUDES) $(LINTOPTIONS)
+LDFLAGS =      $(PROFILE) $(LDOPTIONS)
+
+# C_SRC and OBJ should be set here.
+#LISTS         do not remove this line!
+
+all:           main
+
+clean:
+               rm -f *.$(SUF) main
+
+lint:
+               $(LINT) $(LINTFLAGS) $(C_SRC) $(LINTLIBS)
+
+main:          $(OBJ)
+               $(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o main
+
+# do not remove the next line; it is used for generating dependencies
+#DEPENDENCIES
diff --git a/lang/cem/cemcom.ansi/proto.make b/lang/cem/cemcom.ansi/proto.make
new file mode 100644 (file)
index 0000000..408c793
--- /dev/null
@@ -0,0 +1,266 @@
+# $Header$
+
+# make ANSI C compiler
+
+#PARAMS                do not remove this line!
+
+UTIL_BIN = \
+       $(UTIL_HOME)/bin
+SRC_DIR = \
+       $(SRC_HOME)/lang/cem/cemcom.ansi
+
+TABGEN=        $(UTIL_BIN)/tabgen
+LLGEN =        $(UTIL_BIN)/LLgen
+LLGENOPTIONS = \
+       -v
+
+SRC_G =        $(SRC_DIR)/program.g $(SRC_DIR)/declar.g \
+       $(SRC_DIR)/expression.g $(SRC_DIR)/statement.g $(SRC_DIR)/ival.g
+GEN_G =        tokenfile.g
+GFILES=        $(GEN_G) $(SRC_G)
+
+SRC_C = \
+       $(SRC_DIR)/Version.c \
+       $(SRC_DIR)/LLlex.c \
+       $(SRC_DIR)/LLmessage.c \
+       $(SRC_DIR)/arith.c \
+       $(SRC_DIR)/blocks.c \
+       $(SRC_DIR)/ch3.c \
+       $(SRC_DIR)/ch3bin.c \
+       $(SRC_DIR)/ch3mon.c \
+       $(SRC_DIR)/code.c \
+       $(SRC_DIR)/conversion.c \
+       $(SRC_DIR)/cstoper.c \
+       $(SRC_DIR)/dataflow.c \
+       $(SRC_DIR)/declarator.c \
+       $(SRC_DIR)/decspecs.c \
+       $(SRC_DIR)/domacro.c \
+       $(SRC_DIR)/dumpidf.c \
+       $(SRC_DIR)/error.c \
+       $(SRC_DIR)/eval.c \
+       $(SRC_DIR)/expr.c \
+       $(SRC_DIR)/field.c \
+       $(SRC_DIR)/fltcstoper.c \
+       $(SRC_DIR)/idf.c \
+       $(SRC_DIR)/init.c \
+       $(SRC_DIR)/input.c \
+       $(SRC_DIR)/l_comment.c \
+       $(SRC_DIR)/l_ev_ord.c \
+       $(SRC_DIR)/l_lint.c \
+       $(SRC_DIR)/l_misc.c \
+       $(SRC_DIR)/l_outdef.c \
+       $(SRC_DIR)/l_states.c \
+       $(SRC_DIR)/label.c \
+       $(SRC_DIR)/main.c \
+       $(SRC_DIR)/options.c \
+       $(SRC_DIR)/pragma.c \
+       $(SRC_DIR)/proto.c \
+       $(SRC_DIR)/replace.c \
+       $(SRC_DIR)/skip.c \
+       $(SRC_DIR)/stab.c \
+       $(SRC_DIR)/stack.c \
+       $(SRC_DIR)/struct.c \
+       $(SRC_DIR)/switch.c \
+       $(SRC_DIR)/tokenname.c \
+       $(SRC_DIR)/type.c \
+       $(SRC_DIR)/util.c
+GEN_C =        tokenfile.c program.c declar.c expression.c statement.c ival.c \
+       symbol2str.c char.c Lpars.c next.c
+CFILES=        $(SRC_C) $(GEN_C)
+
+SRC_H = \
+       $(SRC_DIR)/LLlex.h \
+       $(SRC_DIR)/align.h \
+       $(SRC_DIR)/arith.h \
+       $(SRC_DIR)/assert.h \
+       $(SRC_DIR)/atw.h \
+       $(SRC_DIR)/class.h \
+       $(SRC_DIR)/decspecs.h \
+       $(SRC_DIR)/file_info.h \
+       $(SRC_DIR)/input.h \
+       $(SRC_DIR)/interface.h \
+       $(SRC_DIR)/l_class.h \
+       $(SRC_DIR)/l_comment.h \
+       $(SRC_DIR)/l_em.h \
+       $(SRC_DIR)/l_lint.h \
+       $(SRC_DIR)/label.h \
+       $(SRC_DIR)/level.h \
+       $(SRC_DIR)/mes.h \
+       $(SRC_DIR)/sizes.h \
+       $(SRC_DIR)/specials.h \
+       $(SRC_DIR)/tokenname.h
+
+GEN_H = botch_free.h dataflow.h debug.h density.h errout.h \
+        idfsize.h ifdepth.h inputtype.h macbuf.h lint.h \
+        nobitfield.h nopp.h nocross.h \
+        nparams.h numsize.h parbufsize.h pathlength.h Lpars.h \
+        strsize.h trgt_sizes.h textsize.h use_tmp.h spec_arith.h static.h \
+        regcount.h dbsymtab.h \
+       code.h declar.h def.h expr.h field.h estack.h util.h proto.h replace.h \
+       idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \
+       l_outdef.h stack.h
+
+HFILES=        $(GEN_H) $(SRC_H)
+
+NEXTFILES = \
+       $(SRC_DIR)/code.str \
+       $(SRC_DIR)/declar.str \
+       $(SRC_DIR)/def.str \
+       $(SRC_DIR)/expr.str \
+       $(SRC_DIR)/field.str \
+        $(SRC_DIR)/estack.str \
+       $(SRC_DIR)/util.str \
+       $(SRC_DIR)/proto.str \
+       $(SRC_DIR)/replace.str \
+        $(SRC_DIR)/idf.str \
+       $(SRC_DIR)/macro.str \
+       $(SRC_DIR)/stack.str \
+       $(SRC_DIR)/stmt.str \
+       $(SRC_DIR)/struct.str \
+       $(SRC_DIR)/switch.str \
+       $(SRC_DIR)/type.str \
+        $(SRC_DIR)/l_brace.str \
+       $(SRC_DIR)/l_state.str \
+       $(SRC_DIR)/l_outdef.str
+
+all:           make.main
+               make -f make.main main
+
+install:       all
+               @-mkdir $(TARGET_HOME)
+               @-mkdir $(TARGET_HOME)/lib.bin
+               cp main $(TARGET_HOME)/lib.bin/em_cemcom.ansi
+
+cmp:           all
+               -cmp main $(TARGET_HOME)/lib.bin/em_cemcom.ansi
+
+opr:
+               make pr | opr
+
+pr:
+               @pr $(SRC_DIR)/proto.make $(SRC_DIR)/proto.main Parameters \
+                       $(SRC_DIR)/char.tab $(SRC_G) $(SRC_H) $(NEXTFILES) $(SRC_C)
+
+lint:          make.main
+               make -f make.main lint
+
+Cfiles:                hfiles LLfiles $(GEN_C) $(GEN_H)
+               echo $(CFILES) | tr ' ' '\012' > Cfiles
+               echo $(HFILES) | tr ' ' '\012' >> Cfiles
+
+resolved:      Cfiles
+               CC="$(CC)" UTIL_HOME="$(UTIL_HOME)" do_resolve `cat Cfiles` > Cfiles.new
+               -if cmp -s Cfiles Cfiles.new ; then rm -f Cfiles.new ; else mv Cfiles.new Cfiles ; fi
+               touch resolved
+
+# there is no file called "dependencies"; we want dependencies checked 
+# every time. This means that make.main is made every time. Oh well ...
+# it does not take much time.
+dependencies:  resolved
+               do_deps `grep '.c$$' Cfiles`
+
+make.main:     dependencies make_macros lists $(SRC_DIR)/proto.main
+               sed -e '/^#DEPENDENCIES/,$$d' -e '/^#PARAMS/r make_macros' -e '/^#LISTS/r lists' $(SRC_DIR)/proto.main > make.main
+               echo '#DEPENDENCIES' >> make.main
+               cat *.dep >> make.main
+
+make_macros:   Makefile
+               echo 'SRC_DIR=$(SRC_DIR)' > make_macros
+               echo 'UTIL_HOME=$(UTIL_HOME)' >> make_macros
+               echo 'TARGET_HOME=$(TARGET_HOME)' >> make_macros
+               echo 'CC=$(CC)' >> make_macros
+               echo 'COPTIONS=$(COPTIONS)' >> make_macros
+               echo 'LDOPTIONS=$(LDOPTIONS)' >> make_macros
+               echo 'LINT=$(LINT)' >> make_macros
+               echo 'LINTOPTIONS=$(LINTOPTIONS)' >> make_macros
+               echo 'SUF=$(SUF)' >> make_macros
+               echo 'LIBSUF=$(LIBSUF)' >> make_macros
+               echo 'CC_AND_MKDEP=$(CC_AND_MKDEP)' >> make_macros
+
+lists:         Cfiles
+               echo "C_SRC = \\" > lists
+               echo $(CFILES) >> lists
+               echo "OBJ = \\" >> lists
+               echo $(CFILES) | sed -e 's#[^ ]*/##g' -e 's/\.c/.$$(SUF)/g' >> lists
+
+clean:
+               -make -f make.main clean
+               rm -f $(GEN_C) $(GEN_G) $(GEN_H) hfiles LLfiles Cfiles LL.output
+               rm -f resolved *.dep lists make.main make_macros
+
+LLfiles:       $(GFILES)
+               $(LLGEN) $(LLGENOPTIONS) $(GFILES)
+               @touch LLfiles
+
+hfiles:                Parameters $(SRC_DIR)/make.hfiles
+               $(SRC_DIR)/make.hfiles Parameters
+               touch hfiles
+
+tokenfile.g:   $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokfile
+               $(SRC_DIR)/make.tokfile <$(SRC_DIR)/tokenname.c >tokenfile.g
+
+symbol2str.c:  $(SRC_DIR)/tokenname.c $(SRC_DIR)/make.tokcase
+               $(SRC_DIR)/make.tokcase <$(SRC_DIR)/tokenname.c >symbol2str.c
+
+code.h:                $(SRC_DIR)/code.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/code.str > code.h
+
+declar.h:      $(SRC_DIR)/declar.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/declar.str > declar.h
+
+def.h: $(SRC_DIR)/def.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/def.str > def.h
+
+expr.h:        $(SRC_DIR)/expr.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/expr.str > expr.h
+
+field.h:       $(SRC_DIR)/field.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/field.str > field.h
+
+estack.h:      $(SRC_DIR)/estack.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/estack.str > estack.h
+
+util.h:        $(SRC_DIR)/util.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/util.str > util.h
+
+proto.h:       $(SRC_DIR)/proto.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/proto.str > proto.h
+
+replace.h:     $(SRC_DIR)/replace.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/replace.str > replace.h
+
+idf.h: $(SRC_DIR)/idf.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/idf.str > idf.h
+
+macro.h:       $(SRC_DIR)/macro.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/macro.str > macro.h
+
+stack.h:       $(SRC_DIR)/stack.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/stack.str > stack.h
+
+stmt.h:        $(SRC_DIR)/stmt.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/stmt.str > stmt.h
+
+struct.h:      $(SRC_DIR)/struct.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/struct.str > struct.h
+
+switch.h:      $(SRC_DIR)/switch.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/switch.str > switch.h
+
+type.h:        $(SRC_DIR)/type.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/type.str > type.h
+
+l_brace.h:     $(SRC_DIR)/l_brace.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_brace.str > l_brace.h
+
+l_state.h:     $(SRC_DIR)/l_state.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_state.str > l_state.h
+
+l_outdef.h:    $(SRC_DIR)/l_outdef.str $(SRC_DIR)/make.allocd
+               $(SRC_DIR)/make.allocd < $(SRC_DIR)/l_outdef.str > l_outdef.h
+
+next.c:                $(NEXTFILES) $(SRC_DIR)/make.next
+               $(SRC_DIR)/make.next $(NEXTFILES) > next.c
+
+char.c:                $(SRC_DIR)/char.tab
+               $(TABGEN) -f$(SRC_DIR)/char.tab >char.c