From cbb10e3b1bdfa9c25e6f5bb09f31e09de8724c92 Mon Sep 17 00:00:00 2001 From: ceriel Date: Tue, 14 Apr 1987 11:11:03 +0000 Subject: [PATCH] I forgot --- lang/m2/comp/em_m2.6 | 75 ++++++++++++++++++++++++++++++++ lang/m2/comp/main.c | 66 ++++++++++++++-------------- lang/m2/comp/make.allocd | 4 +- lang/m2/comp/modula-2.1 | 93 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 203 insertions(+), 35 deletions(-) create mode 100644 lang/m2/comp/em_m2.6 create mode 100644 lang/m2/comp/modula-2.1 diff --git a/lang/m2/comp/em_m2.6 b/lang/m2/comp/em_m2.6 new file mode 100644 index 000000000..e1f704f56 --- /dev/null +++ b/lang/m2/comp/em_m2.6 @@ -0,0 +1,75 @@ +.TH EM_M2 6 +.ad +.SH NAME +em_m2 \- ACK Modula\-2 compiler +.SH SYNOPSIS +.B em_m2 +.RI [ option ] +.I source +.I destination +.SH DESCRIPTION +.I Em_m2 +is a +compiler, part of the Amsterdam Compiler Kit, that translates Modula-2 programs +into EM code. +The input is taken from +.IR source , +while the +EM code is written on +.IR destination . +.br +.I Option +is a, possibly empty, sequence of the following combinations: +.IP \fB\-I\fIdirname\fR +.br +append \fIdirname\fR to the list of directories where definition modules +are looked for. +.PP +When the compiler needs a definition module, it is first searched for +in the current directory, and then in the directories given to it by the +\-\fBI\fR flag +in the order given. +.IP \fB\-M\fP\fIn\fP +set maximum identifier length to \fIn\fP. +The minimum value for \fIn\fR is 14, because the keyword +"IMPLEMENTATION" is that long. +.IP \fB\-n\fR +do not generate EM register messages. +The user-declared variables will not be stored into registers on the target +machine. +.IP \fB\-L\fR +do not generate the EM \fBfil\fR and \fBlin\fR instructions that enable +an interpreter to keep track of the current location in the source code. +.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 +\fBw\fR(word size), \fBi\fR(INTEGER), \fBl\fR(LONGINT), \fBf\fR(REAL), +\fBd\fR(LONGREAL), or \fBp\fR(POINTER). +It may also be the letter \fBS\fR, indicating that an initial +record alignment follows. +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 a default value to be retained. +.IP \fB\-w\fR\fIclasses\fR +suppress warning messages whose class is a member of \fIclasses\fR. +Currently, there are three classes: \fBO\fR, indicating old-flashioned use, +\fBW\fR, indicating "ordinary" warnings, and \fBR\fR, indicating +restricted Modula-2. +If no \fIclasses\fR are given, all warnings are suppressed. +By default, warnings in class \fBO\fR and \fBW\fR are given. +.IP \fB\-W\fR\fIclasses\fR +allow for warning messages whose class is a member of \fIclasses\fR. +.IP \fB\-x\fR +make all procedure names global, so that \fIadb\fR(1) understands them. +.LP +.SH FILES +.IR ~em/lib/em_m2 : +binary of the Modula-2 compiler. +.SH SEE ALSO +\fIack\fR(1), \fImodula-2\fR(1) +.SH DIAGNOSTICS +All warning and error messages are written on standard error output. +.SH REMARKS +Debugging and profiling facilities may be present during the development +of \fIem_m2\fP. diff --git a/lang/m2/comp/main.c b/lang/m2/comp/main.c index 80ed934c0..f76a098a2 100644 --- a/lang/m2/comp/main.c +++ b/lang/m2/comp/main.c @@ -141,39 +141,39 @@ AddStandards() extern struct def *Enter(); static struct node nilnode = { 0, 0, Value, 0, { INTEGER, 0}}; - (void) Enter("ABS", D_PROCEDURE, std_type, S_ABS); - (void) Enter("CAP", D_PROCEDURE, std_type, S_CAP); - (void) Enter("CHR", D_PROCEDURE, std_type, S_CHR); - (void) Enter("FLOAT", D_PROCEDURE, std_type, S_FLOAT); - (void) Enter("HIGH", D_PROCEDURE, std_type, S_HIGH); - (void) Enter("HALT", D_PROCEDURE, std_type, S_HALT); - (void) Enter("EXCL", D_PROCEDURE, std_type, S_EXCL); - (void) Enter("DEC", D_PROCEDURE, std_type, S_DEC); - (void) Enter("INC", D_PROCEDURE, std_type, S_INC); - (void) Enter("VAL", D_PROCEDURE, std_type, S_VAL); - (void) Enter("NEW", D_PROCEDURE, std_type, S_NEW); - (void) Enter("DISPOSE", D_PROCEDURE, std_type, S_DISPOSE); - (void) Enter("TRUNC", D_PROCEDURE, std_type, S_TRUNC); - (void) Enter("SIZE", D_PROCEDURE, std_type, S_SIZE); - (void) Enter("ORD", D_PROCEDURE, std_type, S_ORD); - (void) Enter("ODD", D_PROCEDURE, std_type, S_ODD); - (void) Enter("MAX", D_PROCEDURE, std_type, S_MAX); - (void) Enter("MIN", D_PROCEDURE, std_type, S_MIN); - (void) Enter("INCL", D_PROCEDURE, std_type, S_INCL); - - (void) Enter("CHAR", D_TYPE, char_type, 0); - (void) Enter("INTEGER", D_TYPE, int_type, 0); - (void) Enter("LONGINT", D_TYPE, longint_type, 0); - (void) Enter("REAL", D_TYPE, real_type, 0); - (void) Enter("LONGREAL", D_TYPE, longreal_type, 0); - (void) Enter("BOOLEAN", D_TYPE, bool_type, 0); - (void) Enter("CARDINAL", D_TYPE, card_type, 0); + Enter("ABS", D_PROCEDURE, std_type, S_ABS); + Enter("CAP", D_PROCEDURE, std_type, S_CAP); + Enter("CHR", D_PROCEDURE, std_type, S_CHR); + Enter("FLOAT", D_PROCEDURE, std_type, S_FLOAT); + Enter("HIGH", D_PROCEDURE, std_type, S_HIGH); + Enter("HALT", D_PROCEDURE, std_type, S_HALT); + Enter("EXCL", D_PROCEDURE, std_type, S_EXCL); + Enter("DEC", D_PROCEDURE, std_type, S_DEC); + Enter("INC", D_PROCEDURE, std_type, S_INC); + Enter("VAL", D_PROCEDURE, std_type, S_VAL); + Enter("NEW", D_PROCEDURE, std_type, S_NEW); + Enter("DISPOSE", D_PROCEDURE, std_type, S_DISPOSE); + Enter("TRUNC", D_PROCEDURE, std_type, S_TRUNC); + Enter("SIZE", D_PROCEDURE, std_type, S_SIZE); + Enter("ORD", D_PROCEDURE, std_type, S_ORD); + Enter("ODD", D_PROCEDURE, std_type, S_ODD); + Enter("MAX", D_PROCEDURE, std_type, S_MAX); + Enter("MIN", D_PROCEDURE, std_type, S_MIN); + Enter("INCL", D_PROCEDURE, std_type, S_INCL); + + Enter("CHAR", D_TYPE, char_type, 0); + Enter("INTEGER", D_TYPE, int_type, 0); + Enter("LONGINT", D_TYPE, longint_type, 0); + Enter("REAL", D_TYPE, real_type, 0); + Enter("LONGREAL", D_TYPE, longreal_type, 0); + Enter("BOOLEAN", D_TYPE, bool_type, 0); + Enter("CARDINAL", D_TYPE, card_type, 0); df = Enter("NIL", D_CONST, address_type, 0); df->con_const = &nilnode; nilnode.nd_INT = 0; nilnode.nd_type = address_type; - (void) Enter("PROC", + Enter("PROC", D_TYPE, construct_type(T_PROCEDURE, NULLTYPE), 0); @@ -200,11 +200,11 @@ do_SYSTEM() /* Simulate the reading of the SYSTEM definition module */ open_scope(CLOSEDSCOPE); - (void) Enter("WORD", D_TYPE, word_type, 0); - (void) Enter("BYTE", D_TYPE, byte_type, 0); - (void) Enter("ADDRESS", D_TYPE, address_type, 0); - (void) Enter("ADR", D_PROCEDURE, std_type, S_ADR); - (void) Enter("TSIZE", D_PROCEDURE, std_type, S_TSIZE); + Enter("WORD", D_TYPE, word_type, 0); + Enter("BYTE", D_TYPE, byte_type, 0); + Enter("ADDRESS", D_TYPE, address_type, 0); + Enter("ADR", D_PROCEDURE, std_type, S_ADR); + Enter("TSIZE", D_PROCEDURE, std_type, S_TSIZE); if (!InsertText(SYSTEM, sizeof(SYSTEM) - 1)) { fatal("could not insert text"); } diff --git a/lang/m2/comp/make.allocd b/lang/m2/comp/make.allocd index ae2ae6f3c..c4dd3e17c 100755 --- a/lang/m2/comp/make.allocd +++ b/lang/m2/comp/make.allocd @@ -10,7 +10,7 @@ extern char *std_alloc();\ #else\ #define new_\1() ((struct \1 *) st_alloc((char **)\&h_\1, sizeof(struct \1), \2))\ #endif\ -#define free_\1(p) st_free(p, h_\1, sizeof(struct \1))\ +#define free_\1(p) st_free(p, \&h_\1, sizeof(struct \1))\ :' -e ' s:^.*[ ]STATICALLOCDEF[ ].*"\(.*\)"[ ]*\([0-9][0-9]*\).*$:\ /* allocation definitions of struct \1 */\ @@ -22,5 +22,5 @@ int cnt_\1;\ #else\ #define new_\1() ((struct \1 *) st_alloc((char **)\&h_\1, sizeof(struct \1), \2))\ #endif\ -#define free_\1(p) st_free(p, h_\1, sizeof(struct \1))\ +#define free_\1(p) st_free(p, \&h_\1, sizeof(struct \1))\ :' diff --git a/lang/m2/comp/modula-2.1 b/lang/m2/comp/modula-2.1 new file mode 100644 index 000000000..e4bdbd9b0 --- /dev/null +++ b/lang/m2/comp/modula-2.1 @@ -0,0 +1,93 @@ +.TH MODULA\-2 1 +.ad +.SH NAME +Modula-2 \- ACK Modula-2 compiler +.SH SYNOPSIS +\fBack\fR \-m\fImach\fR files +.br +\fImach\fR files +.SH INTRODUCTION +This document provides a short introduction to the use of the ACK Modula-2 +compiler. It also +tells you where to find definition modules for "standard" modules. +.SH FILENAMES +Usually, a Modula-2 program consists of several definition and implementation +modules, and one program module. +Definition modules must reside in files with names having a ".def" extension. +Implementation modules and program modules must reside in files having a +".mod" extension. +.PP +The name of the file in which a definition module is stored must be the same as +the module-name, apart from the extension. +Also, in most Unix systems filenames are only 14 characters long. +So, given an IMPORT declaration for a module called "LongModulName", +the compiler will try to open a file called "LongModulN.def". +The requirement does not hold for implementation or program modules, +but is certainly recommended. +.SH CALLING THE COMPILER +The easiest way to do this is to let the \fIack\fR(1) program do it for you. +So, to compile a program module "prog.mod", just call +.DS +\fBack\fR \-m\fImach\fR prog.mod [ objects of implementation modules ] + or +\fImach\fR prog.mod [ objects of implementation modules ] +.DE +where \fImach\fR is one of the target machines of ACK. +.PP +To compile an implementation module, use the \-\fBc\fR flag +to produce a ".o" file. +Definition modules can not be compiled; the compiler reads them when they are +needed. +.PP +For more details on the \fIack\fR program see \fIack\fR(1). +.SH DEFINITION MODULES +"Standard" definition modules can be found in +the directories \fB~em/lib/m2\fR or \fB~em/lib/\fImach\fB/m2\fR. +.PP +When the compiler needs a definition module, it is first searched for +in the current directory, then in the directories given to it by the +\-\fBI\fR flag +in the order given, +and then in the directories mentioned above. +.SH FLAGS +The \fIack\fR(1) program recognizes (among others) the following +flags, that are passed to the Modula-2 compiler: +.IP \fB\-I\fIdirname\fR +.br +append \fIdirname\fR to the list of directories where definition modules +are looked for. +.IP \fB\-I\fP +don't look in +the directories \fB~em/lib/m2\fR or \fB~em/lib/\fImach\fB/m2\fR. +.IP \fB\-M\fP\fIn\fP +set maximum identifier length to \fIn\fR. The minimum value of \fIn\fR +is 14, because the keyword "IMPLEMENTATION" is that long. +.IP \fB\-n\fR +do not generate EM register messages. +The user-declared variables will not be stored into registers on the target +machine. +.IP \fB\-L\fR +do not generate the EM \fBfil\fR and \fBlin\fR instructions that enable +an interpreter to keep track of the current location in the source code. +.IP \fB\-w\fR\fIclasses\fR +suppress warning messages whose class is a member of \fIclasses\fR. +Currently, there are three classes: \fBO\fR, indicating old-flashioned use, +\fBW\fR, indicating "ordinary" warnings, and \fBR\fR, indicating +restricted Modula-2. +If no \fIclasses\fR are given, all warnings are suppressed. +By default, warnings in class \fBO\fR and \fBW\fR are given. +.IP \fB\-W\fR\fIclasses\fR +allow for warning messages whose class is a member of \fIclasses\fR. +.IP \fB\-x\fR +make all procedure names global, so that \fIadb\fR(1) understands them. +.LP +.SH SEE ALSO +\fIack\fR(1), \fIem_m2\fR(1) +.SH FILES +.IR ~em/lib/em_m2 : +binary of the Modula-2 compiler. +.SH DIAGNOSTICS +All warning and error messages are written on standard error output. +.SH REMARKS +Debugging and profiling facilities may be present during the development +of \fIem_m2\fP. -- 2.34.1