From: cvs2hg Date: Wed, 4 Oct 1989 10:56:17 +0000 (+0000) Subject: fixup commit for tag 'distr3' X-Git-Tag: release-5-5~2266^2 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fdistr3;p=ack.git fixup commit for tag 'distr3' --- diff --git a/DistrAction b/DistrAction deleted file mode 100755 index e36bee440..000000000 --- a/DistrAction +++ /dev/null @@ -1 +0,0 @@ -exec sh TakeAction distr distr/Action diff --git a/Makefile b/Makefile deleted file mode 100644 index bf4572b29..000000000 --- a/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -cmp: # compile everything and compare - (cd etc ; make cmp ) - (cd util ; make cmp ) - (cd lang ; make cmp ) - (cd mach ; make cmp ) - -install: # compile everything to machine code - (cd etc ; make install ) - (cd util ; make install ) - (cd lang/cem ; make install ) - (cd mach ; make install ) - (cd lang/pc ; make install ) - -clean: # remove all non-sources, except boot-files - (cd doc ; make clean ) - (cd man ; make clean ) - (cd h ; make clean ) - (cd etc ; make clean ) - (cd util ; make clean ) - (cd lang ; make clean ) - (cd mach ; make clean ) - -opr: # print all sources - make pr | opr - -pr: # print all sources - @( pr Makefile ; \ - (cd doc ; make pr ) ; \ - (cd man ; make pr ) ; \ - (cd h ; make pr ) ; \ - (cd etc ; make pr ) ; \ - (cd lang ; make pr ) ; \ - (cd util ; make pr ) ; \ - (cd mach ; make pr ) \ - ) diff --git a/distr/Action b/distr/Action deleted file mode 100644 index c50f46f93..000000000 --- a/distr/Action +++ /dev/null @@ -1,12 +0,0 @@ -name "Installation manual" -dir doc -end -name "Pascal bootstrap files" -dir lang/pc/pem -end -name "LLgen bootstrap files" -dir util/LLgen -end -name "ego share pop_push file" -dir util/ego/share -end diff --git a/distr/Action1 b/distr/Action1 deleted file mode 100644 index d1add76be..000000000 --- a/distr/Action1 +++ /dev/null @@ -1,9 +0,0 @@ -name "m68k2/cg bootstrap files" -dir mach/m68k2/cg -end -name "vax4/cg bootstrap files" -dir mach/vax4/cg -end -name "m68020/ncg bootstrap files" -dir mach/m68020/ncg -end diff --git a/distr/Exceptions b/distr/Exceptions deleted file mode 100644 index a95572a51..000000000 --- a/distr/Exceptions +++ /dev/null @@ -1,26 +0,0 @@ --- ./doc/install.pr no RCS file --- ./h/em_mnem.h no RCS file --- ./h/em_pseu.h no RCS file --- ./h/em_spec.h no RCS file --- ./lang/basic/src/y.tab.c no RCS file --- ./lang/basic/src/y.tab.h no RCS file --- ./lang/pc/pem/pem22.m no RCS file --- ./lang/pc/pem/pem24.m no RCS file --- ./lang/pc/pem/pem44.m no RCS file --- ./lib/LLgen/incl no RCS file --- ./lib/LLgen/rec no RCS file --- ./mach/m68k2/cg/tables1.c no RCS file --- ./mach/m68k2/cg/tables1.h no RCS file --- ./mach/m68020/ncg/tables1.c no RCS file --- ./mach/m68020/ncg/tables1.h no RCS file --- ./mach/vax4/cg/tables1.c no RCS file --- ./mach/vax4/cg/tables1.h no RCS file --- ./util/LLgen/src/parser no RCS file --- ./util/LLgen/src/LLgen.c no RCS file --- ./util/LLgen/src/Lpars.c no RCS file --- ./util/LLgen/src/Lpars.h no RCS file --- ./util/LLgen/src/tokens.c no RCS file --- ./util/data/em_flag.c no RCS file --- ./util/data/em_mnem.c no RCS file --- ./util/data/em_pseu.c no RCS file --- ./util/ego/share/pop_push.h no RCS file diff --git a/distr/How_To b/distr/How_To deleted file mode 100644 index d4091190f..000000000 --- a/distr/How_To +++ /dev/null @@ -1,74 +0,0 @@ -How to make a fresh distribution: -For a distribution you need ".distr" files and RCS files. -The EM home directory contains a file called ".distr". It contains -the names of all the files and directories you want to have in the distribution. -The directories should contain .distr files, the other files should -be placed under RCS. -The current RCS revision name is "distr3". -The are files that derive from other files and yet should be placed -in the distribution. -These files should not be placed under RCS. -The file "Exceptions" in this directory contains the current list of -these files. - -When all this is correct, use the shell script mktree the extract -the distribution from the EM tree. - cd /usr/em ; sh distr/mktree destination_tree >distr/f.attf 2>&1 -Make sure that the destination tree exists and is empty! -Failing to do that will almost certainly result in a welter of -error messages. -The file f.attf contains mktree error messages and should be compared -to Exceptions. -The actions of mktree are quite complicated. It starts in the current -directory reading the ".distr" file, after copying that file to the -destination tree. -For each file mentioned there it performes certain actions: -1- Directory Change to that directory and call yourself recursively. -2- File - a- Try to do "co -rdistr3 destination_tree/path/destination_file" - on succes "chmod +w destination_file" - else - b- Try to do "co destination_tree/destination_file" - on succes "chmod +w destination_file" and - give message that says "Missing distr3 entry" (or some such). - else - c- I Does a file LIST exist in this directory AND - is the first line of LIST equal to the name of the - destination file? If so, try to extract all the files - named in the rest of the LIST file and call the program - arch to create a library "arch cr `cat LIST`". - In this manner libraries can be distributed whose members - have their own RCS file! - else - II try to do "cp file destination_tree/path/destination_file" - on succes give message that says "Missing RCS entry" - (or some such). - else - d- - give message that says "Missing entry" (or some such). - -Now you have the tree but not everything is kosher yet. -Some files derive from other files in the tree, those derivations should -be done with the use of an already installed distribution. -The files Action and Action1 in this directory contain the actions -we now take. (Confession: most of the time we use /usr/em) - -After running these re-derivation programs the distrubtion tree starts -to look like the tree you need. -There are too many files there though, especially the files created by -the derivation process. -That is why we now give the command: - dtar cdf distr3 . -The file distr3 is the one you should put on tape! -But,.... before doing that: Try it out! -Repeat the process described in the installation manual. -Only if that succeeds you are sure that you included the files needed, -and gave all other files the correct "distr3" RCS id. -After you sent the tape away, forbid ANYBODY to touch the distr3 id -in your RCS files. - Good Luck, - Ed Keizer, 85/4/15. - -Updated for 3rd distribution by Ceriel Jacobs, 87/3/11. -And again, - Good Luck! diff --git a/distr/dwalk b/distr/dwalk deleted file mode 100755 index 9835e3df5..000000000 --- a/distr/dwalk +++ /dev/null @@ -1,25 +0,0 @@ -: ${CDIR=.} -if test ! -r .distr -then - echo ++ no .distr in $CDIR - exit 0 -fi -${DS-:} $CDIR -for i in `cat .distr` -do - if test -d $i - then - ( if cd $i - then - ${DD-:} $CDIR $i - CDIR=$CDIR/$i - export CDIR - exec /usr/em/distr/dwalk - else - echo ++ Could not access $CDIR/$i - fi - ) - else - ${DF-:} $CDIR $i - fi -done diff --git a/distr/echod b/distr/echod deleted file mode 100755 index 2b2779cee..000000000 --- a/distr/echod +++ /dev/null @@ -1 +0,0 @@ -echo $1/$2 diff --git a/distr/f.attf b/distr/f.attf deleted file mode 100644 index c0139dbb7..000000000 --- a/distr/f.attf +++ /dev/null @@ -1,42 +0,0 @@ --- ./bin/em.pascal no RCS file --- ./doc/em.doc/doc.pr no RCS file --- ./doc/install.pr no RCS file --- ./h/em_mnem.h no RCS file --- ./h/em_pseu.h no RCS file --- ./h/em_spec.h no RCS file --- ./lang/basic/src/y.tab.c no RCS file --- ./lang/basic/src/y.tab.h no RCS file --- ./lang/pc/pem/pem22.m no RCS file --- ./lang/pc/pem/pem24.m no RCS file --- ./lib/LLgen/incl no RCS file --- ./lib/LLgen/rec no RCS file --- ./lib/ix/head_em no RCS file --- ./lib/ix/head_i no RCS file --- ./lib/ix/tail_em no RCS file --- ./lib/ix/tail_em.vend no RCS file --- ./lib/ix/tail_mon no RCS file --- ./mach/6500/libem/tail_em.ve.s.a no RCS file --- ./mach/vax2/cg/tables1.c no RCS file --- ./mach/vax2/cg/tables1.h no RCS file --- ./mach/vax4/cg/tables1.c no RCS file --- ./mach/vax4/cg/tables1.h no RCS file --- ./mach/z80/int/libpc/pc_tail.c.a no RCS file --- ./mkun/pubmac no distr2 yet --- ./mkun/tmac.q no distr2 yet --- ./mkun/tmac.q1 no distr2 yet --- ./mkun/tmac.q2 no distr2 yet --- ./mkun/tmac.q3 no distr2 yet --- ./mkun/tmac.q4 no distr2 yet --- ./mkun/tmac.q5 no distr2 yet --- ./mkun/tmac.q6 no distr2 yet --- ./mkun/tmac.q7 no distr2 yet --- ./mkun/tmac.q8 no distr2 yet --- ./util/LLgen/src/parser no RCS file --- ./util/LLgen/src/LLgen.c no RCS file --- ./util/LLgen/src/Lpars.c no RCS file --- ./util/LLgen/src/Lpars.h no RCS file --- ./util/LLgen/src/tokens.c no RCS file --- ./util/data/em_flag.c no RCS file --- ./util/data/em_mnem.c no RCS file --- ./util/data/em_pseu.c no RCS file --- ./util/data/em_ptyp.c no RCS file diff --git a/distr/listall b/distr/listall deleted file mode 100755 index c02e9526c..000000000 --- a/distr/listall +++ /dev/null @@ -1,10 +0,0 @@ -case $# in -0) DIR=. ;; -1) DIR=$1 ;; -*) echo $0 [directory] ; exit 1 ;; -esac -DD=`pwd`/listall.d -DW=`pwd`/dwalk -export DD -cd $DIR -$DW diff --git a/distr/listall.d b/distr/listall.d deleted file mode 100755 index 5f7a22085..000000000 --- a/distr/listall.d +++ /dev/null @@ -1,2 +0,0 @@ -echo "<$1/$2>" -ls -bCdx `cat .distr` diff --git a/distr/listdirs b/distr/listdirs deleted file mode 100755 index 9d5d3c1f1..000000000 --- a/distr/listdirs +++ /dev/null @@ -1,10 +0,0 @@ -case $# in -0) DIR=. ;; -1) DIR=$1 ;; -*) echo $0 [directory] ; exit 1 ;; -esac -DD=`pwd`/echod -DW=`pwd`/dwalk -export DD -cd $DIR -$DW diff --git a/distr/mka b/distr/mka deleted file mode 100755 index 8f4050482..000000000 --- a/distr/mka +++ /dev/null @@ -1,9 +0,0 @@ -set -e -for i in `tail +2 $DESTDIR/$1/LIST` -do - ${DF-false} $1 $i -done -cd $DESTDIR/$1 -arch cr `cat LIST` -: I do not remove the files constituating the library, because -: they might be present in .distr diff --git a/distr/mkd b/distr/mkd deleted file mode 100755 index 7000cbcd9..000000000 --- a/distr/mkd +++ /dev/null @@ -1 +0,0 @@ -mkdir $DESTDIR/$1/$2 diff --git a/distr/mkf b/distr/mkf deleted file mode 100755 index 2d8faace3..000000000 --- a/distr/mkf +++ /dev/null @@ -1,23 +0,0 @@ -if co -q -rdistr3 $DESTDIR/$1/$2 >/dev/null 2>&1 -then - chmod +w $DESTDIR/$1/$2 -elif co -q $DESTDIR/$1/$2 >/dev/null 2>&1 -then - chmod +w $DESTDIR/$1/$2 - echo -- $1/$2 no distr3 yet -elif grep LIST .distr >/dev/null 2>&1 && - (test "$2" = "`head -1 $DESTDIR/$1/LIST`") >/dev/null 2>&1 && - ${DA-false} "$1" "$2" -then -: Fetched library contents one by one and put them together -elif cp $2 $DESTDIR/$1/$2 >/dev/null 2>&1 -then - echo -- $1/$2 no RCS file -else - echo ++ $1/$2 not present -fi -case $2 in -LIST) if (test -r $DESTDIR/$1/`head -1 $DESTDIR/$1/LIST`) >/dev/null 2>&1 - then echo ++ LIST files must be in .distr before their libraries!!! - fi ;; -esac diff --git a/distr/mks b/distr/mks deleted file mode 100755 index be169fb6f..000000000 --- a/distr/mks +++ /dev/null @@ -1 +0,0 @@ -cp .distr $DESTDIR/$1 diff --git a/distr/mktree b/distr/mktree deleted file mode 100644 index df22298a0..000000000 --- a/distr/mktree +++ /dev/null @@ -1,15 +0,0 @@ -case $# in -1) ;; -*) echo $0 directory ; exit 1 ;; -esac -DDIR=/usr/em/distr -case $1 in -/*) DESTDIR=$1 ;; -*) DESTDIR=`pwd`/$1 ;; -esac -DS=$DDIR/mks -DD=$DDIR/mkd -DF=$DDIR/mkf -DA=$DDIR/mka -export DESTDIR DS DD DF DA -$DDIR/dwalk diff --git a/distr/todistr b/distr/todistr deleted file mode 100644 index e1bfb5d6b..000000000 --- a/distr/todistr +++ /dev/null @@ -1,26 +0,0 @@ -REV= -FILE= -while : -do - case $# in - 0) break ;; - esac - ARG="$1" - shift - case "$ARG" in - -r*) REV=`echo "$ARG"| sed s/-r//` ;; - -*) FLAGS="$FLAGS $ARG" ;; - *) case x$FILE in - x) FILE="$ARG" ;; - *) echo todistr can only be done on one file at the time - exit 1 ;; - esac - esac -done -case x$REV in -x) REV=`rlog -h "$FILE"|sed -n -e '/head/s/^head:[ ]*//p'` ;; -esac -case x$REV in -x) exit 2 ;; -esac -rcs -ndistr3:$REV $FLAGS $FILE diff --git a/distr/ts b/distr/ts deleted file mode 100755 index 8350341b2..000000000 --- a/distr/ts +++ /dev/null @@ -1,2 +0,0 @@ -DD=`pwd`/ts -echo OK diff --git a/doc/cref.doc b/doc/cref.doc deleted file mode 100644 index 76c4f84d6..000000000 --- a/doc/cref.doc +++ /dev/null @@ -1,323 +0,0 @@ -.\" $Header$ -.nr ID 4 -.de hd -'sp 2 -'tl ''-%-'' -'sp 3 -.. -.de fo -'bp -.. -.tr ~ -. TITLE -.de TL -.sp 15 -.ce -\\fB\\$1\\fR -.. -. AUTHOR -.de AU -.sp 15 -.ce -by -.sp 2 -.ce -\\$1 -.. -. DATE -.de DA -.sp 3 -.ce -( Dated \\$1 ) -.. -. INSTITUTE -.de VU -.sp 3 -.ce 4 -Wiskundig Seminarium -Vrije Universteit -De Boelelaan 1081 -Amsterdam -.. -. PARAGRAPH -.de PP -.sp -.ti +\n(ID -.. -.nr CH 0 1 -. CHAPTER -.de CH -.nr SH 0 1 -.bp -.in 0 -\\fB\\n+(CH.~\\$1\\fR -.PP -.. -. SUBCHAPTER -.de SH -.sp 3 -.in 0 -\\fB\\n(CH.\\n+(SH.~\\$1\\fR -.PP -.. -. INDENT START -.de IS -.sp -.in +\n(ID -.. -. INDENT END -.de IE -.in -\n(ID -.sp -.. -.de PT -.ti -\n(ID -.ta \n(ID -.fc " @ -"\\$1@"\c -.fc -.. -. DOUBLE INDENT START -.de DS -.sp -.in +\n(ID -.ll -\n(ID -.. -. DOUBLE INDENT END -.de DE -.ll +\n(ID -.in -\n(ID -.sp -.. -. EQUATION START -.de EQ -.sp -.nf -.. -. EQUATION END -.de EN -.fi -.sp -.. -. ITEM -.de IT -.sp -.in 0 -\\fB~\\$1\\fR -.ti +5 -.. -.de CS -.br -~-~\\ -.. -.br -.fi -.TL "Ack-C reference manual" -.AU "Ed Keizer" -.DA "September 12, 1983" -.VU -.wh 0 hd -.wh 60 fo -.CH "Introduction" -The C frontend included in the Amsterdam Compiler Kit -translates UNIX-V7 C into compact EM code [1]. -The language accepted is described in [2] and [3]. -This document describes which implementation dependent choices were -made in the Ack-C frontend and -some restrictions and additions. -.CH "The language" -.PP -Under the same heading as used in [2] we describe the -properties of the Ack-C frontend. -.IT "2.2 Identifiers" -External identifiers are unique up to 7 characters and allow -both upper and lower case. -.IT "2.3 Keywords" -The word \fBvoid\fP is also reserved as a keyword. -.IT "2.4.3 Character constants" -The ASCII-mapping is used when a character is converted to an -integer. -.IT "2.4.4 Floating constants" -To prevent loss of precision the compiler does not perform -floating point constant folding. -.IT "2.6 Hardware characteristics" -The size of objects of the several arithmetic types and -pointers depend on the EM-implementation used. -The ranges of the arithmetic types depend on the size used, -the C-frontend assumes two's complement representation for the -integral types. -All sizes are multiples of bytes. -The calling program \fIack\fP[4] passes information about the -size of the types to the compiler proper. -.br -However, a few general remarks must be made: -.sp 1 -.IS -.PT (a) -The size of pointers is a multiple of -(or equal to) the size of an \fIint\fP. -.PT (b) -The following relations exist for the sizes of the types -mentioned: -.br -.ti +5 -\fIchar<=short<=int<=long\fP -.PT (c) -Objects of type \fIchar\fP use one 8-bit byte of storage, -although several bytes are allocated sometimes. -.PT (d) -All sizes are in multiples of bytes. -.PT (e) -Most EM implementations use 4 bytes for floats and 8 bytes -for doubles, but exceptions to this rule occur. -.IE -.IT "4 What's in a name" -The type \fIvoid\fP is added. -Objects of type void do not exist. -Functions declared as returning void, do not return a value at all. -.IT "6.1 Characters and integers" -Objects of type \fIchar\fP are unsigned and do not cause -sign-extension when converted to \fIint\fP. -The range of characters values is from 0 to 255. -.IT "6.3 Floating and integral" -Floating point numbers are truncated towards zero when -converted to the integral types. -.IT "6.4 Pointers and integers" -When a \fIlong\fP is added to or subtracted from a pointer and -longs are larger then pointers the \fIlong\fP is converted to an -\fIint\fP before the operation is performed. -.IT "7.2 Unary operators" -It is allowed to cast any expression to the type \fIvoid\fP. -.IT "8.2 Type specifiers" -One type is added to the type-specifiers: -.br -.IS -void -.IE -.IT "8.5 Structure and union declarations" -The only type allowed for fields is \fIint\fP. -Fields with exactly the size of \fIint\fP are signed, -all other fields are unsigned. -.br -The size of any single structure must be less then 4096 bytes. -.IT "8.6 Initialization" -Initialization of structures containing bit fields is not -allowed. -There is one restriction when using an 'address expression' to initialize -an integral variable. -The integral variable must have the same size as a pointer. -Conversions altering the size of the address expression are not allowed. -.IT "9.10 Return statement" -Return statements of the form: -.IS - return ; -.IE -are the only form of return statement allowed in a function of type -function returning void. -.IT "10.1 External function definitions" -The total amount for storage used for parameters -in any function must be less then 4096 bytes. -The same holds for the total amount of storage occupied by the -automatic variables declared inside any function. -.sp -Using formal parameters whose size is smaller the the size of an int -is less efficient on several machines. -At procedure entry these parameters are converted from integer to the -declared type, because the compiler doesn't know where the least -significant bytes are stored in the int. -.IT "11.2 Scope of externals" -Most C compilers are rather lax in enforcing the restriction -that only one external definition without the keyword -\fIextern\fP is allowed in a program. -The Ack-C frontend is very strict in this. -The only exception is that declarations of arrays with a -missing first array bounds expression are regarded to have an -explicit keyword \fIextern\fP. -.IT "14.4 Explicit pointer conversions" -Pointers may be larger the ints, thus assigning a pointer to an -int and back will not always result in the same pointer. -The process mentioned above works with integrals -of the same size or larger as pointers in all EM implementations -having such integrals. -When converting pointers to an integral type or vice-versa, -the pointers is seen as an unsigned int. -.br -EM guarantees that any object can be placed at a word boundary, -this allows the C-programs to use \fIint\fP pointers -as pointers to objects of any type not smaller than an \fIint\fP. -.CH "Frontend options" -The C-frontend has a few options, these are controlled -by flags: -.IS -.PT -V -This flag is followed by a sequence of letters each followed by -positive integers. Each letter indicates a -certain type, the integer following it specifies the size of -objects of that type. One letter indicates the wordsize used. -.IS -.sp 1 -.TS -center tab(:); -l l16 l l. -letter:type:letter:type - -w:wordsize:i:int -s:short:l:long -f:float:d:double -p:pointer:: -.TE -.sp 1 -All existing implementations use an integer size equal to the -wordsize. -.IE -The calling program \fIack\fP[4] provides the frontend with -this flag, with values depending on the machine used. -.sp 1 -.PT -l -The frontend normally generates code to keep track of the line -number and source file name at runtime for debugging purposes. -Currently a pointer to a -string containing the filename is stored at a fixed place in -memory at each function -entry and the line number at the start of every expression. -At the return from a function these memory locations are not reset to -the values they had before the call. -Most library routines do not use this feature and thus do not -ruin the current line number and filename when called. -However, you are really unlucky when your program crashes due -to a bug in such a library function, because the line number -and filename do not indicate that something went wrong inside -the library function. -.br -Providing the flag -l to the frontend tells it not to generate -the code updating line number and file name. -This is, for example, used when translating the stdio library. -.br -When the \fIack\fP[4] is called with the -L flag it provides -the frontend with this flag. -.sp 1 -.PT -Xp -When this flag is present the frontend generates a call to -the function \fBprocentry\fP at each function entry and a -call to \fBprocexit\fP at each function exit. -Both functions are provided with one parameter, -a pointer to a string containing the function name. -.br -When \fIack\fP is called with the -p flag it provides the -frontend with this flag. -.IE -.CH References -.IS -.PT [1] -A.S. Tanenbaum, Hans van Staveren, Ed Keizer and Johan -Stevenson \fIDescription of a machine architecture for use with -block structured languages\fP Informatica report IR-81. -.sp 1 -.PT [2] -B.W. Kernighan and D.M. Ritchie, \fIThe C Programming -language\fP, Prentice-Hall, 1978 -.PT [3] -D.M. Ritchie, \fIC Reference Manual\fP -.sp -.PT [4] -UNIX manual ack(I). diff --git a/doc/em/app.nr b/doc/em/app.nr deleted file mode 100644 index 78e082fcc..000000000 --- a/doc/em/app.nr +++ /dev/null @@ -1,488 +0,0 @@ -.BP -.AP "EM INTERPRETER" -.nf -.ta 8 16 24 32 40 48 56 64 72 80 -.so em.i -.fi -.BP -.AP "EM CODE TABLES" -The following table is used by the assembler for EM machine -language. -It specifies the opcodes used for each instruction and -how arguments are mapped to machine language arguments. -The table is presented in three columns, -each line in each column contains three or four fields. -Each line describes a range of interpreter opcodes by -specifying for which instruction the range is used, the type of the -opcodes (mini, shortie, etc..) and range for the instruction -argument. -.A -The first field on each line gives the EM instruction mnemonic, -the second field gives some flags. -If the opcodes are minis or shorties the third field specifies -how many minis/shorties are used. -The last field gives the number of the (first) interpreter -opcode. -.N 1 -Flags : -.IS 3 -.N 1 -Opcode type, only one of the following may be specified. -.PS - 5 " " -.PT - -opcode without argument -.PT m -mini -.PT s -shortie -.PT 2 -opcode with 2-byte signed argument -.PT 4 -opcode with 4-byte signed argument -.PT 8 -opcode with 8-byte signed argument -.PE -Secondary (escaped) opcodes. -.PS - 5 " " -.PT e -The opcode thus marked is in the secondary opcode group instead -of the primary -.PE -restrictions on arguments -.PS - 5 " " -.PT N -Negative arguments only -.PT P -Positive and zero arguments only -.PE -mapping of arguments -.PS - 5 " " -.PT w -argument must be divisible by the wordsize and is divided by the -wordsize before use as opcode argument. -.PT o -argument ( possibly after division ) must be >= 1 and is -decremented before use as opcode argument -.PE -.IE -If the opcode type is 2,4 or 8 the resulting argument is used as -opcode argument (least significant byte first). -.N -If the opcode type is mini, the argument is added -to the first opcode - if in range - . -If the argument is negative, the absolute value minus one is -used in the algorithm above. -.N -For shorties with positive arguments the first opcode is used -for arguments in the range 0..255, the second for the range -256..511, etc.. -For shorties with negative arguments the first opcode is used -for arguments in the range -1..-256, the second for the range --257..-512, etc.. -The byte following the opcode contains the least significant -byte of the argument. -First some examples of these specifications. -.PS - 5 -.PT "aar mwPo 1 34" -Indicates that opcode 34 is used as a mini for Positive -instruction arguments only. -The w and o indicate division and decrementing of the -instruction argument. -Because the resulting argument must be zero ( only opcode 34 may be used -), this mini can only be used for instruction argument 2. -Conclusion: opcode 34 is for "AAR 2". -.PT "adp sP 1 41" -Opcode 41 is used as shortie for ADP with arguments in the range -0..255. -.PT "bra sN 2 60" -Opcode 60 is used as shortie for BRA with arguments -1..-256, -61 is used for arguments -257..-512. -.PT "zer e- 145" -Escaped opcode 145 is used for ZER. -.PE -The interpreter opcode table: -.N 1 -.IS 3 -.DS B -.so itables -.DE 0 -.IE -.P -The table above results in the following dispatch tables. -Dispatch tables are used by interpreters to jump to the -routines implementing the EM instructions, indexed by the next opcode. -Each line of the dispatch tables gives the routine names -of eight consecutive opcodes, preceded by the first opcode number -on that line. -Routine names consist of an EM mnemonic followed by a suffix. -The suffices show the encoding used for each opcode. -.N -The following suffices exist: -.N 1 -.VS 1 0 -.IS 4 -.PS - 11 -.PT .z -no arguments -.PT .l -16-bit argument -.PT .lw -16-bit argument divided by the wordsize -.PT .p -positive 16-bit argument -.PT .pw -positive 16-bit argument divided by the wordsize -.PT .n -negative 16-bit argument -.PT .nw -negative 16-bit argument divided by the wordsize -.PT .s -shortie with as high order argument byte -.PT .sw -shortie with argument divided by the wordsize -.PT . -mini with as argument -.PT .W -mini with *wordsize as argument -.PE 3 - is a possibly negative integer. -.VS 1 1 -.IE -The dispatch table for the 256 primary opcodes: -.DS B - 0 loc.0 loc.1 loc.2 loc.3 loc.4 loc.5 loc.6 loc.7 - 8 loc.8 loc.9 loc.10 loc.11 loc.12 loc.13 loc.14 loc.15 - 16 loc.16 loc.17 loc.18 loc.19 loc.20 loc.21 loc.22 loc.23 - 24 loc.24 loc.25 loc.26 loc.27 loc.28 loc.29 loc.30 loc.31 - 32 loc.32 loc.33 aar.1W adf.s0 adi.1W adi.2W adp.l adp.1 - 40 adp.2 adp.s0 adp.s-1 ads.1W and.1W asp.1W asp.2W asp.3W - 48 asp.4W asp.5W asp.w0 beq.l beq.s0 bge.s0 bgt.s0 ble.s0 - 56 blm.s0 blt.s0 bne.s0 bra.l bra.s-1 bra.s-2 bra.s0 bra.s1 - 64 cal.1 cal.2 cal.3 cal.4 cal.5 cal.6 cal.7 cal.8 - 72 cal.9 cal.10 cal.11 cal.12 cal.13 cal.14 cal.15 cal.16 - 80 cal.17 cal.18 cal.19 cal.20 cal.21 cal.22 cal.23 cal.24 - 88 cal.25 cal.26 cal.27 cal.28 cal.s0 cff.z cif.z cii.z - 96 cmf.s0 cmi.1W cmi.2W cmp.z cms.s0 csa.1W csb.1W dec.z - 104 dee.w0 del.w-1 dup.1W dvf.s0 dvi.1W fil.l inc.z ine.lw - 112 ine.w0 inl.-1W inl.-2W inl.-3W inl.w-1 inn.s0 ior.1W ior.s0 - 120 lae.l lae.w0 lae.w1 lae.w2 lae.w3 lae.w4 lae.w5 lae.w6 - 128 lal.p lal.n lal.0 lal.-1 lal.w0 lal.w-1 lal.w-2 lar.W - 136 ldc.0 lde.lw lde.w0 ldl.0 ldl.w-1 lfr.1W lfr.2W lfr.s0 - 144 lil.w-1 lil.w0 lil.0 lil.1W lin.l lin.s0 lni.z loc.l - 152 loc.-1 loc.s0 loc.s-1 loe.lw loe.w0 loe.w1 loe.w2 loe.w3 - 160 loe.w4 lof.l lof.1W lof.2W lof.3W lof.4W lof.s0 loi.l - 168 loi.1 loi.1W loi.2W loi.3W loi.4W loi.s0 lol.pw lol.nw - 176 lol.0 lol.1W lol.2W lol.3W lol.-1W lol.-2W lol.-3W lol.-4W - 184 lol.-5W lol.-6W lol.-7W lol.-8W lol.w0 lol.w-1 lxa.1 lxl.1 - 192 lxl.2 mlf.s0 mli.1W mli.2W rck.1W ret.0 ret.1W ret.s0 - 200 rmi.1W sar.1W sbf.s0 sbi.1W sbi.2W sdl.w-1 set.s0 sil.w-1 - 208 sil.w0 sli.1W ste.lw ste.w0 ste.w1 ste.w2 stf.l stf.W - 216 stf.2W stf.s0 sti.1 sti.1W sti.2W sti.3W sti.4W sti.s0 - 224 stl.pw stl.nw stl.0 stl.1W stl.-1W stl.-2W stl.-3W stl.-4W - 232 stl.-5W stl.w-1 teq.z tgt.z tlt.z tne.z zeq.l zeq.s0 - 240 zeq.s1 zer.s0 zge.s0 zgt.s0 zle.s0 zlt.s0 zne.s0 zne.s-1 - 248 zre.lw zre.w0 zrl.-1W zrl.-2W zrl.w-1 zrl.nw escape1 escape2 -.DE 2 -The list of secondary opcodes (escape1): -.N 1 -.DS B - 0 aar.l aar.z adf.l adf.z adi.l adi.z ads.l ads.z - 8 adu.l adu.z and.l and.z asp.lw ass.l ass.z bge.l - 16 bgt.l ble.l blm.l bls.l bls.z blt.l bne.l cai.z - 24 cal.l cfi.z cfu.z ciu.z cmf.l cmf.z cmi.l cmi.z - 32 cms.l cms.z cmu.l cmu.z com.l com.z csa.l csa.z - 40 csb.l csb.z cuf.z cui.z cuu.z dee.lw del.pw del.nw - 48 dup.l dus.l dus.z dvf.l dvf.z dvi.l dvi.z dvu.l - 56 dvu.z fef.l fef.z fif.l fif.z inl.pw inl.nw inn.l - 64 inn.z ior.l ior.z lar.l lar.z ldc.l ldf.l ldl.pw - 72 ldl.nw lfr.l lil.pw lil.nw lim.z los.l los.z lor.s0 - 80 lpi.l lxa.l lxl.l mlf.l mlf.z mli.l mli.z mlu.l - 88 mlu.z mon.z ngf.l ngf.z ngi.l ngi.z nop.z rck.l - 96 rck.z ret.l rmi.l rmi.z rmu.l rmu.z rol.l rol.z - 104 ror.l ror.z rtt.z sar.l sar.z sbf.l sbf.z sbi.l - 112 sbi.z sbs.l sbs.z sbu.l sbu.z sde.l sdf.l sdl.pw - 120 sdl.nw set.l set.z sig.z sil.pw sil.nw sim.z sli.l - 128 sli.z slu.l slu.z sri.l sri.z sru.l sru.z sti.l - 136 sts.l sts.z str.s0 tge.z tle.z trp.z xor.l xor.z - 144 zer.l zer.z zge.l zgt.l zle.l zlt.l zne.l zrf.l - 152 zrf.z zrl.pw dch.z exg.s0 exg.l exg.z lpb.z gto.l -.DE 2 -Finally, the list of opcodes with four byte arguments (escape2). -.DS - - 0 loc -.DE 0 -.BP -.AP "AN EXAMPLE PROGRAM" -.DS B - 1 program example(output); - 2 {This program just demonstrates typical EM code.} - 3 type rec = record r1: integer; r2:real; r3: boolean end; - 4 var mi: integer; mx:real; r:rec; - 5 - 6 function sum(a,b:integer):integer; - 7 begin - 8 sum := a + b - 9 end; -10 -11 procedure test(var r: rec); -12 label 1; -13 var i,j: integer; -14 x,y: real; -15 b: boolean; -16 c: char; -17 a: array[1..100] of integer; -18 -19 begin -20 j := 1; -21 i := 3 * j + 6; -22 x := 4.8; -23 y := x/0.5; -24 b := true; -25 c := 'z'; -26 for i:= 1 to 100 do a[i] := i * i; -27 r.r1 := j+27; -28 r.r3 := b; -29 r.r2 := x+y; -30 i := sum(r.r1, a[j]); -31 while i > 0 do begin j := j + r.r1; i := i - 1 end; -32 with r do begin r3 := b; r2 := x+y; r1 := 0 end; -33 goto 1; -34 1: writeln(j, i:6, x:9:3, b) -35 end; {test} -36 begin {main program} -37 mx := 15.96; -38 mi := 99; -39 test(r) -40 end. -.DE 0 -.BP -The EM code as produced by the Pascal-VU compiler is given below. Comments -have been added manually. Note that this code has already been optimized. -.DS B - mes 2,2,2 ; wordsize 2, pointersize 2 - .1 - rom 't.p\e000' ; the name of the source file - hol 552,-32768,0 ; externals and buf occupy 552 bytes - exp $sum ; sum can be called from other modules - pro $sum,2 ; procedure sum; 2 bytes local storage - lin 8 ; code from source line 8 - ldl 0 ; load two locals ( a and b ) - adi 2 ; add them - ret 2 ; return the result - end 2 ; end of procedure ( still two bytes local storage ) - .2 - rom 1,99,2 ; descriptor of array a[] - exp $test ; the compiler exports all level 0 procedures - pro $test,226 ; procedure test, 226 bytes local storage - .3 - rom 4.8F8 ; assemble Floating point 4.8 (8 bytes) in - .4 ; global storage - rom 0.5F8 ; same for 0.5 - mes 3,-226,2,2 ; compiler temporary not referenced by address - mes 3,-24,2,0 ; the same is true for i, j, b and c in test - mes 3,-22,2,0 - mes 3,-4,2,0 - mes 3,-2,2,0 - mes 3,-20,8,0 ; and for x and y - mes 3,-12,8,0 - lin 20 ; maintain source line number - loc 1 - stl -4 ; j := 1 - lni ; lin 21 prior to optimization - lol -4 - loc 3 - mli 2 - loc 6 - adi 2 - stl -2 ; i := 3 * j + 6 - lni ; lin 22 prior to optimization - lae .3 - loi 8 - lal -12 - sti 8 ; x := 4.8 - lni ; lin 23 prior to optimization - lal -12 - loi 8 - lae .4 - loi 8 - dvf 8 - lal -20 - sti 8 ; y := x / 0.5 - lni ; lin 24 prior to optimization - loc 1 - stl -22 ; b := true - lni ; lin 25 prior to optimization - loc 122 - stl -24 ; c := 'z' - lni ; lin 26 prior to optimization - loc 1 - stl -2 ; for i:= 1 - 2 - lol -2 - dup 2 - mli 2 ; i*i - lal -224 - lol -2 - lae .2 - sar 2 ; a[i] := - lol -2 - loc 100 - beq *3 ; to 100 do - inl -2 ; increment i and loop - bra *2 - 3 - lin 27 - lol -4 - loc 27 - adi 2 ; j + 27 - sil 0 ; r.r1 := - lni ; lin 28 prior to optimization - lol -22 ; b - lol 0 - stf 10 ; r.r3 := - lni ; lin 29 prior to optimization - lal -20 - loi 16 - adf 8 ; x + y - lol 0 - adp 2 - sti 8 ; r.r2 := - lni ; lin 23 prior to optimization - lal -224 - lol -4 - lae .2 - lar 2 ; a[j] - lil 0 ; r.r1 - cal $sum ; call now - asp 4 ; remove parameters from stack - lfr 2 ; get function result - stl -2 ; i := - 4 - lin 31 - lol -2 - zle *5 ; while i > 0 do - lol -4 - lil 0 - adi 2 - stl -4 ; j := j + r.r1 - del -2 ; i := i - 1 - bra *4 ; loop - 5 - lin 32 - lol 0 - stl -226 ; make copy of address of r - lol -22 - lol -226 - stf 10 ; r3 := b - lal -20 - loi 16 - adf 8 - lol -226 - adp 2 - sti 8 ; r2 := x + y - loc 0 - sil -226 ; r1 := 0 - lin 34 ; note the abscence of the unnecesary jump - lae 22 ; address of output structure - lol -4 - cal $_wri ; write integer with default width - asp 4 ; pop parameters - lae 22 - lol -2 - loc 6 - cal $_wsi ; write integer width 6 - asp 6 - lae 22 - lal -12 - loi 8 - loc 9 - loc 3 - cal $_wrf ; write fixed format real, width 9, precision 3 - asp 14 - lae 22 - lol -22 - cal $_wrb ; write boolean, default width - asp 4 - lae 22 - cal $_wln ; writeln - asp 2 - ret 0 ; return, no result - end 226 - exp $_main - pro $_main,0 ; main program - .6 - con 2,-1,22 ; description of external files - .5 - rom 15.96F8 - fil .1 ; maintain source file name - lae .6 ; description of external files - lae 0 ; base of hol area to relocate buffer addresses - cal $_ini ; initialize files, etc... - asp 4 - lin 37 - lae .5 - loi 8 - lae 2 - sti 8 ; mx := 15.96 - lni ; lin 38 prior to optimization - loc 99 - ste 0 ; mi := 99 - lni ; lin 39 prior to optimization - lae 10 ; address of r - cal $test - asp 2 - loc 0 ; normal exit - cal $_hlt ; cleanup and finish - asp 2 - end 0 - mes 5 ; reals were used -.DE 0 -The compact code corresponding to the above program is listed below. -Read it horizontally, line by line, not column by column. -Each number represents a byte of compact code, printed in decimal. -The first two bytes form the magic word. -.N 1 -.IS 3 -.DS B -173 0 159 122 122 122 255 242 1 161 250 124 116 46 112 0 -255 156 245 40 2 245 0 128 120 155 249 123 115 117 109 160 -249 123 115 117 109 122 67 128 63 120 3 122 88 122 152 122 -242 2 161 121 219 122 255 155 249 124 116 101 115 116 160 249 -124 116 101 115 116 245 226 0 242 3 161 253 128 123 52 46 - 56 255 242 4 161 253 128 123 48 46 53 255 159 123 245 30 -255 122 122 255 159 123 96 122 120 255 159 123 98 122 120 255 -159 123 116 122 120 255 159 123 118 122 120 255 159 123 100 128 -120 255 159 123 108 128 120 255 67 140 69 121 113 116 68 73 -116 69 123 81 122 69 126 3 122 113 118 68 57 242 3 72 -128 58 108 112 128 68 58 108 72 128 57 242 4 72 128 44 -128 58 100 112 128 68 69 121 113 98 68 69 245 122 0 113 - 96 68 69 121 113 118 182 73 118 42 122 81 122 58 245 32 -255 73 118 57 242 2 94 122 73 118 69 220 10 123 54 118 - 18 122 183 67 147 73 116 69 147 3 122 104 120 68 73 98 - 73 120 111 130 68 58 100 72 136 2 128 73 120 4 122 112 -128 68 58 245 32 255 73 116 57 242 2 59 122 65 120 20 -249 123 115 117 109 8 124 64 122 113 118 184 67 151 73 118 -128 125 73 116 65 120 3 122 113 116 41 118 18 124 185 67 -152 73 120 113 245 30 255 73 98 73 245 30 255 111 130 58 -100 72 136 2 128 73 245 30 255 4 122 112 128 69 120 104 -245 30 255 67 154 57 142 73 116 20 249 124 95 119 114 105 - 8 124 57 142 73 118 69 126 20 249 124 95 119 115 105 8 -126 57 142 58 108 72 128 69 129 69 123 20 249 124 95 119 -114 102 8 134 57 142 73 98 20 249 124 95 119 114 98 8 -124 57 142 20 249 124 95 119 108 110 8 122 88 120 152 245 -226 0 155 249 125 95 109 97 105 110 160 249 125 95 109 97 -105 110 120 242 6 151 122 119 142 255 242 5 161 253 128 125 - 49 53 46 57 54 255 50 242 1 57 242 6 57 120 20 249 -124 95 105 110 105 8 124 67 157 57 242 5 72 128 57 122 -112 128 68 69 219 110 120 68 57 130 20 249 124 116 101 115 -116 8 122 69 120 20 249 124 95 104 108 116 8 122 152 120 -159 124 160 255 159 125 255 -.DE 0 -.IE -.MS T A 0 -.ME -.BP -.MS B A 0 -.ME -.CT diff --git a/doc/em/iotrap.nr b/doc/em/iotrap.nr deleted file mode 100644 index 716f363b9..000000000 --- a/doc/em/iotrap.nr +++ /dev/null @@ -1,376 +0,0 @@ -.SN 8 -.VS 1 0 -.BP -.S1 "ENVIRONMENT INTERACTIONS" -EM programs can interact with their environment in three ways. -Two, starting/stopping and monitor calls, are dealt with in this chapter. -The remaining way to interact, interrupts, will be treated -together with traps in chapter 9. -.S2 "Program starting and stopping" -EM user programs start with a call to a procedure called -m_a_i_n. -The assembler and backends look for the definition of a procedure -with this name in their input. -The call passes three parameters to the procedure. -The parameters are similar to the parameters supplied by the -UNIX -.FS -UNIX is a Trademark of Bell Laboratories. -.FE -operating system to C programs. -These parameters are often called -.BW argc , -.B argv -and -.BW envp . -Argc is the parameter nearest to LB and is a wordsized integer. -The other two are pointers to the first element of an array of -string pointers. -.N -The -.B argv -array contains -.B argc -strings, the first of which contains the program call name. -The other strings in the -.B argv -array are the program parameters. -.P -The -.B envp -array contains strings in the form "name=string", where 'name' -is the name of an environment variable and string its value. -The -.B envp -is terminated by a zero pointer. -.P -An EM user program stops if the program returns from the first -invocation of m_a_i_n. -The contents of the function return area are used to procure a -wordsized program return code. -EM programs also stop when traps and interrupts occur that are -not caught and when the exit monitor call is executed. -.S2 "Input/Output and other monitor calls" -EM differs from most conventional machines in that it has high level i/o -instructions. -Typical instructions are OPEN FILE and READ FROM FILE instead -of low level instructions such as setting and clearing -bits in device registers. -By providing such high level i/o primitives, the task of implementing -EM on various non EM machines is made considerably easier. -.P -I/O is initiated by the MON instruction, which expects an iocode on top -of the stack. -Often there are also parameters which are pushed on the -stack in reverse order, that is: last -parameter first. -Some i/o functions also provide results, which are returned on the stack. -In the list of monitor calls we use several types of parameters and results, -these types consist of integers and unsigneds of varying sizes, but never -smaller than the wordsize, and the two pointer types. -.N 1 -The names of the types used are: -.IS 4 -.PS - 10 -.PT int -an integer of wordsize -.PT int2 -an integer whose size is the maximum of the wordsize and 2 -bytes -.PT int4 -an integer whose size is the maximum of the wordsize and 4 -bytes -.PT intp -an integer with the size of a pointer -.PT uns2 -an unsigned integer whose size is the maximum of the wordsize and 2 -.PT unsp -an unsigned integer with the size of a pointer -.PT ptr -a pointer into data space -.PE 1 -.IE 0 -The table below lists the i/o codes with their results and -parameters. -This list is similar to the system calls of the UNIX Version 7 -operating system. -.BP -.A -To execute a monitor call, proceed as follows: -.IS 2 -.N 1 -.PS a 4 "" ) -.PT -Stack the parameters, in reverse order, last parameter first. -.PT -Push the monitor call number (iocode) onto the stack. -.PT -Execute the MON instruction. -.PE 1 -.IE -An error code is present on the top of the stack after -execution of most monitor calls. -If this error code is zero, the call performed the action -requested and the results are available on top of the stack. -Non-zero error codes indicate a failure, in this case no -results are available and the error code has been pushed twice. -This construction enables programs to test for failure with a -single instruction (~TEQ or TNE~) and still find out the cause of -the failure. -The result name 'e' is reserved for the error code. -.N 1 -List of monitor calls. -.DS B -number name parameters results function - - 1 Exit status:int Terminate this process - 2 Fork e,flag,pid:int Spawn new process - 3 Read fildes:int;buf:ptr;nbytes:unsp - e:int;rbytes:unsp Read from file - 4 Write fildes:int;buf:ptr;nbytes:unsp - e:int;wbytes:unsp Write on a file - 5 Open string:ptr;flag:int - e,fildes:int Open file for read and/or write - 6 Close fildes:int e:int Close a file - 7 Wait e:int;status,pid:int2 - Wait for child - 8 Creat string:ptr;mode:int - e,fildes:int Create a new file - 9 Link string1,string2:ptr - e:int Link to a file - 10 Unlink string:ptr e:int Remove directory entry - 12 Chdir string:ptr e:int Change default directory - 14 Mknod string:ptr;mode,addr:int2 - e:int Make a special file - 15 Chmod string:ptr;mode:int2 - e:int Change mode of file - 16 Chown string:ptr;owner,group:int2 - e:int Change owner/group of a file - 18 Stat string,statbuf:ptr - e:int Get file status - 19 Lseek fildes:int;off:int4;whence:int - e:int;oldoff:int4 Move read/write pointer - 20 Getpid pid:int2 Get process identification - 21 Mount special,string:ptr;rwflag:int - e:int Mount file system - 22 Umount special:ptr e:int Unmount file system - 23 Setuid userid:int2 e:int Set user ID - 24 Getuid e_uid,r_uid:int2 Get user ID - 25 Stime time:int4 e:int Set time and date - 26 Ptrace request:int;pid:int2;addr:ptr;data:int - e,value:int Process trace - 27 Alarm seconds:uns2 previous:uns2 Schedule signal - 28 Fstat fildes:int;statbuf:ptr - e:int Get file status - 29 Pause Stop until signal - 30 Utime string,timep:ptr - e:int Set file times - 33 Access string,mode:int e:int Determine file accessibility - 34 Nice incr:int Set program priority - 35 Ftime bufp:ptr e:int Get date and time - 36 Sync Update filesystem - 37 Kill pid:int2;sig:int - e:int Send signal to a process - 41 Dup fildes,newfildes:int - e,fildes:int Duplicate a file descriptor - 42 Pipe e,w_des,r_des:int Create a pipe - 43 Times buffer:ptr Get process times - 44 Profil buff:ptr;bufsiz,offset,scale:intp Execution time profile - 46 Setgid gid:int2 e:int Set group ID - 47 Getgid e_gid,r_gid:int Get group ID - 48 Sigtrp trapno,signo:int - e,prevtrap:int See below - 51 Acct file:ptr e:int Turn accounting on or off - 53 Lock flag:int e:int Lock a process - 54 Ioctl fildes,request:int;argp:ptr - e:int Control device - 56 Mpxcall cmd:int;vec:ptr e:int Multiplexed file handling - 59 Exece name,argv,envp:ptr - e:int Execute a file - 60 Umask complmode:int2 oldmask:int2 Set file creation mode mask - 61 Chroot string:ptr e:int Change root directory -.DE 1 -Codes 0, 11, 13, 17, 31, 32, 38, 39, 40, 45, 49, 50, 52, -55, 57, 58, 62, and 63 are -not used. -.P -All monitor calls, except fork and sigtrp -are the same as the UNIX version 7 system calls. -.P -The sigtrp entry maps UNIX signals onto EM interrupts. -Normally, trapno is in the range 0 to 252. -In that case it requests that signal signo -will cause trap trapno to occur. -When given trap number -2, default signal handling is reset, and when given -trap number -3, the signal is ignored. -.P -The flag returned by fork is 1 in the child process and 0 in -the parent. -The pid returned is the process-id of the other process. -.BP -.S1 "TRAPS AND INTERRUPTS" -EM provides a means for the user program to catch all traps -generated by the program itself, the hardware, or external conditions. -This mechanism uses five instructions: LIM, SIM, SIG, TRP and RTT. -This section of the manual may be omitted on the first reading since it -presupposes knowledge of the EM instruction set. -.P -The action taken when a trap occures is determined by the value -of an internal EM trap register. -This register contains a pointer to a procedure. -Initially the pointer used is zero and all traps halt the -program with, hopefully, a useful message to the outside world. -The SIG instruction can be used to alter the trap register, -it pops a procedure pointer from the -stack into the trap register. -When a trap occurs after storing a nonzero value in the trap -register, the procedure pointed to by the trap register -is called with the trap number -as the only parameter (see below). -SIG returns the previous value of the trap register on the -stack. -Two consecutive SIGs are a no-op. -When a trap occurs, the trap register is reset to its initial -condition, to prevent recursive traps from hanging the machine up, -e.g. stack overflow in the stack overflow handling procedure. -.P -The runtime systems for some languages need to ignore some EM -traps. -EM offers a feature called the ignore mask. -It contains one bit for each of the lowest 16 trap numbers. -The bits are numbered 0 to 15, with the least significant bit -having number 0. -If a certain bit is 1 the corresponding trap never -occurs and processing simply continues. -The actions performed by the offending instruction are -described by the Pascal program in appendix A. -.N -If the bit is 0, traps are not ignored. -The instructions LIM and SIM allow copying and replacement of -the ignore mask.~ -.P -The TRP instruction generates a trap, the trap number being found on the -stack. -This is, among other things, -useful for library procedures and runtime systems. -It can also be used by a low level trap procedure to pass the trap to a -higher level one (see example below). -.P -The RTT instruction returns from the trap procedure and continues after the -trap. -In the list below all traps marked with an asterisk ('*') are -considered to be fatal and it is explicitly undefined what happens if -you try to restart after the trap. -.P -The way a trap procedure is called is completely compatible -with normal calling conventions. The only way a trap procedure -differs from normal procedures is the return. It has to use RTT instead -of RET. This is necessary because the complete runtime status is saved on the -stack before calling the procedure and all this status has to be reloaded. -Error numbers are in the range 0 to 252. -The trap numbers are divided into three categories: -.IS 4 -.N 1 -.PS - 10 -.PT ~~0-~63 -EM machine errors, e.g. illegal instruction. -.PS - 8 -.PT ~0-15 -maskable -.PT 16-63 -not maskable -.PE -.PT ~64-127 -Reserved for use by compilers, run time systems, etc. -.PT 128-252 -Available for user programs. -.PE 1 -.IE -EM machine errors are numbered as follows: -.DS I 5 -.TS -tab(@); -n l l. -0@EARRAY@Array bound error -1@ERANGE@Range bound error -2@ESET@Set bound error -3@EIOVFL@Integer overflow -4@EFOVFL@Floating overflow -5@EFUNFL@Floating underflow -6@EIDIVZ@Divide by 0 -7@EFDIVZ@Divide by 0.0 -8@EIUND@Undefined integer -9@EFUND@Undefined float -10@ECONV@Conversion error -16*@ESTACK@Stack overflow -17*@EHEAP@Heap overflow -18*@EILLINS@Illegal instruction -19*@EODDZ@Illegal size argument -20*@ECASE@Case error -21*@EMEMFLT@Addressing non existent memory -22*@EBADPTR@Bad pointer used -23*@EBADPC@Program counter out of range -24@EBADLAE@Bad argument of LAE -25@EBADMON@Bad monitor call -26@EBADLIN@Argument of LIN too high -27@EBADGTO@GTO descriptor error -.TE -.DE 0 -.P -As an example, -suppose a subprocedure has to be written to do a numeric -calculation. -When an overflow occurs the computation has to be stopped and -the higher level procedure must be resumed. -This can be programmed as follows using the mechanism described above: -.DS B - mes 2,2,2 ; set sizes -ersave - bss 2,0,0 ; Room to save previous value of trap procedure -msave - bss 2,0,0 ; Room to save previous value of trap mask - - pro calcule,0 ; entry point - lxl 0 ; fill in non-local goto descriptor with LB - ste jmpbuf+4 - lor 1 ; and SP - ste jmpbuf+2 - lim ; get current ignore mask - ste msave ; save it - lim - loc 16 ; bit for EFOVFL - ior 2 ; set in mask - sim ; ignore EFOVFL from now on - lpi $catch ; load procedure identifier - sig ; catch wil get all traps now - ste ersave ; save previous trap procedure identifier -; perform calculation now, possibly generating overflow -1 ; label jumped to by catch procedure - loe ersave ; get old trap procedure - sig ; refer all following trap to old procedure - asp 2 ; remove result of sig - loe msave ; restore previous mask - sim ; done now -; load result of calculation - ret 2 ; return result -jmpbuf - con *1,0,0 - end -.DE 0 -.VS 1 1 -.DS -Example of catch procedure - pro catch,0 ; Local procedure that must catch the overflow trap - lol 2 ; Load trap number - loc 4 ; check for overflow - bne *1 ; if other trap, call higher trap procedure - gto jmpbuf ; return to procedure calcule -1 ; other trap has occurred - loe ersave ; previous trap procedure - sig ; other procedure will get the traps now - asp 2 ; remove the result of sig - lol 2 ; stack trap number - trp ; call other trap procedure - rtt ; if other procedure returns, do the same - end -.DE diff --git a/doc/em/itables b/doc/em/itables deleted file mode 100644 index a4825dc9f..000000000 --- a/doc/em/itables +++ /dev/null @@ -1,2922 +0,0 @@ -.TS -.if \n+(b.=1 .nr d. \n(.c-\n(c.-1 -.de 35 -.ps \n(.s -.vs \n(.vu -.in \n(.iu -.if \n(.u .fi -.if \n(.j .ad -.if \n(.j=0 .na -.. -.nf -.nr #~ 0 -.if \n(.T .if n .nr #~ 0.6n -.ds #d .d -.if \(ts\n(.z\(ts\(ts .ds #d nl -.fc -.nr 33 \n(.s -.rm 66 67 68 69 70 71 72 73 74 75 76 77 -.nr 66 0 -.nr 38 \waar -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wadp -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wadp -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wasp -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wbeq -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wble -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wbne -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wbra -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcff -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcmf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcms -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wdec -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wdup -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wfil -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wine -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \winn -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlae -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlal -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlal -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wldc -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wldl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlfr -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlil -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlni -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wloc -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wloe -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlof -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wloi -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlol -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlol -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlxa -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wmli -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wret -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsbf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wset -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsli -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wstf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsti -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wstl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wstl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wtgt -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzeq -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzge -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzlt -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzre -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzrl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \waar -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wadi -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wads -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wand -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wass -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wbgt -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wbls -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wbne -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcfi -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcmf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcmi -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcmu -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcom -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcsb -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wcui -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wdel -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wdus -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wdvf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wdvu -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wfef -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \winl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \winn -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlar -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wldf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlfr -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlim -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlor -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlxl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wmli -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wmlu -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wngf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wnop -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wret -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wrmu -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wrol -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wrtt -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsbf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsbi -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsbu -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsdf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wset -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsil -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsli -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wslu -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsru -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsts -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wtge -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wxor -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzer -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzle -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzrf -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wdch -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wexg -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wldc -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlal -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wldl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlil -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlof -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wlpi -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wbeq -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wble -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wbne -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wdee -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wfil -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \winl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsde -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wsdl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wste -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wstl -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzgt -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzne -.if \n(66<\n(38 .nr 66 \n(38 -.nr 38 \wzrl -.if \n(66<\n(38 .nr 66 \n(38 -.66 -.rm 66 -.nr 38 4n -.if \n(66<\n(38 .nr 66 \n(38 -.nr 67 0 -.nr 38 \wmwPo -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsN -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmwPo -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmwPo -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsw -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wN2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wswP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmwP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmN -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \ww2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmwPo -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmPo -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wwP2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmwN -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmPo -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmwPo -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmwPo -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmPo -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wwP2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wmwN -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wsP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \ww2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wswN -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wewP2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wewP2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wesP -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wewP2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we2 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \we- -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wN4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wwP4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wwN4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \ww4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wwP4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wwN4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \ww4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wwN4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \w4 -.if \n(67<\n(38 .nr 67 \n(38 -.nr 38 \wwN4 -.if \n(67<\n(38 .nr 67 \n(38 -.67 -.rm 67 -.nr 38 6n -.if \n(67<\n(38 .nr 67 \n(38 -.nr 68 0 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w5 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w2 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w2 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w4 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w8 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w2 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w5 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.nr 38 \w1 -.if \n(68<\n(38 .nr 68 \n(38 -.68 -.rm 68 -.nr 38 2n -.if \n(68<\n(38 .nr 68 \n(38 -.nr 69 0 -.nr 38 \w34 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w38 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w42 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w45 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w52 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w55 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w58 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w62 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w93 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w96 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w100 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w103 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w106 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w109 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w112 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w117 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w120 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w129 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w132 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w136 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w139 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w143 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w146 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w150 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w152 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w155 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w162 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w168 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w174 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w180 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w190 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w194 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w199 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w202 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w206 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w209 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w214 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w218 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w224 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w228 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w235 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w238 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w242 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w245 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w248 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w252 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w1 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w4 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w7 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w10 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w13 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w16 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w19 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w22 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w25 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w28 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w31 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w34 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w37 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w40 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w43 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w46 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w49 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w52 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w55 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w58 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w61 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w64 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w67 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w70 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w73 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w76 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w79 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w82 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w85 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w88 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w91 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w94 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w97 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w100 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w103 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w106 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w109 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w112 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w115 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w118 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w121 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w124 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w127 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w130 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w133 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w136 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w139 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w142 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w145 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w148 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w151 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w154 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w157 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w0 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w3 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w6 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w9 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w12 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w15 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w18 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w21 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w24 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w27 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w30 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w33 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w36 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w39 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w42 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w45 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w48 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w51 -.if \n(69<\n(38 .nr 69 \n(38 -.nr 38 \w54 -.if \n(69<\n(38 .nr 69 \n(38 -.69 -.rm 69 -.nr 38 5n -.if \n(69<\n(38 .nr 69 \n(38 -.nr 70 0 -.nr 38 \wadf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wadp -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wads -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wasp -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wbge -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wblm -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wbra -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcal -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcif -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcmi -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcsa -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wdee -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wdvf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \winc -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \winl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wior -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlae -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlal -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlal -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlde -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wldl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlil -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlin -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wloc -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wloc -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wloe -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlof -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wloi -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlol -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlol -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlxl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wrck -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wrmi -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsbi -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsil -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wste -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wstf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsti -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wstl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wstl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wtlt -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzeq -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzgt -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzne -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzre -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzrl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wadf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wadi -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wadu -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wand -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wass -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wble -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wbls -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcai -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcfu -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcmf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcms -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcmu -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcsa -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcsb -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wcuu -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wdel -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wdus -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wdvi -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wdvu -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wfif -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \winl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wior -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlar -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wldl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlil -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlos -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlpi -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wmlf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wmli -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wmon -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wngi -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wrck -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wrmi -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wrmu -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wror -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsar -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsbf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsbs -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsbu -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsdl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wset -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsil -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsli -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsri -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsru -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsts -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wtle -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wxor -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzge -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzlt -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzrf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wexg -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlpb -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlae -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlde -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wldl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wloc -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wlol -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wadp -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wbge -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wblm -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wbra -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wdel -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wgto -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \winl -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsdf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wsil -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wstf -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzeq -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzle -.if \n(70<\n(38 .nr 70 \n(38 -.nr 38 \wzre -.if \n(70<\n(38 .nr 70 \n(38 -.70 -.rm 70 -.nr 38 4n -.if \n(70<\n(38 .nr 70 \n(38 -.nr 71 0 -.nr 38 \wsP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wswP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsw -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwN -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsw -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wswN -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \ww2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wswN -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wswN -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsw -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wwN2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wswP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wswN -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \ww2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wmwPo -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wwN2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wswN -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wsw -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wwN2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wewN2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wewN2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wewP2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wewP2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wewP2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wewN2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we2 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wesP -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \we- -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \ww4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wwN4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wwP4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wwP4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wwN4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \wwP4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \w4 -.if \n(71<\n(38 .nr 71 \n(38 -.nr 38 \ww4 -.if \n(71<\n(38 .nr 71 \n(38 -.71 -.rm 71 -.nr 38 6n -.if \n(71<\n(38 .nr 71 \n(38 -.nr 72 0 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w2 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w28 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w2 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w3 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w7 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w2 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w5 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w4 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w2 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w2 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w2 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w4 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w2 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.nr 38 \w1 -.if \n(72<\n(38 .nr 72 \n(38 -.72 -.rm 72 -.nr 38 2n -.if \n(72<\n(38 .nr 72 \n(38 -.nr 73 0 -.nr 38 \w35 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w39 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w43 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w50 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w53 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w56 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w59 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w64 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w94 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w97 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w101 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w104 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w107 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w110 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w113 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w118 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w121 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w130 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w133 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w137 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w140 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w144 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w148 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w151 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w153 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w156 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w166 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w169 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w175 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w188 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w191 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w196 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w200 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w203 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w207 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w210 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w215 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w219 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w225 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w233 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w236 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w239 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w243 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w246 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w249 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w253 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w2 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w5 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w8 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w11 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w14 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w17 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w20 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w23 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w26 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w29 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w32 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w35 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w38 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w41 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w44 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w47 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w50 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w53 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w56 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w59 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w62 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w65 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w68 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w71 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w74 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w77 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w80 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w83 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w86 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w89 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w92 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w95 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w98 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w101 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w104 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w107 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w110 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w113 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w116 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w119 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w122 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w125 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w128 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w131 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w134 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w137 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w140 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w143 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w146 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w149 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w152 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w155 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w158 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w1 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w4 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w7 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w10 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w13 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w16 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w19 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w22 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w25 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w28 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w31 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w34 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w37 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w40 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w43 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w46 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w49 -.if \n(73<\n(38 .nr 73 \n(38 -.nr 38 \w52 -.if \n(73<\n(38 .nr 73 \n(38 -.73 -.rm 73 -.nr 38 5n -.if \n(73<\n(38 .nr 73 \n(38 -.nr 74 0 -.nr 38 \wadi -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wadp -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wand -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wbeq -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wbgt -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wblt -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wbra -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcal -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcii -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcmp -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcsb -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wdel -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wdvi -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wine -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \winl -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wior -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlal -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlal -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlar -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlde -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlfr -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlil -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlin -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wloc -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wloc -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlof -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wloi -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wloi -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlol -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlol -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wmlf -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wret -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsar -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsdl -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsil -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wste -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wstf -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsti -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wstl -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wteq -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wtne -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzer -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzle -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzne -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzrl -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \waar -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wadf -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wads -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wadu -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wasp -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wbge -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wblm -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wblt -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcal -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wciu -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcmi -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcms -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcom -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcsa -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcuf -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wdee -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wdup -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wdvf -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wdvi -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wfef -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wfif -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \winn -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wior -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wldc -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wldl -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlil -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlos -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlxa -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wmlf -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wmlu -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wngf -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wngi -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wrck -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wrmi -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wrol -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wror -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsar -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsbi -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsbs -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsde -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsdl -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsig -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsim -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wslu -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsri -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsti -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wstr -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wtrp -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzer -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzgt -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzne -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzrl -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wexg -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wgto -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlal -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wldf -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlil -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wloe -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlol -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wasp -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wbgt -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wblt -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wcal -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wdel -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wine -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wlin -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsdl -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wsil -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wstl -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzge -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzlt -.if \n(74<\n(38 .nr 74 \n(38 -.nr 38 \wzrl -.if \n(74<\n(38 .nr 74 \n(38 -.74 -.rm 74 -.nr 38 4n -.if \n(74<\n(38 .nr 74 \n(38 -.nr 75 0 -.nr 38 \wmwPo -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwPo -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsN -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwPo -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wswN -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwPo -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \ww2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wswN -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wP2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmN -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwPo -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsw -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwPo -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wswP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsN -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wswN -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwPo -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wswN -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wswP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsw -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wsN -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wmwN -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wew2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wew2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wewN2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wewN2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wewN2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wesP -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we- -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wewP2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \we2 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wP4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wwP4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \ww4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wwN4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \ww4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wwN4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \ww4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wwP4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wwN4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wwP4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \w4 -.if \n(75<\n(38 .nr 75 \n(38 -.nr 38 \wwP4 -.if \n(75<\n(38 .nr 75 \n(38 -.75 -.rm 75 -.nr 38 6n -.if \n(75<\n(38 .nr 75 \n(38 -.nr 76 0 -.nr 38 \w2 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w2 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w2 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w34 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w4 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w2 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w3 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w2 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w2 -.if \n(76<\n(38 .nr 76 \n(38 -.nr 38 \w1 -.if \n(76<\n(38 .nr 76 \n(38 -.76 -.rm 76 -.nr 38 2n -.if \n(76<\n(38 .nr 76 \n(38 -.nr 77 0 -.nr 38 \w36 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w41 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w44 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w51 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w54 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w57 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w60 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w92 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w95 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w99 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w102 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w105 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w108 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w111 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w116 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w119 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w128 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w131 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w135 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w138 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w141 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w145 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w149 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w0 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w154 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w161 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w167 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w173 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w176 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w189 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w193 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w197 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w201 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w205 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w208 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w211 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w217 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w223 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w226 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w234 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w237 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w241 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w244 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w247 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w250 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w0 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w3 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w6 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w9 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w12 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w15 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w18 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w21 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w24 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w27 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w30 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w33 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w36 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w39 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w42 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w45 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w48 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w51 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w54 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w57 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w60 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w63 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w66 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w69 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w72 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w75 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w78 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w81 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w84 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w87 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w90 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w93 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w96 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w99 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w102 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w105 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w108 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w111 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w114 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w117 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w120 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w123 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w126 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w129 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w132 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w135 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w138 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w141 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w144 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w147 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w150 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w153 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w156 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w159 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w2 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w5 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w8 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w11 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w14 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w17 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w20 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w23 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w26 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w29 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w32 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w35 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w38 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w41 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w44 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w47 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w50 -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 \w53 -.if \n(77<\n(38 .nr 77 \n(38 -.77 -.rm 77 -.nr 38 5n -.if \n(77<\n(38 .nr 77 \n(38 -.nr 38 1n -.nr 65 0 -.nr 40 \n(65+((0*\n(38)/2) -.nr 66 +\n(40 -.nr 41 \n(66+((0*\n(38)/2) -.nr 67 +\n(41 -.nr 42 \n(67+((0*\n(38)/2) -.nr 68 +\n(42 -.nr 43 \n(68+((0*\n(38)/2) -.nr 69 +\n(43 -.nr 44 \n(69+((16*\n(38)/2) -.nr 70 +\n(44 -.nr 45 \n(70+((0*\n(38)/2) -.nr 71 +\n(45 -.nr 46 \n(71+((0*\n(38)/2) -.nr 72 +\n(46 -.nr 47 \n(72+((0*\n(38)/2) -.nr 73 +\n(47 -.nr 48 \n(73+((16*\n(38)/2) -.nr 74 +\n(48 -.nr 49 \n(74+((0*\n(38)/2) -.nr 75 +\n(49 -.nr 50 \n(75+((0*\n(38)/2) -.nr 76 +\n(50 -.nr 51 \n(76+((0*\n(38)/2) -.nr 77 +\n(51 -.nr TW \n(77 -.if t .if (\n(TW+\n(.o)>7.65i .tm Table at line 121 file Input is too wide - \n(TW units -.fc   -.nr #T 0-1 -.nr #a 0-1 -.eo -.de T# -.nr 35 1m -.ds #d .d -.if \(ts\n(.z\(ts\(ts .ds #d nl -.mk ## -.nr ## -1v -.ls 1 -.ls -.. -.ec -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'aar\h'|\n(41u'mwPo\h'|\n(42u'1\h'|\n(43u'34\h'|\n(44u'adf\h'|\n(45u'sP\h'|\n(46u'1\h'|\n(47u'35\h'|\n(48u'adi\h'|\n(49u'mwPo\h'|\n(50u'2\h'|\n(51u'36 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'adp\h'|\n(41u'2\h'|\n(42u'\h'|\n(43u'38\h'|\n(44u'adp\h'|\n(45u'mPo\h'|\n(46u'2\h'|\n(47u'39\h'|\n(48u'adp\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'41 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'adp\h'|\n(41u'sN\h'|\n(42u'1\h'|\n(43u'42\h'|\n(44u'ads\h'|\n(45u'mwPo\h'|\n(46u'1\h'|\n(47u'43\h'|\n(48u'and\h'|\n(49u'mwPo\h'|\n(50u'1\h'|\n(51u'44 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'asp\h'|\n(41u'mwPo\h'|\n(42u'5\h'|\n(43u'45\h'|\n(44u'asp\h'|\n(45u'swP\h'|\n(46u'1\h'|\n(47u'50\h'|\n(48u'beq\h'|\n(49u'2\h'|\n(50u'\h'|\n(51u'51 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'beq\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'52\h'|\n(44u'bge\h'|\n(45u'sP\h'|\n(46u'1\h'|\n(47u'53\h'|\n(48u'bgt\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'54 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ble\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'55\h'|\n(44u'blm\h'|\n(45u'sP\h'|\n(46u'1\h'|\n(47u'56\h'|\n(48u'blt\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'57 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'bne\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'58\h'|\n(44u'bra\h'|\n(45u'2\h'|\n(46u'\h'|\n(47u'59\h'|\n(48u'bra\h'|\n(49u'sN\h'|\n(50u'2\h'|\n(51u'60 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'bra\h'|\n(41u'sP\h'|\n(42u'2\h'|\n(43u'62\h'|\n(44u'cal\h'|\n(45u'mPo\h'|\n(46u'28\h'|\n(47u'64\h'|\n(48u'cal\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'92 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'cff\h'|\n(41u'-\h'|\n(42u'\h'|\n(43u'93\h'|\n(44u'cif\h'|\n(45u'-\h'|\n(46u'\h'|\n(47u'94\h'|\n(48u'cii\h'|\n(49u'-\h'|\n(50u'\h'|\n(51u'95 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'cmf\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'96\h'|\n(44u'cmi\h'|\n(45u'mwPo\h'|\n(46u'2\h'|\n(47u'97\h'|\n(48u'cmp\h'|\n(49u'-\h'|\n(50u'\h'|\n(51u'99 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'cms\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'100\h'|\n(44u'csa\h'|\n(45u'mwPo\h'|\n(46u'1\h'|\n(47u'101\h'|\n(48u'csb\h'|\n(49u'mwPo\h'|\n(50u'1\h'|\n(51u'102 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'dec\h'|\n(41u'-\h'|\n(42u'\h'|\n(43u'103\h'|\n(44u'dee\h'|\n(45u'sw\h'|\n(46u'1\h'|\n(47u'104\h'|\n(48u'del\h'|\n(49u'swN\h'|\n(50u'1\h'|\n(51u'105 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'dup\h'|\n(41u'mwPo\h'|\n(42u'1\h'|\n(43u'106\h'|\n(44u'dvf\h'|\n(45u'sP\h'|\n(46u'1\h'|\n(47u'107\h'|\n(48u'dvi\h'|\n(49u'mwPo\h'|\n(50u'1\h'|\n(51u'108 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'fil\h'|\n(41u'2\h'|\n(42u'\h'|\n(43u'109\h'|\n(44u'inc\h'|\n(45u'-\h'|\n(46u'\h'|\n(47u'110\h'|\n(48u'ine\h'|\n(49u'w2\h'|\n(50u'\h'|\n(51u'111 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ine\h'|\n(41u'sw\h'|\n(42u'1\h'|\n(43u'112\h'|\n(44u'inl\h'|\n(45u'mwN\h'|\n(46u'3\h'|\n(47u'113\h'|\n(48u'inl\h'|\n(49u'swN\h'|\n(50u'1\h'|\n(51u'116 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'inn\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'117\h'|\n(44u'ior\h'|\n(45u'mwPo\h'|\n(46u'1\h'|\n(47u'118\h'|\n(48u'ior\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'119 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lae\h'|\n(41u'2\h'|\n(42u'\h'|\n(43u'120\h'|\n(44u'lae\h'|\n(45u'sw\h'|\n(46u'7\h'|\n(47u'121\h'|\n(48u'lal\h'|\n(49u'P2\h'|\n(50u'\h'|\n(51u'128 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lal\h'|\n(41u'N2\h'|\n(42u'\h'|\n(43u'129\h'|\n(44u'lal\h'|\n(45u'mP\h'|\n(46u'1\h'|\n(47u'130\h'|\n(48u'lal\h'|\n(49u'mN\h'|\n(50u'1\h'|\n(51u'131 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lal\h'|\n(41u'swP\h'|\n(42u'1\h'|\n(43u'132\h'|\n(44u'lal\h'|\n(45u'swN\h'|\n(46u'2\h'|\n(47u'133\h'|\n(48u'lar\h'|\n(49u'mwPo\h'|\n(50u'1\h'|\n(51u'135 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ldc\h'|\n(41u'mP\h'|\n(42u'1\h'|\n(43u'136\h'|\n(44u'lde\h'|\n(45u'w2\h'|\n(46u'\h'|\n(47u'137\h'|\n(48u'lde\h'|\n(49u'sw\h'|\n(50u'1\h'|\n(51u'138 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ldl\h'|\n(41u'mP\h'|\n(42u'1\h'|\n(43u'139\h'|\n(44u'ldl\h'|\n(45u'swN\h'|\n(46u'1\h'|\n(47u'140\h'|\n(48u'lfr\h'|\n(49u'mwPo\h'|\n(50u'2\h'|\n(51u'141 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lfr\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'143\h'|\n(44u'lil\h'|\n(45u'swN\h'|\n(46u'1\h'|\n(47u'144\h'|\n(48u'lil\h'|\n(49u'swP\h'|\n(50u'1\h'|\n(51u'145 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lil\h'|\n(41u'mwP\h'|\n(42u'2\h'|\n(43u'146\h'|\n(44u'lin\h'|\n(45u'2\h'|\n(46u'\h'|\n(47u'148\h'|\n(48u'lin\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'149 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lni\h'|\n(41u'-\h'|\n(42u'\h'|\n(43u'150\h'|\n(44u'loc\h'|\n(45u'2\h'|\n(46u'\h'|\n(47u'151\h'|\n(48u'loc\h'|\n(49u'mP\h'|\n(50u'34\h'|\n(51u'0 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'loc\h'|\n(41u'mN\h'|\n(42u'1\h'|\n(43u'152\h'|\n(44u'loc\h'|\n(45u'sP\h'|\n(46u'1\h'|\n(47u'153\h'|\n(48u'loc\h'|\n(49u'sN\h'|\n(50u'1\h'|\n(51u'154 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'loe\h'|\n(41u'w2\h'|\n(42u'\h'|\n(43u'155\h'|\n(44u'loe\h'|\n(45u'sw\h'|\n(46u'5\h'|\n(47u'156\h'|\n(48u'lof\h'|\n(49u'2\h'|\n(50u'\h'|\n(51u'161 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lof\h'|\n(41u'mwPo\h'|\n(42u'4\h'|\n(43u'162\h'|\n(44u'lof\h'|\n(45u'sP\h'|\n(46u'1\h'|\n(47u'166\h'|\n(48u'loi\h'|\n(49u'2\h'|\n(50u'\h'|\n(51u'167 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'loi\h'|\n(41u'mPo\h'|\n(42u'1\h'|\n(43u'168\h'|\n(44u'loi\h'|\n(45u'mwPo\h'|\n(46u'4\h'|\n(47u'169\h'|\n(48u'loi\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'173 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lol\h'|\n(41u'wP2\h'|\n(42u'\h'|\n(43u'174\h'|\n(44u'lol\h'|\n(45u'wN2\h'|\n(46u'\h'|\n(47u'175\h'|\n(48u'lol\h'|\n(49u'mwP\h'|\n(50u'4\h'|\n(51u'176 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lol\h'|\n(41u'mwN\h'|\n(42u'8\h'|\n(43u'180\h'|\n(44u'lol\h'|\n(45u'swP\h'|\n(46u'1\h'|\n(47u'188\h'|\n(48u'lol\h'|\n(49u'swN\h'|\n(50u'1\h'|\n(51u'189 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lxa\h'|\n(41u'mPo\h'|\n(42u'1\h'|\n(43u'190\h'|\n(44u'lxl\h'|\n(45u'mPo\h'|\n(46u'2\h'|\n(47u'191\h'|\n(48u'mlf\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'193 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'mli\h'|\n(41u'mwPo\h'|\n(42u'2\h'|\n(43u'194\h'|\n(44u'rck\h'|\n(45u'mwPo\h'|\n(46u'1\h'|\n(47u'196\h'|\n(48u'ret\h'|\n(49u'mwP\h'|\n(50u'2\h'|\n(51u'197 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ret\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'199\h'|\n(44u'rmi\h'|\n(45u'mwPo\h'|\n(46u'1\h'|\n(47u'200\h'|\n(48u'sar\h'|\n(49u'mwPo\h'|\n(50u'1\h'|\n(51u'201 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sbf\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'202\h'|\n(44u'sbi\h'|\n(45u'mwPo\h'|\n(46u'2\h'|\n(47u'203\h'|\n(48u'sdl\h'|\n(49u'swN\h'|\n(50u'1\h'|\n(51u'205 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'set\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'206\h'|\n(44u'sil\h'|\n(45u'swN\h'|\n(46u'1\h'|\n(47u'207\h'|\n(48u'sil\h'|\n(49u'swP\h'|\n(50u'1\h'|\n(51u'208 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sli\h'|\n(41u'mwPo\h'|\n(42u'1\h'|\n(43u'209\h'|\n(44u'ste\h'|\n(45u'w2\h'|\n(46u'\h'|\n(47u'210\h'|\n(48u'ste\h'|\n(49u'sw\h'|\n(50u'3\h'|\n(51u'211 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'stf\h'|\n(41u'2\h'|\n(42u'\h'|\n(43u'214\h'|\n(44u'stf\h'|\n(45u'mwPo\h'|\n(46u'2\h'|\n(47u'215\h'|\n(48u'stf\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'217 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sti\h'|\n(41u'mPo\h'|\n(42u'1\h'|\n(43u'218\h'|\n(44u'sti\h'|\n(45u'mwPo\h'|\n(46u'4\h'|\n(47u'219\h'|\n(48u'sti\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'223 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'stl\h'|\n(41u'wP2\h'|\n(42u'\h'|\n(43u'224\h'|\n(44u'stl\h'|\n(45u'wN2\h'|\n(46u'\h'|\n(47u'225\h'|\n(48u'stl\h'|\n(49u'mwP\h'|\n(50u'2\h'|\n(51u'226 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'stl\h'|\n(41u'mwN\h'|\n(42u'5\h'|\n(43u'228\h'|\n(44u'stl\h'|\n(45u'swN\h'|\n(46u'1\h'|\n(47u'233\h'|\n(48u'teq\h'|\n(49u'-\h'|\n(50u'\h'|\n(51u'234 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'tgt\h'|\n(41u'-\h'|\n(42u'\h'|\n(43u'235\h'|\n(44u'tlt\h'|\n(45u'-\h'|\n(46u'\h'|\n(47u'236\h'|\n(48u'tne\h'|\n(49u'-\h'|\n(50u'\h'|\n(51u'237 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zeq\h'|\n(41u'2\h'|\n(42u'\h'|\n(43u'238\h'|\n(44u'zeq\h'|\n(45u'sP\h'|\n(46u'2\h'|\n(47u'239\h'|\n(48u'zer\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'241 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zge\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'242\h'|\n(44u'zgt\h'|\n(45u'sP\h'|\n(46u'1\h'|\n(47u'243\h'|\n(48u'zle\h'|\n(49u'sP\h'|\n(50u'1\h'|\n(51u'244 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zlt\h'|\n(41u'sP\h'|\n(42u'1\h'|\n(43u'245\h'|\n(44u'zne\h'|\n(45u'sP\h'|\n(46u'1\h'|\n(47u'246\h'|\n(48u'zne\h'|\n(49u'sN\h'|\n(50u'1\h'|\n(51u'247 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zre\h'|\n(41u'w2\h'|\n(42u'\h'|\n(43u'248\h'|\n(44u'zre\h'|\n(45u'sw\h'|\n(46u'1\h'|\n(47u'249\h'|\n(48u'zrl\h'|\n(49u'mwN\h'|\n(50u'2\h'|\n(51u'250 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zrl\h'|\n(41u'swN\h'|\n(42u'1\h'|\n(43u'252\h'|\n(44u'zrl\h'|\n(45u'wN2\h'|\n(46u'\h'|\n(47u'253\h'|\n(48u'aar\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'0 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'aar\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'1\h'|\n(44u'adf\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'2\h'|\n(48u'adf\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'3 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'adi\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'4\h'|\n(44u'adi\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'5\h'|\n(48u'ads\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'6 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ads\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'7\h'|\n(44u'adu\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'8\h'|\n(48u'adu\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'9 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'and\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'10\h'|\n(44u'and\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'11\h'|\n(48u'asp\h'|\n(49u'ew2\h'|\n(50u'\h'|\n(51u'12 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ass\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'13\h'|\n(44u'ass\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'14\h'|\n(48u'bge\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'15 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'bgt\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'16\h'|\n(44u'ble\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'17\h'|\n(48u'blm\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'18 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'bls\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'19\h'|\n(44u'bls\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'20\h'|\n(48u'blt\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'21 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'bne\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'22\h'|\n(44u'cai\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'23\h'|\n(48u'cal\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'24 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'cfi\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'25\h'|\n(44u'cfu\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'26\h'|\n(48u'ciu\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'27 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'cmf\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'28\h'|\n(44u'cmf\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'29\h'|\n(48u'cmi\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'30 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'cmi\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'31\h'|\n(44u'cms\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'32\h'|\n(48u'cms\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'33 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'cmu\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'34\h'|\n(44u'cmu\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'35\h'|\n(48u'com\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'36 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'com\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'37\h'|\n(44u'csa\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'38\h'|\n(48u'csa\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'39 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'csb\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'40\h'|\n(44u'csb\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'41\h'|\n(48u'cuf\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'42 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'cui\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'43\h'|\n(44u'cuu\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'44\h'|\n(48u'dee\h'|\n(49u'ew2\h'|\n(50u'\h'|\n(51u'45 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'del\h'|\n(41u'ewP2\h'|\n(42u'\h'|\n(43u'46\h'|\n(44u'del\h'|\n(45u'ewN2\h'|\n(46u'\h'|\n(47u'47\h'|\n(48u'dup\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'48 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'dus\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'49\h'|\n(44u'dus\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'50\h'|\n(48u'dvf\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'51 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'dvf\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'52\h'|\n(44u'dvi\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'53\h'|\n(48u'dvi\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'54 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'dvu\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'55\h'|\n(44u'dvu\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'56\h'|\n(48u'fef\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'57 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'fef\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'58\h'|\n(44u'fif\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'59\h'|\n(48u'fif\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'60 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'inl\h'|\n(41u'ewP2\h'|\n(42u'\h'|\n(43u'61\h'|\n(44u'inl\h'|\n(45u'ewN2\h'|\n(46u'\h'|\n(47u'62\h'|\n(48u'inn\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'63 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'inn\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'64\h'|\n(44u'ior\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'65\h'|\n(48u'ior\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'66 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lar\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'67\h'|\n(44u'lar\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'68\h'|\n(48u'ldc\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'69 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ldf\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'70\h'|\n(44u'ldl\h'|\n(45u'ewP2\h'|\n(46u'\h'|\n(47u'71\h'|\n(48u'ldl\h'|\n(49u'ewN2\h'|\n(50u'\h'|\n(51u'72 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lfr\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'73\h'|\n(44u'lil\h'|\n(45u'ewP2\h'|\n(46u'\h'|\n(47u'74\h'|\n(48u'lil\h'|\n(49u'ewN2\h'|\n(50u'\h'|\n(51u'75 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lim\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'76\h'|\n(44u'los\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'77\h'|\n(48u'los\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'78 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lor\h'|\n(41u'esP\h'|\n(42u'1\h'|\n(43u'79\h'|\n(44u'lpi\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'80\h'|\n(48u'lxa\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'81 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lxl\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'82\h'|\n(44u'mlf\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'83\h'|\n(48u'mlf\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'84 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'mli\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'85\h'|\n(44u'mli\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'86\h'|\n(48u'mlu\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'87 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'mlu\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'88\h'|\n(44u'mon\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'89\h'|\n(48u'ngf\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'90 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ngf\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'91\h'|\n(44u'ngi\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'92\h'|\n(48u'ngi\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'93 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'nop\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'94\h'|\n(44u'rck\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'95\h'|\n(48u'rck\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'96 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ret\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'97\h'|\n(44u'rmi\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'98\h'|\n(48u'rmi\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'99 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'rmu\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'100\h'|\n(44u'rmu\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'101\h'|\n(48u'rol\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'102 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'rol\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'103\h'|\n(44u'ror\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'104\h'|\n(48u'ror\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'105 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'rtt\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'106\h'|\n(44u'sar\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'107\h'|\n(48u'sar\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'108 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sbf\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'109\h'|\n(44u'sbf\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'110\h'|\n(48u'sbi\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'111 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sbi\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'112\h'|\n(44u'sbs\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'113\h'|\n(48u'sbs\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'114 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sbu\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'115\h'|\n(44u'sbu\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'116\h'|\n(48u'sde\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'117 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sdf\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'118\h'|\n(44u'sdl\h'|\n(45u'ewP2\h'|\n(46u'\h'|\n(47u'119\h'|\n(48u'sdl\h'|\n(49u'ewN2\h'|\n(50u'\h'|\n(51u'120 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'set\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'121\h'|\n(44u'set\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'122\h'|\n(48u'sig\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'123 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sil\h'|\n(41u'ewP2\h'|\n(42u'\h'|\n(43u'124\h'|\n(44u'sil\h'|\n(45u'ewN2\h'|\n(46u'\h'|\n(47u'125\h'|\n(48u'sim\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'126 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sli\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'127\h'|\n(44u'sli\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'128\h'|\n(48u'slu\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'129 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'slu\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'130\h'|\n(44u'sri\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'131\h'|\n(48u'sri\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'132 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sru\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'133\h'|\n(44u'sru\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'134\h'|\n(48u'sti\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'135 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sts\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'136\h'|\n(44u'sts\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'137\h'|\n(48u'str\h'|\n(49u'esP\h'|\n(50u'1\h'|\n(51u'138 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'tge\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'139\h'|\n(44u'tle\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'140\h'|\n(48u'trp\h'|\n(49u'e-\h'|\n(50u'\h'|\n(51u'141 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'xor\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'142\h'|\n(44u'xor\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'143\h'|\n(48u'zer\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'144 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zer\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'145\h'|\n(44u'zge\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'146\h'|\n(48u'zgt\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'147 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zle\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'148\h'|\n(44u'zlt\h'|\n(45u'e2\h'|\n(46u'\h'|\n(47u'149\h'|\n(48u'zne\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'150 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zrf\h'|\n(41u'e2\h'|\n(42u'\h'|\n(43u'151\h'|\n(44u'zrf\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'152\h'|\n(48u'zrl\h'|\n(49u'ewP2\h'|\n(50u'\h'|\n(51u'153 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'dch\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'154\h'|\n(44u'exg\h'|\n(45u'esP\h'|\n(46u'1\h'|\n(47u'155\h'|\n(48u'exg\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'156 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'exg\h'|\n(41u'e-\h'|\n(42u'\h'|\n(43u'157\h'|\n(44u'lpb\h'|\n(45u'e-\h'|\n(46u'\h'|\n(47u'158\h'|\n(48u'gto\h'|\n(49u'e2\h'|\n(50u'\h'|\n(51u'159 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ldc\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'0\h'|\n(44u'lae\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'1\h'|\n(48u'lal\h'|\n(49u'P4\h'|\n(50u'\h'|\n(51u'2 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lal\h'|\n(41u'N4\h'|\n(42u'\h'|\n(43u'3\h'|\n(44u'lde\h'|\n(45u'w4\h'|\n(46u'\h'|\n(47u'4\h'|\n(48u'ldf\h'|\n(49u'4\h'|\n(50u'\h'|\n(51u'5 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ldl\h'|\n(41u'wP4\h'|\n(42u'\h'|\n(43u'6\h'|\n(44u'ldl\h'|\n(45u'wN4\h'|\n(46u'\h'|\n(47u'7\h'|\n(48u'lil\h'|\n(49u'wP4\h'|\n(50u'\h'|\n(51u'8 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lil\h'|\n(41u'wN4\h'|\n(42u'\h'|\n(43u'9\h'|\n(44u'loc\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'10\h'|\n(48u'loe\h'|\n(49u'w4\h'|\n(50u'\h'|\n(51u'11 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lof\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'12\h'|\n(44u'lol\h'|\n(45u'wP4\h'|\n(46u'\h'|\n(47u'13\h'|\n(48u'lol\h'|\n(49u'wN4\h'|\n(50u'\h'|\n(51u'14 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'lpi\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'15\h'|\n(44u'adp\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'16\h'|\n(48u'asp\h'|\n(49u'w4\h'|\n(50u'\h'|\n(51u'17 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'beq\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'18\h'|\n(44u'bge\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'19\h'|\n(48u'bgt\h'|\n(49u'4\h'|\n(50u'\h'|\n(51u'20 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ble\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'21\h'|\n(44u'blm\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'22\h'|\n(48u'blt\h'|\n(49u'4\h'|\n(50u'\h'|\n(51u'23 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'bne\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'24\h'|\n(44u'bra\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'25\h'|\n(48u'cal\h'|\n(49u'4\h'|\n(50u'\h'|\n(51u'26 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'dee\h'|\n(41u'w4\h'|\n(42u'\h'|\n(43u'27\h'|\n(44u'del\h'|\n(45u'wP4\h'|\n(46u'\h'|\n(47u'28\h'|\n(48u'del\h'|\n(49u'wN4\h'|\n(50u'\h'|\n(51u'29 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'fil\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'30\h'|\n(44u'gto\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'31\h'|\n(48u'ine\h'|\n(49u'w4\h'|\n(50u'\h'|\n(51u'32 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'inl\h'|\n(41u'wP4\h'|\n(42u'\h'|\n(43u'33\h'|\n(44u'inl\h'|\n(45u'wN4\h'|\n(46u'\h'|\n(47u'34\h'|\n(48u'lin\h'|\n(49u'4\h'|\n(50u'\h'|\n(51u'35 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sde\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'36\h'|\n(44u'sdf\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'37\h'|\n(48u'sdl\h'|\n(49u'wP4\h'|\n(50u'\h'|\n(51u'38 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'sdl\h'|\n(41u'wN4\h'|\n(42u'\h'|\n(43u'39\h'|\n(44u'sil\h'|\n(45u'wP4\h'|\n(46u'\h'|\n(47u'40\h'|\n(48u'sil\h'|\n(49u'wN4\h'|\n(50u'\h'|\n(51u'41 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'ste\h'|\n(41u'w4\h'|\n(42u'\h'|\n(43u'42\h'|\n(44u'stf\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'43\h'|\n(48u'stl\h'|\n(49u'wP4\h'|\n(50u'\h'|\n(51u'44 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'stl\h'|\n(41u'wN4\h'|\n(42u'\h'|\n(43u'45\h'|\n(44u'zeq\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'46\h'|\n(48u'zge\h'|\n(49u'4\h'|\n(50u'\h'|\n(51u'47 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zgt\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'48\h'|\n(44u'zle\h'|\n(45u'4\h'|\n(46u'\h'|\n(47u'49\h'|\n(48u'zlt\h'|\n(49u'4\h'|\n(50u'\h'|\n(51u'50 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zne\h'|\n(41u'4\h'|\n(42u'\h'|\n(43u'51\h'|\n(44u'zre\h'|\n(45u'w4\h'|\n(46u'\h'|\n(47u'52\h'|\n(48u'zrl\h'|\n(49u'wP4\h'|\n(50u'\h'|\n(51u'53 -.ta \n(66u \n(67u \n(68u \n(69u \n(70u \n(71u \n(72u \n(73u \n(74u \n(75u \n(76u \n(77u -.nr 35 1m -.nr 31 \n(.f -\&\h'|\n(40u'zrl\h'|\n(41u'wN4\h'|\n(42u'\h'|\n(43u'54\h'|\n(44u'\h'|\n(45u'\h'|\n(46u'\h'|\n(47u'\h'|\n(48u'\h'|\n(49u'\h'|\n(50u'\h'|\n(51u' -.fc -.nr T. 1 -.T# 1 -.35 -.TE -.if \n-(b.=0 .nr c. \n(.c-\n(d.-120 diff --git a/emtest/last b/emtest/last deleted file mode 100644 index 573541ac9..000000000 --- a/emtest/last +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/emtest/test.e b/emtest/test.e deleted file mode 100644 index 7f26cf5f5..000000000 --- a/emtest/test.e +++ /dev/null @@ -1,28 +0,0 @@ -#define WS EM_WSIZE -#define PS EM_PSIZE -#include "test.h" - mes 2,WS,PS - mes 1 - mes 4,300 -.000 - con "tst000" - exp $m_a_i_n - pro $m_a_i_n,0 - loc 123 - loc -98 -; TEST 000: empty - fil .000 - loc -98 - bne *1 - loc 123 - bne *1 - lin 0 - nop - loc 0 - ret WS -1 - lin 1 - nop - loc 1 - ret WS - end diff --git a/include/.distr b/include/.distr new file mode 100644 index 000000000..b13b150f1 --- /dev/null +++ b/include/.distr @@ -0,0 +1,3 @@ +_tail_mon +_tail_cc +occam diff --git a/lang/cem/.distr b/lang/cem/.distr new file mode 100644 index 000000000..c48401f19 --- /dev/null +++ b/lang/cem/.distr @@ -0,0 +1,3 @@ +cemcom +ctest +libcc diff --git a/lang/cem/cemcom/Files b/lang/cem/cemcom/Files deleted file mode 100644 index 13726df5c..000000000 --- a/lang/cem/cemcom/Files +++ /dev/null @@ -1,88 +0,0 @@ -Files -cem.1 -cem.c -cemcom.1 -Parameters -Makefile -LLlex.c -LLlex.h -LLmessage.c -align.h -alloc.c -alloc.h -arith.c -arith.h -asm.c -assert.h -atw.h -blocks.c -char.tab -ch7.c -ch7bin.c -ch7mon.c -class.h -code.c -code.str -conversion.c -cstoper.c -dataflow.c -declar.g -declarator.c -declar.str -decspecs.c -decspecs.str -def.str -domacro.c -dumpidf.c -error.c -eval.c -expr.c -expr.str -expression.g -faulty.h -field.c -field.str -file_info.h -idf.c -idf.str -init.c -input.c -input.h -interface.h -ival.c -label.c -label.h -level.h -macro.str -main.c -make.allocd -make.hfiles -make.next -make.tokcase -make.tokfile -mcomm.c -mes.h -options -options.c -program.g -replace.c -scan.c -sizes.h -skip.c -specials.h -stack.c -stack.str -statement.g -stb.c -storage.c -storage.h -stmt.str -struct.c -struct.str -switch.c -switch.str -tab.c -tokenname.c -tokenname.h -type.c -type.str diff --git a/lang/cem/cemcom/Makefile.erik b/lang/cem/cemcom/Makefile.erik deleted file mode 100644 index 7806b2d9f..000000000 --- a/lang/cem/cemcom/Makefile.erik +++ /dev/null @@ -1,799 +0,0 @@ -# $Header$ -# M A K E F I L E F O R A C K C - C O M P I L E R - -# Machine and environ dependent definitions -EMHOME = /usr/em# # ACK tree on this machine -DESTINATION = /user1/$$USER/bin# # where to put the stuff -MKDEP = $(EMHOME)/bin/mkdep# # dependency generator -MAP = -#MAP = -DInsertFile=ins_file -DInsertText=ins_text# bug in m68k2 back end -SIM = /user1/dick/bin/sim# # Dicks sim program -LINT = /usr/new/lint - -# Libraries and EM interface definitions -SYSLIB = $(EMHOME)/modules/lib/libsystem.a -EMKLIB = $(EMHOME)/modules/lib/libemk.a -EMELIB = $(EMHOME)/modules/lib/libeme.a -STRLIB = $(EMHOME)/modules/lib/libstring.a -PRTLIB = $(EMHOME)/modules/lib/libprint.a -EMMESLIB = $(EMHOME)/modules/lib/libem_mes.a -INPLIB = $(EMHOME)/modules/lib/libinput.a -ALLOCLIB = $(EMHOME)/modules/lib/liballoc.a -MALLOC = $(EMHOME)/modules/lib/malloc.o -#CH3LIB = $(EMHOME)/modules/lib/libch3.a -CH3LIB = -LIBS = $(INPLIB) $(CH3LIB) $(EMMESLIB) $(EMKLIB) \ - $(PRTLIB) $(STRLIB) $(ALLOCLIB) $(MALLOC) $(SYSLIB) -ELIBS = $(INPLIB) $(CH3LIB) $(EMMESLIB) $(EMELIB) \ - $(PRTLIB) $(STRLIB) $(ALLOCLIB) $(MALLOC) $(SYSLIB) -LIB_INCLUDES = -I$(EMHOME)/modules/h -I$(EMHOME)/modules/pkg -EM_INCLUDES = -I$(EMHOME)/h -SYSLLIB = $(EMHOME)/modules/lib/llib-lsys.ln -EMKLLIB = $(EMHOME)/modules/lib/llib-lemk.ln -EMELLIB = $(EMHOME)/modules/lib/llib-leme.ln -STRLLIB = $(EMHOME)/modules/lib/llib-lstr.ln -PRTLLIB = $(EMHOME)/modules/lib/llib-lprint.ln -EMMESLLIB = $(EMHOME)/modules/lib/llib-lmes.ln -INPLLIB = $(EMHOME)/modules/lib/llib-linput.ln -CH3LLIB = $(EMHOME)/modules/lib/llib-lch3.ln -ALLOCLLIB = $(EMHOME)/modules/lib/llib-alloc.ln -LINTLIBS = -#LINTLIBS = $(CH3LLIB) $(INPLLIB) $(EMMESLLIB) $(EMKLLIB) \ -# $(PRTLLIB) $(STRLLIB) $(SYSLLIB) $(ALLOCLLIB) - -# Where to install the compiler and its driver -CEMCOM = $(DESTINATION)/cemcom -DRIVER = $(DESTINATION)/cem - -# What C compiler to use and how -# CC = $(ACK) -.c -# CC = CC -# CC = /bin/cc -COPTIONS = - -# What parser generator to use and how -GEN = $(EMHOME)/bin/LLgen -GENOPTIONS = -vv - -# Special #defines during compilation -CDEFS = $(MAP) $(EM_INCLUDES) $(LIB_INCLUDES) -CFLAGS = $(CDEFS) $(COPTIONS) -O# we cannot pass the COPTIONS to lint! - -# Grammar files and their objects -LSRC = tokenfile.g declar.g statement.g expression.g program.g ival.g -GLCSRC = tokenfile.c declar.c statement.c expression.c program.c ival.c -LOBJ = tokenfile.o declar.o statement.o expression.o program.o Lpars.o ival.o - -# Objects of hand-written C files -COBJ = main.o idf.o declarator.o decspecs.o struct.o \ - expr.o ch7.o ch7bin.o cstoper.o arith.o \ - asm.o code.o dumpidf.o error.o field.o\ - tokenname.o LLlex.o LLmessage.o \ - input.o domacro.o replace.o init.o options.o \ - scan.o skip.o stack.o type.o ch7mon.o label.o eval.o \ - switch.o conversion.o \ - blocks.o dataflow.o Version.o - -# Objects of other generated C files -GOBJ = char.o symbol2str.o next.o - -# generated source files -GSRC = char.c symbol2str.c next.c \ - code.h declar.h decspecs.h def.h expr.h field.h estack.h \ - idf.h macro.h stack.h stmt.h struct.h switch.h type.h - -# .h files generated by `make hfiles'; PLEASE KEEP THIS UP-TO-DATE! -GHSRC = botch_free.h dataflow.h debug.h density.h errout.h \ - idfsize.h ifdepth.h inputtype.h inumlength.h lapbuf.h \ - maxincl.h nobitfield.h nofloat.h nopp.h noRoption.h nocross.h \ - nparams.h numsize.h parbufsize.h pathlength.h \ - strsize.h target_sizes.h textsize.h use_tmp.h spec_arith.h static.h - -# Other generated files, for 'make clean' only -GENERATED = tab tokenfile.g Lpars.h LLfiles LL.output lint.out \ - print Xref lxref hfiles cfiles $(GLCSRC) - -# include files containing ALLOCDEF specifications -NEXTFILES = code.str declar.str decspecs.str def.str expr.str field.str \ - estack.str \ - idf.str macro.str stack.str stmt.str struct.str switch.str type.str - -.SUFFIXES: .str .h -.str.h: - ./make.allocd <$*.str >$*.h - -all: cc - -cc: - make "CC=$(CC)" hfiles - make "CC=$(CC)" LLfiles - make "CC=$(CC)" main - -cem: cem.c - $(CC) -O cem.c $(SYSLIB) -o cem - -lint.cem: cem.c - $(LINT) -bx cem.c - -hfiles: ./make.hfiles Parameters - ./make.hfiles Parameters - @touch hfiles - -LLfiles: $(LSRC) - $(GEN) $(GENOPTIONS) $(LSRC) - @touch LLfiles - -tokenfile.g: tokenname.c make.tokfile - tokenfile.g - -symbol2str.c: tokenname.c make.tokcase - symbol2str.c - -char.c: tab char.tab - tab -fchar.tab >char.c - -next.c: make.next $(NEXTFILES) - ./make.next $(NEXTFILES) >next.c - -code.h: make.allocd -declar.h: make.allocd -decspecs.h: make.allocd -def.h: make.allocd -estack.h: make.allocd -expr.h: make.allocd -field.h: make.allocd -idf.h: make.allocd -macro.h: make.allocd -stack.h: make.allocd -stmt.h: make.allocd -struct.h: make.allocd -switch.h: make.allocd -type.h: make.allocd - -# Objects needed for 'main' -OBJ = $(COBJ) $(LOBJ) $(GOBJ) - -main: $(OBJ) Makefile - $(CC) $(COPTIONS) $(LFLAGS) $(OBJ) $(LIBS) -o main - size main - -emain: $(OBJ) Makefile - $(CC) $(COPTIONS) $(LFLAGS) $(OBJ) $(ELIBS) -o emain - size emain - -cfiles: hfiles LLfiles $(GSRC) - @touch cfiles - -install: main cem - cp main $(CEMCOM) - cp cem $(DRIVER) - -print: files - pr `cat files` > print - -tags: cfiles - ctags `sources $(OBJ)` - -shar: files - shar `cat files` - -listcfiles: - @echo `sources $(OBJ)` - -listobjects: - @echo $(OBJ) - -depend: cfiles - sed '/^#AUTOAUTO/,$$d' Makefile >Makefile.new - echo '#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO' >>Makefile.new - $(MKDEP) `sources $(OBJ)` | sed 's/\.c:/.o:/' >>Makefile.new - mv Makefile Makefile.old - mv Makefile.new Makefile - -xref: - ctags -x `grep "\.[ch]" files`|sed "s/).*/)/">Xref - -lxref: - lxref $(OBJ) -lc >lxref - -lint: lint.main lint.cem lint.tab - -lint.main: cfiles - $(LINT) -bx $(CDEFS) `sources $(OBJ)` $(LINTLIBS) >lint.out - -cchk: - cchk `sources $(COBJ)` - -clean: - rm -f `sources $(LOBJ)` $(OBJ) $(GENERATED) $(GSRC) $(GHSRC) - -tab: - $(CC) tab.c -o tab - -lint.tab: - $(LINT) -abx tab.c - -sim: cfiles - $(SIM) $(SIMFLAGS) `sources $(COBJ)` $(GSRC) $(LSRC) - -#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO -main.o: LLlex.h -main.o: Lpars.h -main.o: align.h -main.o: arith.h -main.o: debug.h -main.o: declar.h -main.o: file_info.h -main.o: idf.h -main.o: input.h -main.o: inputtype.h -main.o: level.h -main.o: maxincl.h -main.o: noRoption.h -main.o: nobitfield.h -main.o: nocross.h -main.o: nofloat.h -main.o: nopp.h -main.o: sizes.h -main.o: spec_arith.h -main.o: specials.h -main.o: target_sizes.h -main.o: tokenname.h -main.o: type.h -main.o: use_tmp.h -idf.o: LLlex.h -idf.o: Lpars.h -idf.o: align.h -idf.o: arith.h -idf.o: assert.h -idf.o: botch_free.h -idf.o: debug.h -idf.o: declar.h -idf.o: decspecs.h -idf.o: def.h -idf.o: file_info.h -idf.o: idf.h -idf.o: idfsize.h -idf.o: label.h -idf.o: level.h -idf.o: noRoption.h -idf.o: nobitfield.h -idf.o: nocross.h -idf.o: nofloat.h -idf.o: nopp.h -idf.o: sizes.h -idf.o: spec_arith.h -idf.o: specials.h -idf.o: stack.h -idf.o: struct.h -idf.o: target_sizes.h -idf.o: type.h -declarator.o: Lpars.h -declarator.o: arith.h -declarator.o: botch_free.h -declarator.o: declar.h -declarator.o: expr.h -declarator.o: idf.h -declarator.o: label.h -declarator.o: nobitfield.h -declarator.o: nocross.h -declarator.o: nofloat.h -declarator.o: nopp.h -declarator.o: sizes.h -declarator.o: spec_arith.h -declarator.o: target_sizes.h -declarator.o: type.h -decspecs.o: Lpars.h -decspecs.o: arith.h -decspecs.o: decspecs.h -decspecs.o: def.h -decspecs.o: level.h -decspecs.o: noRoption.h -decspecs.o: nobitfield.h -decspecs.o: nofloat.h -decspecs.o: spec_arith.h -decspecs.o: type.h -struct.o: LLlex.h -struct.o: Lpars.h -struct.o: align.h -struct.o: arith.h -struct.o: assert.h -struct.o: botch_free.h -struct.o: debug.h -struct.o: def.h -struct.o: field.h -struct.o: file_info.h -struct.o: idf.h -struct.o: level.h -struct.o: noRoption.h -struct.o: nobitfield.h -struct.o: nocross.h -struct.o: nofloat.h -struct.o: nopp.h -struct.o: sizes.h -struct.o: spec_arith.h -struct.o: stack.h -struct.o: struct.h -struct.o: target_sizes.h -struct.o: type.h -expr.o: LLlex.h -expr.o: Lpars.h -expr.o: arith.h -expr.o: botch_free.h -expr.o: declar.h -expr.o: decspecs.h -expr.o: def.h -expr.o: expr.h -expr.o: file_info.h -expr.o: idf.h -expr.o: label.h -expr.o: level.h -expr.o: noRoption.h -expr.o: nobitfield.h -expr.o: nocross.h -expr.o: nofloat.h -expr.o: nopp.h -expr.o: sizes.h -expr.o: spec_arith.h -expr.o: target_sizes.h -expr.o: type.h -ch7.o: Lpars.h -ch7.o: arith.h -ch7.o: assert.h -ch7.o: debug.h -ch7.o: def.h -ch7.o: expr.h -ch7.o: idf.h -ch7.o: label.h -ch7.o: nobitfield.h -ch7.o: nofloat.h -ch7.o: nopp.h -ch7.o: spec_arith.h -ch7.o: struct.h -ch7.o: type.h -ch7bin.o: Lpars.h -ch7bin.o: arith.h -ch7bin.o: botch_free.h -ch7bin.o: expr.h -ch7bin.o: idf.h -ch7bin.o: label.h -ch7bin.o: noRoption.h -ch7bin.o: nobitfield.h -ch7bin.o: nofloat.h -ch7bin.o: nopp.h -ch7bin.o: spec_arith.h -ch7bin.o: struct.h -ch7bin.o: type.h -cstoper.o: Lpars.h -cstoper.o: arith.h -cstoper.o: assert.h -cstoper.o: debug.h -cstoper.o: expr.h -cstoper.o: idf.h -cstoper.o: label.h -cstoper.o: nobitfield.h -cstoper.o: nocross.h -cstoper.o: nofloat.h -cstoper.o: nopp.h -cstoper.o: sizes.h -cstoper.o: spec_arith.h -cstoper.o: target_sizes.h -cstoper.o: type.h -arith.o: Lpars.h -arith.o: arith.h -arith.o: botch_free.h -arith.o: expr.h -arith.o: field.h -arith.o: idf.h -arith.o: label.h -arith.o: mes.h -arith.o: noRoption.h -arith.o: nobitfield.h -arith.o: nofloat.h -arith.o: nopp.h -arith.o: spec_arith.h -arith.o: type.h -code.o: LLlex.h -code.o: Lpars.h -code.o: align.h -code.o: arith.h -code.o: assert.h -code.o: atw.h -code.o: botch_free.h -code.o: code.h -code.o: dataflow.h -code.o: debug.h -code.o: declar.h -code.o: decspecs.h -code.o: def.h -code.o: expr.h -code.o: file_info.h -code.o: idf.h -code.o: label.h -code.o: level.h -code.o: mes.h -code.o: noRoption.h -code.o: nobitfield.h -code.o: nocross.h -code.o: nofloat.h -code.o: nopp.h -code.o: sizes.h -code.o: spec_arith.h -code.o: specials.h -code.o: stack.h -code.o: stmt.h -code.o: target_sizes.h -code.o: type.h -code.o: use_tmp.h -dumpidf.o: Lpars.h -dumpidf.o: arith.h -dumpidf.o: debug.h -dumpidf.o: def.h -dumpidf.o: expr.h -dumpidf.o: field.h -dumpidf.o: idf.h -dumpidf.o: label.h -dumpidf.o: nobitfield.h -dumpidf.o: nofloat.h -dumpidf.o: nopp.h -dumpidf.o: spec_arith.h -dumpidf.o: stack.h -dumpidf.o: static.h -dumpidf.o: struct.h -dumpidf.o: type.h -error.o: LLlex.h -error.o: arith.h -error.o: debug.h -error.o: errout.h -error.o: expr.h -error.o: file_info.h -error.o: label.h -error.o: nofloat.h -error.o: nopp.h -error.o: spec_arith.h -error.o: tokenname.h -error.o: use_tmp.h -field.o: Lpars.h -field.o: arith.h -field.o: assert.h -field.o: code.h -field.o: debug.h -field.o: expr.h -field.o: field.h -field.o: idf.h -field.o: label.h -field.o: nobitfield.h -field.o: nocross.h -field.o: nofloat.h -field.o: nopp.h -field.o: sizes.h -field.o: spec_arith.h -field.o: target_sizes.h -field.o: type.h -tokenname.o: LLlex.h -tokenname.o: Lpars.h -tokenname.o: arith.h -tokenname.o: file_info.h -tokenname.o: idf.h -tokenname.o: nofloat.h -tokenname.o: nopp.h -tokenname.o: spec_arith.h -tokenname.o: tokenname.h -LLlex.o: LLlex.h -LLlex.o: Lpars.h -LLlex.o: arith.h -LLlex.o: assert.h -LLlex.o: class.h -LLlex.o: debug.h -LLlex.o: def.h -LLlex.o: file_info.h -LLlex.o: idf.h -LLlex.o: idfsize.h -LLlex.o: input.h -LLlex.o: nocross.h -LLlex.o: nofloat.h -LLlex.o: nopp.h -LLlex.o: numsize.h -LLlex.o: sizes.h -LLlex.o: spec_arith.h -LLlex.o: strsize.h -LLlex.o: target_sizes.h -LLmessage.o: LLlex.h -LLmessage.o: Lpars.h -LLmessage.o: arith.h -LLmessage.o: file_info.h -LLmessage.o: idf.h -LLmessage.o: nofloat.h -LLmessage.o: nopp.h -LLmessage.o: spec_arith.h -input.o: file_info.h -input.o: input.h -input.o: inputtype.h -input.o: nopp.h -domacro.o: LLlex.h -domacro.o: Lpars.h -domacro.o: arith.h -domacro.o: assert.h -domacro.o: botch_free.h -domacro.o: class.h -domacro.o: debug.h -domacro.o: file_info.h -domacro.o: idf.h -domacro.o: idfsize.h -domacro.o: ifdepth.h -domacro.o: input.h -domacro.o: interface.h -domacro.o: macro.h -domacro.o: nofloat.h -domacro.o: nopp.h -domacro.o: nparams.h -domacro.o: parbufsize.h -domacro.o: spec_arith.h -domacro.o: textsize.h -replace.o: LLlex.h -replace.o: arith.h -replace.o: assert.h -replace.o: class.h -replace.o: debug.h -replace.o: file_info.h -replace.o: idf.h -replace.o: input.h -replace.o: interface.h -replace.o: macro.h -replace.o: nofloat.h -replace.o: nopp.h -replace.o: pathlength.h -replace.o: spec_arith.h -replace.o: static.h -replace.o: strsize.h -init.o: class.h -init.o: idf.h -init.o: interface.h -init.o: macro.h -init.o: nopp.h -options.o: align.h -options.o: arith.h -options.o: botch_free.h -options.o: class.h -options.o: dataflow.h -options.o: idf.h -options.o: idfsize.h -options.o: macro.h -options.o: maxincl.h -options.o: noRoption.h -options.o: nobitfield.h -options.o: nocross.h -options.o: nofloat.h -options.o: nopp.h -options.o: sizes.h -options.o: spec_arith.h -options.o: target_sizes.h -options.o: use_tmp.h -scan.o: class.h -scan.o: idf.h -scan.o: input.h -scan.o: interface.h -scan.o: lapbuf.h -scan.o: macro.h -scan.o: nopp.h -scan.o: nparams.h -skip.o: LLlex.h -skip.o: arith.h -skip.o: class.h -skip.o: file_info.h -skip.o: input.h -skip.o: interface.h -skip.o: nofloat.h -skip.o: nopp.h -skip.o: spec_arith.h -stack.o: Lpars.h -stack.o: arith.h -stack.o: botch_free.h -stack.o: debug.h -stack.o: def.h -stack.o: idf.h -stack.o: level.h -stack.o: mes.h -stack.o: noRoption.h -stack.o: nobitfield.h -stack.o: nofloat.h -stack.o: nopp.h -stack.o: spec_arith.h -stack.o: stack.h -stack.o: struct.h -stack.o: type.h -type.o: Lpars.h -type.o: align.h -type.o: arith.h -type.o: botch_free.h -type.o: def.h -type.o: idf.h -type.o: nobitfield.h -type.o: nocross.h -type.o: nofloat.h -type.o: nopp.h -type.o: sizes.h -type.o: spec_arith.h -type.o: target_sizes.h -type.o: type.h -ch7mon.o: Lpars.h -ch7mon.o: arith.h -ch7mon.o: botch_free.h -ch7mon.o: def.h -ch7mon.o: expr.h -ch7mon.o: idf.h -ch7mon.o: label.h -ch7mon.o: nobitfield.h -ch7mon.o: nofloat.h -ch7mon.o: nopp.h -ch7mon.o: spec_arith.h -ch7mon.o: type.h -label.o: Lpars.h -label.o: arith.h -label.o: def.h -label.o: idf.h -label.o: label.h -label.o: level.h -label.o: noRoption.h -label.o: nobitfield.h -label.o: nofloat.h -label.o: nopp.h -label.o: spec_arith.h -label.o: type.h -eval.o: Lpars.h -eval.o: align.h -eval.o: arith.h -eval.o: assert.h -eval.o: atw.h -eval.o: code.h -eval.o: dataflow.h -eval.o: debug.h -eval.o: def.h -eval.o: expr.h -eval.o: idf.h -eval.o: label.h -eval.o: level.h -eval.o: mes.h -eval.o: nobitfield.h -eval.o: nocross.h -eval.o: nofloat.h -eval.o: nopp.h -eval.o: sizes.h -eval.o: spec_arith.h -eval.o: stack.h -eval.o: target_sizes.h -eval.o: type.h -switch.o: Lpars.h -switch.o: arith.h -switch.o: assert.h -switch.o: botch_free.h -switch.o: code.h -switch.o: debug.h -switch.o: density.h -switch.o: expr.h -switch.o: idf.h -switch.o: label.h -switch.o: noRoption.h -switch.o: nobitfield.h -switch.o: nofloat.h -switch.o: nopp.h -switch.o: spec_arith.h -switch.o: switch.h -switch.o: type.h -conversion.o: Lpars.h -conversion.o: arith.h -conversion.o: nobitfield.h -conversion.o: nocross.h -conversion.o: nofloat.h -conversion.o: sizes.h -conversion.o: spec_arith.h -conversion.o: target_sizes.h -conversion.o: type.h -blocks.o: align.h -blocks.o: arith.h -blocks.o: atw.h -blocks.o: label.h -blocks.o: nocross.h -blocks.o: nofloat.h -blocks.o: sizes.h -blocks.o: spec_arith.h -blocks.o: stack.h -blocks.o: target_sizes.h -dataflow.o: dataflow.h -tokenfile.o: Lpars.h -declar.o: LLlex.h -declar.o: Lpars.h -declar.o: arith.h -declar.o: debug.h -declar.o: declar.h -declar.o: decspecs.h -declar.o: def.h -declar.o: expr.h -declar.o: field.h -declar.o: file_info.h -declar.o: idf.h -declar.o: label.h -declar.o: level.h -declar.o: nobitfield.h -declar.o: nocross.h -declar.o: nofloat.h -declar.o: nopp.h -declar.o: sizes.h -declar.o: spec_arith.h -declar.o: struct.h -declar.o: target_sizes.h -declar.o: type.h -statement.o: LLlex.h -statement.o: Lpars.h -statement.o: arith.h -statement.o: botch_free.h -statement.o: code.h -statement.o: debug.h -statement.o: def.h -statement.o: expr.h -statement.o: file_info.h -statement.o: idf.h -statement.o: label.h -statement.o: nobitfield.h -statement.o: nofloat.h -statement.o: nopp.h -statement.o: spec_arith.h -statement.o: stack.h -statement.o: type.h -expression.o: LLlex.h -expression.o: Lpars.h -expression.o: arith.h -expression.o: expr.h -expression.o: file_info.h -expression.o: idf.h -expression.o: label.h -expression.o: noRoption.h -expression.o: nobitfield.h -expression.o: nofloat.h -expression.o: nopp.h -expression.o: spec_arith.h -expression.o: type.h -program.o: LLlex.h -program.o: Lpars.h -program.o: arith.h -program.o: code.h -program.o: declar.h -program.o: decspecs.h -program.o: def.h -program.o: expr.h -program.o: file_info.h -program.o: idf.h -program.o: label.h -program.o: nobitfield.h -program.o: nofloat.h -program.o: nopp.h -program.o: spec_arith.h -program.o: type.h -Lpars.o: Lpars.h -ival.o: LLlex.h -ival.o: Lpars.h -ival.o: align.h -ival.o: arith.h -ival.o: assert.h -ival.o: class.h -ival.o: debug.h -ival.o: def.h -ival.o: estack.h -ival.o: expr.h -ival.o: field.h -ival.o: file_info.h -ival.o: idf.h -ival.o: label.h -ival.o: level.h -ival.o: noRoption.h -ival.o: nobitfield.h -ival.o: nocross.h -ival.o: nofloat.h -ival.o: nopp.h -ival.o: sizes.h -ival.o: spec_arith.h -ival.o: struct.h -ival.o: target_sizes.h -ival.o: type.h -char.o: class.h -symbol2str.o: Lpars.h diff --git a/lang/cem/cemcom/Parameters b/lang/cem/cemcom/Parameters deleted file mode 100644 index 4b4c7af24..000000000 --- a/lang/cem/cemcom/Parameters +++ /dev/null @@ -1,135 +0,0 @@ -!File: pathlength.h -#define PATHLENGTH 1024 /* max. length of path to file */ - - -!File: errout.h -#define ERROUT STDERR /* file pointer for writing messages */ -#define MAXERR_LINE 5 /* maximum number of error messages given - on the same input line. */ - - -!File: idfsize.h -#define IDFSIZE 64 /* maximum significant length of an identifier */ - - -!File: numsize.h -#define NUMSIZE 256 /* maximum length of a numeric constant */ - - -!File: nparams.h -#define NPARAMS 32 /* maximum number of parameters of macros */ - - -!File: ifdepth.h -#define IFDEPTH 256 /* maximum number of nested if-constructions */ - - -!File: maxincl.h -#define MAXINCL 12 /* maximum number of #include directories */ - - -!File: density.h -#define DENSITY 2 /* see switch.[ch] for an explanation */ - - -!File: lapbuf.h -#define LAPBUF 4096 /* size of macro actual parameter buffer */ - - -!File: strsize.h -#define ISTRSIZE 32 /* minimum number of bytes allocated for - storing a string */ -#define RSTRSIZE 8 /* step size in enlarging the memory for - the storage of a string */ - - -!File: target_sizes.h -#define MAXSIZE 8 /* the maximum of the SZ_* constants */ - -/* target machine sizes */ -#define SZ_CHAR (arith)1 -#define SZ_SHORT (arith)2 -#define SZ_WORD (arith)4 -#define SZ_INT (arith)4 -#define SZ_LONG (arith)4 -#ifndef NOFLOAT -#define SZ_FLOAT (arith)4 -#define SZ_DOUBLE (arith)8 -#endif NOFLOAT -#define SZ_POINTER (arith)4 - -/* target machine alignment requirements */ -#define AL_CHAR 1 -#define AL_SHORT SZ_SHORT -#define AL_WORD SZ_WORD -#define AL_INT SZ_WORD -#define AL_LONG SZ_WORD -#ifndef NOFLOAT -#define AL_FLOAT SZ_WORD -#define AL_DOUBLE SZ_WORD -#endif NOFLOAT -#define AL_POINTER SZ_WORD -#define AL_STRUCT 1 -#define AL_UNION 1 - - -!File: botch_free.h -#undef BOTCH_FREE 1 /* when defined, botch freed memory, as a check */ - - -!File: dataflow.h -#define DATAFLOW 1 /* produce some compile-time xref */ - - -!File: debug.h -#undef DEBUG 1 /* perform various self-tests */ - - -!File: use_tmp.h -#define USE_TMP 1 /* collect exa, exp, ina and inp commands - and let them precede the rest of - the generated compact code */ - - -!File: parbufsize.h -#define PARBUFSIZE 1024 - - -!File: textsize.h -#define ITEXTSIZE 8 /* 1st piece of memory for repl. text */ -#define RTEXTSIZE 8 /* stepsize for enlarging repl.text */ - - -!File: inputtype.h -#undef INP_READ_IN_ONE 1 /* read input file in one */ - - -!File: nopp.h -#undef NOPP 1 /* if NOT defined, use built-int preprocessor */ - - -!File: nobitfield.h -#undef NOBITFIELD 1 /* if NOT defined, implement bitfields */ - - -!File: spec_arith.h -/* describes internal compiler arithmetics */ -#undef SPECIAL_ARITHMETICS /* something different from native long */ - - -!File: static.h -#define GSTATIC /* for large global "static" arrays */ - - -!File: nofloat.h -#undef NOFLOAT 1 /* if NOT defined, floats are implemented */ - - -!File: noRoption.h -#undef NOROPTION 1 /* if NOT defined, R option is implemented */ - - -!File: nocross.h -#undef NOCROSS 1 /* if NOT defined, cross compiler */ - - diff --git a/lang/cem/cemcom/alloc.c b/lang/cem/cemcom/alloc.c deleted file mode 100644 index cb431a4b5..000000000 --- a/lang/cem/cemcom/alloc.c +++ /dev/null @@ -1,159 +0,0 @@ -/* $Header$ */ -/* M E M O R Y A L L O C A T I O N R O U T I N E S */ - -/* The allocation of memory in this program, which plays an important - role in reading files, replacing macros and building expression - trees, is not performed by malloc etc. The reason for having own - memory allocation routines (malloc(), realloc() and free()) is - plain: the garbage collection performed by the library functions - malloc(), realloc() and free() costs a lot of time, while in most - cases (on a VAX) the freeing and reallocation of memory is not - necessary. The only reallocation done in this program is at - building strings in memory. This means that the last - (re-)allocated piece of memory can be extended. - - The (basic) memory allocating routines offered by this memory - handling package are: - - char *malloc(n) : allocate n bytes - char *realloc(ptr, n) : reallocate buffer to n bytes - (works only if ptr was last allocated) - free(ptr) : if ptr points to last allocated - memory, this memory is re-allocatable - Salloc(str, sz) : save string in malloc storage -*/ - -#include -#include "myalloc.h" /* UF */ -#include "debug.h" /* UF */ - -#include "alloc.h" -#include "assert.h" - -#ifdef OWNALLOC -char *sys_break(); -/* the following variables are used for book-keeping */ -static int nfreebytes = 0; /* # free bytes in sys_break space */ -static char *freeb; /* pointer to first free byte */ -static char *lastalloc; /* pointer to last malloced sp */ -static int lastnbytes; /* nr of bytes in last allocated */ - /* space */ -static char *firstfreeb = 0; - -#endif OWNALLOC - -char * -Salloc(str, sz) - register char str[]; - register int sz; -{ - /* Salloc() is not a primitive function: it just allocates a - piece of storage and copies a given string into it. - */ - char *res = Malloc(sz); - register char *m = res; - - while (sz--) - *m++ = *str++; - return res; -} - -#ifdef OWNALLOC - -#define ALIGN(m) (ALIGNSIZE * (((m) - 1) / ALIGNSIZE + 1)) - -char * -malloc(n) - unsigned n; -{ - /* malloc() is a very simple malloc(). - */ - n = ALIGN(n); - if (nfreebytes < n) { - register nbts = (n <= ALLOCSIZ) ? ALLOCSIZ : n; - - if (!nfreebytes) { - if ((freeb = sys_break(nbts)) == ILL_BREAK) - fatal("out of memory"); - } - else { - if (sys_break(nbts) == ILL_BREAK) - fatal("out of memory"); - } - nfreebytes += nbts; - } - lastalloc = freeb; - freeb = lastalloc + n; - lastnbytes = n; - nfreebytes -= n; - return lastalloc; -} - -/*ARGSUSED*/ -char * -realloc(ptr, n) - char *ptr; - unsigned n; -{ - /* realloc() is designed to append more bytes to the latest - allocated piece of memory. However reallocation should be - performed, even if the mentioned memory is not the latest - allocated one, this situation will not occur. To do so, - realloc should know how many bytes are allocated the last - time for that piece of memory. ???? - */ - register int nbytes = n; - - ASSERT(ptr == lastalloc); /* security */ - nbytes -= lastnbytes; /* # bytes required */ - if (nbytes == 0) /* no extra bytes */ - return lastalloc; - - /* if nbytes < 0: free last allocated bytes; - if nbytes > 0: allocate more bytes - */ - if (nbytes > 0) - nbytes = ALIGN(nbytes); - if (nfreebytes < nbytes) { - register int nbts = (nbytes < ALLOCSIZ) ? ALLOCSIZ : nbytes; - if (sys_break(nbts) == ILL_BREAK) - fatal("out of memory"); - nfreebytes += nbts; - } - freeb += nbytes; /* less bytes */ - lastnbytes += nbytes; /* change nr of last all. bytes */ - nfreebytes -= nbytes; /* less or more free bytes */ - return lastalloc; -} - -/* to ensure that the alloc library package will not be loaded: */ -/*ARGSUSED*/ -free(p) - char *p; -{} - -init_mem() -{ - firstfreeb = sys_break(0); - /* align the first memory unit to ALIGNSIZE ??? */ - if ((long) firstfreeb % ALIGNSIZE != 0) { - register char *fb = firstfreeb; - - fb = (char *)ALIGN((long)fb); - firstfreeb = sys_break(fb - firstfreeb); - firstfreeb = fb; - ASSERT((long)firstfreeb % ALIGNSIZE == 0); - } -} - -#ifdef DEBUG -mem_stat() -{ - extern char options[]; - - if (options['m']) - print("Total nr of bytes allocated: %d\n", - sys_break(0) - firstfreeb); -} -#endif DEBUG -#endif OWNALLOC diff --git a/lang/cem/cemcom/alloc.h b/lang/cem/cemcom/alloc.h deleted file mode 100644 index a6bafae42..000000000 --- a/lang/cem/cemcom/alloc.h +++ /dev/null @@ -1,16 +0,0 @@ -/* $Header$ */ -/* PROGRAM'S INTERFACE TO MEMORY ALLOCATION ROUTINES */ - -/* This file serves as the interface between the program and the - memory allocating routines. - There are 3 memory allocation routines: - char *Malloc(n) to allocate n bytes - char *Salloc(str, n) to allocate n bytes - and fill them with string str - char *Realloc(str, n) reallocate the string at str to n bytes -*/ - -extern char *Salloc(), *malloc(), *realloc(); - -#define Malloc(n) malloc((unsigned)(n)) -#define Srealloc(ptr,n) realloc(ptr, (unsigned)(n)) diff --git a/lang/cem/cemcom/code.h b/lang/cem/cemcom/code.h deleted file mode 100644 index 3399b3e02..000000000 --- a/lang/cem/cemcom/code.h +++ /dev/null @@ -1,23 +0,0 @@ -/* $Header$ */ -/* C O D E - G E N E R A T O R D E F I N I T I O N S */ - -struct stat_block { - struct stat_block *next; - label st_break; - label st_continue; -}; - - -/* allocation definitions of struct stat_block */ -/* ALLOCDEF "stat_block" */ -extern char *st_alloc(); -extern struct stat_block *h_stat_block; -#define new_stat_block() ((struct stat_block *) \ - st_alloc((char **)&h_stat_block, sizeof(struct stat_block))) -#define free_stat_block(p) st_free(p, h_stat_block, sizeof(struct stat_block)) - - -#define LVAL 0 -#define RVAL 1 -#define FALSE 0 -#define TRUE 1 diff --git a/lang/cem/cemcom/declarator.h b/lang/cem/cemcom/declarator.h deleted file mode 100644 index 5ecbb70c2..000000000 --- a/lang/cem/cemcom/declarator.h +++ /dev/null @@ -1,45 +0,0 @@ -/* $Header$ */ -/* DEFINITION OF DECLARATOR DESCRIPTORS */ - -/* A 'declarator' consists of an idf and a linked list of - language-defined unary operations: *, [] and (), called - decl_unary's. -*/ - -struct declarator { - struct declarator *next; - struct idf *dc_idf; - struct decl_unary *dc_decl_unary; - struct idstack_item *dc_fparams; /* params for function */ -}; - - -/* allocation definitions of struct declarator */ -/* ALLOCDEF "declarator" */ -extern char *st_alloc(); -extern struct declarator *h_declarator; -#define new_declarator() ((struct declarator *) \ - st_alloc((char **)&h_declarator, sizeof(struct declarator))) -#define free_declarator(p) st_free(p, h_declarator, sizeof(struct declarator)) - - -#define NO_PARAMS ((struct idstack_item *) 0) - -struct decl_unary { - struct decl_unary *next; - int du_fund; /* POINTER, ARRAY or FUNCTION */ - arith du_count; /* for ARRAYs only */ -}; - - -/* allocation definitions of struct decl_unary */ -/* ALLOCDEF "decl_unary" */ -extern char *st_alloc(); -extern struct decl_unary *h_decl_unary; -#define new_decl_unary() ((struct decl_unary *) \ - st_alloc((char **)&h_decl_unary, sizeof(struct decl_unary))) -#define free_decl_unary(p) st_free(p, h_decl_unary, sizeof(struct decl_unary)) - - -extern struct type *declare_type(); -extern struct declarator null_declarator; diff --git a/lang/cem/cemcom/decspecs.h b/lang/cem/cemcom/decspecs.h deleted file mode 100644 index 0b1598c0e..000000000 --- a/lang/cem/cemcom/decspecs.h +++ /dev/null @@ -1,23 +0,0 @@ -/* $Header$ */ -/* DECLARATION SPECIFIER DEFINITION */ - -struct decspecs { - struct decspecs *next; - struct type *ds_type; /* single type */ - int ds_sc_given; /* 1 if the st. class is explicitly given */ - int ds_sc; /* storage class, given or implied */ - int ds_size; /* LONG, SHORT or 0 */ - int ds_unsigned; /* 0 or 1 */ -}; - - -/* allocation definitions of struct decspecs */ -/* ALLOCDEF "decspecs" */ -extern char *st_alloc(); -extern struct decspecs *h_decspecs; -#define new_decspecs() ((struct decspecs *) \ - st_alloc((char **)&h_decspecs, sizeof(struct decspecs))) -#define free_decspecs(p) st_free(p, h_decspecs, sizeof(struct decspecs)) - - -extern struct decspecs null_decspecs; diff --git a/lang/cem/cemcom/def.h b/lang/cem/cemcom/def.h deleted file mode 100644 index abb281559..000000000 --- a/lang/cem/cemcom/def.h +++ /dev/null @@ -1,37 +0,0 @@ -/* $Header$ */ -/* IDENTIFIER DEFINITION DESCRIPTOR */ - -struct def { /* for ordinary tags */ - struct def *next; - int df_level; - struct type *df_type; - int df_sc; /* may be: - GLOBAL, STATIC, EXTERN, IMPLICIT, - TYPEDEF, - FORMAL, AUTO, - ENUM, LABEL - */ - int df_register; /* REG_NONE, REG_DEFAULT or REG_BONUS */ - char df_initialized; /* an initialization has been generated */ - char df_alloc; /* 0, ALLOC_SEEN or ALLOC_DONE */ - char df_used; /* set if idf is used */ - char df_formal_array; /* to warn if sizeof is taken */ - arith df_address; -}; - -#define ALLOC_SEEN 1 /* an allocating declaration has been seen */ -#define ALLOC_DONE 2 /* the allocating declaration has been done */ - -#define REG_NONE 0 /* no register candidate */ -#define REG_DEFAULT 1 /* register candidate, not declared as such */ -#define REG_BONUS 10 /* register candidate, declared as such */ - - -/* allocation definitions of struct def */ -/* ALLOCDEF "def" */ -extern char *st_alloc(); -extern struct def *h_def; -#define new_def() ((struct def *) \ - st_alloc((char **)&h_def, sizeof(struct def))) -#define free_def(p) st_free(p, h_def, sizeof(struct def)) - diff --git a/lang/cem/cemcom/doprnt.c b/lang/cem/cemcom/doprnt.c deleted file mode 100644 index 9cdc126fe..000000000 --- a/lang/cem/cemcom/doprnt.c +++ /dev/null @@ -1,144 +0,0 @@ -/* $Header$ */ -/* STRING MANIPULATION AND PRINT ROUTINES */ - -#include -#include "ssize.h" - -char *long2str(); - -static -integral(c) -{ - switch (c) { - case 'b': - return -2; - case 'd': - return 10; - case 'o': - return -8; - case 'u': - return -10; - case 'x': - return -16; - } - return 0; -} - -static int -format(buf, fmt, argp) - char *buf, *fmt; - char *argp; -{ - register char *pf = fmt, *pa = argp; - register char *pb = buf; - - while (*pf) { - if (*pf == '%') { - register width, base, pad, npad; - char *arg; - char cbuf[2]; - char *badformat = ""; - - /* get padder */ - if (*++pf == '0') { - pad = '0'; - ++pf; - } - else - pad = ' '; - - /* get width */ - width = 0; - while (*pf >= '0' && *pf <= '9') - width = 10 * width + *pf++ - '0'; - - /* get text and move pa */ - if (*pf == 's') { - arg = *(char **)pa; - pa += sizeof(char *); - } - else - if (*pf == 'c') { - cbuf[0] = * (char *) pa; - cbuf[1] = '\0'; - pa += sizeof(int); - arg = &cbuf[0]; - } - else - if (*pf == 'l') { - /* alignment ??? */ - if (base = integral(*++pf)) { - arg = long2str(*(long *)pa, base); - pa += sizeof(long); - } - else { - pf--; - arg = badformat; - } - } - else - if (base = integral(*pf)) { - arg = long2str((long)*(int *)pa, base); - pa += sizeof(int); - } - else - if (*pf == '%') - arg = "%"; - else - arg = badformat; - - npad = width - strlen(arg); - - while (npad-- > 0) - *pb++ = pad; - - while (*pb++ = *arg++); - pb--; - pf++; - } - else - *pb++ = *pf++; - } - return pb - buf; -} - -doprnt(fp, fmt, argp) - File *fp; - char *fmt; - int argp[]; -{ - char buf[SSIZE]; - - sys_write(fp, buf, format(buf, fmt, (char *)argp)); -} - -/*VARARGS1*/ -printf(fmt, args) - char *fmt; - char args; -{ - char buf[SSIZE]; - - sys_write(STDOUT, buf, format(buf, fmt, &args)); -} - -/*VARARGS1*/ -fprintf(fp, fmt, args) - File *fp; - char *fmt; - char args; -{ - char buf[SSIZE]; - - sys_write(fp, buf, format(buf, fmt, &args)); -} - -/*VARARGS1*/ -char * -sprintf(buf, fmt, args) - char *buf, *fmt; - char args; -{ - buf[format(buf, fmt, &args)] = '\0'; - return buf; -} diff --git a/lang/cem/cemcom/em.c b/lang/cem/cemcom/em.c deleted file mode 100644 index 7bd0bd10a..000000000 --- a/lang/cem/cemcom/em.c +++ /dev/null @@ -1,201 +0,0 @@ -/* $Header$ */ -/* EM CODE OUTPUT ROUTINES */ - -#define CMODE 0644 -#define MAX_ARG_CNT 32 - -#include "em.h" -#include -#include "arith.h" -#include "label.h" - -/* - putbyte(), C_open() and C_close() are the basic routines for - respectively write on, open and close the output file. - The put_*() functions serve as formatting functions of the - various EM language constructs. - See "Description of a Machine Architecture for use with - Block Structured Languages" par. 11.2 for the meaning of these - names. -*/ - -/* supply a kind of buffered output */ -#define flush(x) sys_write(ofp, &obuf[0], x) - -static char obuf[BUFSIZ]; -static char *opp = &obuf[0]; -File *ofp = 0; - -putbyte(b) /* shouldn't putbyte() be a macro ??? (EB) */ - int b; -{ - if (opp >= &obuf[BUFSIZ]) { /* flush if buffer overflows */ - if (flush(BUFSIZ) == 0) - sys_stop(S_ABORT); - opp = &obuf[0]; - } - *opp++ = (char) b; -} - -C_init(wsize, psize) - arith wsize, psize; -{} - -C_open(nm) /* open file for compact code output */ - char *nm; -{ - if (nm == 0) - ofp = STDOUT; /* standard output */ - else - if (sys_open(nm, OP_WRITE, &ofp) == 0) - return 0; - return 1; -} - -C_close() -{ - if (flush(opp - &obuf[0]) == 0) - sys_stop(S_ABORT); - opp = obuf; /* reset opp */ - if (ofp != STDOUT) - sys_close(ofp); - ofp = 0; -} - -C_busy() -{ - return ofp != 0; /* true if code is being generated */ -} - -/*** the compact code generating routines ***/ -#define fit16i(x) ((x) >= (long)0xFFFF8000 && (x) <= (long)0x00007FFF) -#define fit8u(x) ((x) <= 0xFF) /* x is already unsigned */ - -put_ilb(l) - label l; -{ - if (fit8u(l)) { - put8(sp_ilb1); - put8((int)l); - } - else { - put8(sp_ilb2); - put16(l); - } -} - -put_dlb(l) - label l; -{ - if (fit8u(l)) { - put8(sp_dlb1); - put8((int)l); - } - else { - put8(sp_dlb2); - put16(l); - } -} - -put_cst(l) - arith l; -{ - if (l >= (arith) -sp_zcst0 && l < (arith) (sp_ncst0 - sp_zcst0)) { - /* we can convert 'l' to an int because its value - can be stored in a byte. - */ - put8((int) l + (sp_zcst0 + sp_fcst0)); - } - else - if (fit16i(l)) { /* the cast from long to int causes no trouble here */ - put8(sp_cst2); - put16((int) l); - } - else { - put8(sp_cst4); - put32(l); - } -} - -put_doff(l, v) - label l; - arith v; -{ - if (v == 0) - put_dlb(l); - else { - put8(sp_doff); - put_dlb(l); - put_cst(v); - } -} - -put_noff(s, v) - char *s; - arith v; -{ - if (v == 0) - put_dnam(s); - else { - put8(sp_doff); - put_dnam(s); - put_cst(v); - } -} - -put_dnam(s) - char *s; -{ - put8(sp_dnam); - put_str(s); -} - -put_pnam(s) - char *s; -{ - put8(sp_pnam); - put_str(s); -} - -#ifdef ____ -put_fcon(s, sz) - char *s; - arith sz; -{ - put8(sp_fcon); - put_cst(sz); - put_str(s); -} -#endif ____ - -put_wcon(sp, v, sz) /* sp_icon, sp_ucon or sp_fcon with int repr */ - int sp; - char *v; - arith sz; -{ - /* how 'bout signextension int --> long ??? */ - put8(sp); - put_cst(sz); - put_str(v); -} - -put_str(s) - char *s; -{ - register int len; - - put_cst((arith) (len = strlen(s))); - while (--len >= 0) - put8(*s++); -} - -put_cstr(s) - char *s; -{ - register int len = prepare_string(s); - - put8(sp_scon); - put_cst((arith) len); - while (--len >= 0) - put8(*s++); -} diff --git a/lang/cem/cemcom/em.h b/lang/cem/cemcom/em.h deleted file mode 100644 index 7d9de7899..000000000 --- a/lang/cem/cemcom/em.h +++ /dev/null @@ -1,42 +0,0 @@ -/* $Header$ */ -/* DESCRIPTION OF INTERFACE TO EM CODE GENERATING ROUTINES */ - -#include "proc_intf.h" /* use macros or functions */ - -/* include the EM description files */ -#include -#include -#include -#include -#include - -/* macros used in the definitions of the interface functions C_* */ -#define OP(x) put_op(x) -#define CST(x) put_cst(x) -#define DCST(x) put_cst(x) -#define CSTR(x) put_cstr(x) -#define PS(x) put_ps(x) -#define DLB(x) put_dlb(x) -#define ILB(x) put_ilb(x) -#define NOFF(x,y) put_noff((x), (y)) -#define DOFF(x,y) put_doff((x), (y)) -#define PNAM(x) put_pnam(x) -#define DNAM(x) put_dnam(x) -#define CEND() put_cend() -#define WCON(x,y,z) put_wcon((x), (y), (z)) -#define FCON(x,y) put_fcon((x), (y)) - -/* variants of primitive "putbyte" */ -#define put8(x) putbyte(x) /* defined in "em.c" */ -#define put16(x) (put8((int) x), put8((int) (x >> 8))) -#define put32(x) (put16((int) x), put16((int) (x >> 16))) -#define put_cend() put8(sp_cend) -#define put_op(x) put8(x) -#define put_ps(x) put8(x) - -/* user interface */ -#define C_magic() put16(sp_magic) /* EM magic word */ - -#ifndef PROC_INTF -#include "writeem.h" -#endif PROC_INTF diff --git a/lang/cem/cemcom/emcode.def b/lang/cem/cemcom/emcode.def deleted file mode 100644 index 0e27dcc5f..000000000 --- a/lang/cem/cemcom/emcode.def +++ /dev/null @@ -1,136 +0,0 @@ -% emcode definitions for the CEM compiler -- intermediate code -C_adf(p) | arith p; | OP(op_adf), CST(p) -C_adi(p) | arith p; | OP(op_adi), CST(p) -C_adp(p) | arith p; | OP(op_adp), CST(p) -C_ads(p) | arith p; | OP(op_ads), CST(p) -C_adu(p) | arith p; | OP(op_adu), CST(p) -C_and(p) | arith p; | OP(op_and), CST(p) -C_asp(p) | arith p; | OP(op_asp), CST(p) -C_bra(l) | label l; | OP(op_bra), CST((arith)l) -C_cai() | | OP(op_cai) -C_cal(p) | char *p; | OP(op_cal), PNAM(p) -C_cff() | | OP(op_cff) -C_cfi() | | OP(op_cfi) -C_cfu() | | OP(op_cfu) -C_cif() | | OP(op_cif) -C_cii() | | OP(op_cii) -C_ciu() | | OP(op_ciu) -C_cmf(p) | arith p; | OP(op_cmf), CST(p) -C_cmi(p) | arith p; | OP(op_cmi), CST(p) -C_cmp() | | OP(op_cmp) -C_cmu(p) | arith p; | OP(op_cmu), CST(p) -C_com(p) | arith p; | OP(op_com), CST(p) -C_csa(p) | arith p; | OP(op_csa), CST(p) -C_csb(p) | arith p; | OP(op_csb), CST(p) -C_cuf() | | OP(op_cuf) -C_cui() | | OP(op_cui) -C_cuu() | | OP(op_cuu) -C_dup(p) | arith p; | OP(op_dup), CST(p) -C_dvf(p) | arith p; | OP(op_dvf), CST(p) -C_dvi(p) | arith p; | OP(op_dvi), CST(p) -C_dvu(p) | arith p; | OP(op_dvu), CST(p) -C_fil_dlb(l, o) | label l; arith o; | OP(op_fil), DOFF(l, o) -C_ior(p) | arith p; | OP(op_ior), CST(p) -C_lae_dnam(p, o) | char *p; arith o; | OP(op_lae), NOFF(p, o) -C_lae_dlb(l, o) | label l; arith o; | OP(op_lae), DOFF(l, o) -C_lal(p) | arith p; | OP(op_lal), CST(p) -C_ldc(p) | arith p; | OP(op_ldc), DCST(p) -C_lde_dnam(p, o) | char *p; arith o; | OP(op_lde), NOFF(p, o) -C_lde_dlb(l, o) | label l; arith o; | OP(op_lde), DOFF(l, o) -C_ldl(p) | arith p; | OP(op_ldl), CST(p) -C_lfr(p) | arith p; | OP(op_lfr), CST(p) -C_lin(p) | arith p; | OP(op_lin), CST(p) -C_loc(p) | arith p; | OP(op_loc), CST(p) -C_loe_dnam(p, o) | char *p; arith o; | OP(op_loe), NOFF(p, o) -C_loe_dlb(l, o) | label l; arith o; | OP(op_loe), DOFF(l, o) -C_loi(p) | arith p; | OP(op_loi), CST(p) -C_lol(p) | arith p; | OP(op_lol), CST(p) -C_lor(p) | arith p; | OP(op_lor), CST(p) -C_lpi(p) | char *p; | OP(op_lpi), PNAM(p) -C_mlf(p) | arith p; | OP(op_mlf), CST(p) -C_mli(p) | arith p; | OP(op_mli), CST(p) -C_mlu(p) | arith p; | OP(op_mlu), CST(p) -C_ngf(p) | arith p; | OP(op_ngf), CST(p) -C_ngi(p) | arith p; | OP(op_ngi), CST(p) -C_ret(p) | arith p; | OP(op_ret), CST(p) -C_rmi(p) | arith p; | OP(op_rmi), CST(p) -C_rmu(p) | arith p; | OP(op_rmu), CST(p) -C_sbf(p) | arith p; | OP(op_sbf), CST(p) -C_sbi(p) | arith p; | OP(op_sbi), CST(p) -C_sbs(p) | arith p; | OP(op_sbs), CST(p) -C_sbu(p) | arith p; | OP(op_sbu), CST(p) -C_sde_dnam(p, o) | char *p; arith o; | OP(op_sde), NOFF(p, o) -C_sde_dlb(l, o) | label l; arith o; | OP(op_sde), DOFF(l, o) -C_sdl(p) | arith p; | OP(op_sdl), CST(p) -C_sli(p) | arith p; | OP(op_sli), CST(p) -C_slu(p) | arith p; | OP(op_slu), CST(p) -C_sri(p) | arith p; | OP(op_sri), CST(p) -C_sru(p) | arith p; | OP(op_sru), CST(p) -C_ste_dnam(p, o) | char *p; arith o; | OP(op_ste), NOFF(p, o) -C_ste_dlb(l, o) | label l; arith o; | OP(op_ste), DOFF(l, o) -C_sti(p) | arith p; | OP(op_sti), CST(p) -C_stl(p) | arith p; | OP(op_stl), CST(p) -C_xor(p) | arith p; | OP(op_xor), CST(p) -C_zeq(l) | label l; | OP(op_zeq), CST((arith)l) -C_zge(l) | label l; | OP(op_zge), CST((arith)l) -C_zgt(l) | label l; | OP(op_zgt), CST((arith)l) -C_zle(l) | label l; | OP(op_zle), CST((arith)l) -C_zlt(l) | label l; | OP(op_zlt), CST((arith)l) -C_zne(l) | label l; | OP(op_zne), CST((arith)l) -% -C_df_dlb(l) | label l; | DLB(l) -C_df_dnam(s) | char *s; | DNAM(s) -C_df_ilb(l) | label l; | ILB(l) -% -C_bss_cst(n, w, i) | arith n, w; int i; | - PS(ps_bss), DCST(n), CST(w), CST((arith)i) -% -C_con_icon(val, siz) | char *val; arith siz; | - PS(ps_con), WCON(sp_icon, val, siz), CEND() -C_con_ucon(val, siz) | char *val; arith siz; | - PS(ps_con), WCON(sp_ucon, val, siz), CEND() -C_con_fcon(val, siz) | char *val; arith siz; | - PS(ps_con), WCON(sp_fcon, val, siz), CEND() -C_con_scon(str, siz) | char *str; arith siz; | PS(ps_con), CSTR(str), CEND() -C_con_dnam(str, val) | char *str; arith val; | - PS(ps_con), NOFF(str, val), CEND() -C_con_dlb(l, val) | label l; arith val; | - PS(ps_con), DOFF(l, val), CEND() -C_con_pnam(str) | char *str; | PS(ps_con), PNAM(str), CEND() -% -C_rom_cst(l) | arith l; | PS(ps_rom), CST(l), CEND() -C_rom_icon(val, siz) | char *val; arith siz; | - PS(ps_rom), WCON(sp_icon, val, siz), CEND() -C_rom_fcon(val, siz) | char *val; arith siz; | - PS(ps_rom), WCON(sp_fcon, val, siz), CEND() -C_rom_ilb(l) | label l; | PS(ps_rom), ILB(l), CEND() -% -C_cst(l) | arith l; | CST(l) -C_icon(val, siz) | char *val; arith siz; | WCON(sp_icon, val, siz) -C_ucon(val, siz) | char *val; arith siz; | WCON(sp_ucon, val, siz) -C_fcon(val, siz) | char *val; arith siz; | WCON(sp_fcon, val, siz) -C_scon(str, siz) | char *str; arith siz; | CSTR(str) -C_dnam(str, val) | char *str; arith val; | NOFF(str, val) -C_dlb(l, val) | label l; arith val; | DOFF(l, val) -C_pnam(str) | char *str; | PNAM(str) -C_ilb(l) | label l; | ILB(l) -% -C_pro_narg(p1) | char *p1; | PS(ps_pro), PNAM(p1), CEND() -C_end(l) | arith l; | PS(ps_end), CST(l) -% -C_exa(s) | char *s; | PS(ps_exa), DNAM(s) -C_exp(s) | char *s; | PS(ps_exp), PNAM(s) -C_ina_pt(l) | label l; | PS(ps_ina), DLB(l) -C_ina(s) | char *s; | PS(ps_ina), DNAM(s) -C_inp(s) | char *s; | PS(ps_inp), PNAM(s) -% -C_ms_err() | | PS(ps_mes), CST((arith)ms_err), CEND() -C_ms_emx(p1, p2) | arith p1, p2; | - PS(ps_mes), CST((arith)ms_emx), CST(p1), CST(p2), CEND() -C_ms_reg(a, b, c, d) | arith a, b; int c, d; | - PS(ps_mes), CST((arith)ms_reg), CST(a), CST(b), CST((arith)c), CST((arith)d), CEND() -C_ms_src(l, s) | arith l; char *s; | - PS(ps_mes), CST((arith)ms_src), CST(l), CSTR(s), CEND() -C_ms_flt() | | PS(ps_mes), CST((arith)ms_flt), CEND() -C_ms_par(l) | arith l; | PS(ps_mes), CST((arith)ms_par), CST(l), CEND() -C_ms_gto() | | PS(ps_mes), CST((arith)ms_gto), CEND() diff --git a/lang/cem/cemcom/expr.h b/lang/cem/cemcom/expr.h deleted file mode 100644 index 46e658a05..000000000 --- a/lang/cem/cemcom/expr.h +++ /dev/null @@ -1,102 +0,0 @@ -/* $Header$ */ -/* EXPRESSION DESCRIPTOR */ - -/* What we want to define is the struct expr, but since it contains - a union of various goodies, we define them first; so be patient. -*/ - -struct value { - struct idf *vl_idf; /* idf of an external name or 0 */ - arith vl_value; /* constant, or offset if idf != 0 */ -}; - -struct string { - char *sg_value; /* string of characters repr. the constant */ - label sg_datlab; /* global data-label */ -}; - -struct floating { - char *fl_value; /* pointer to string repr. the fp const. */ - label fl_datlab; /* global data_label */ -}; - -struct oper { - struct type *op_type; /* resulting type of the operation */ - struct expr *op_left; - int op_oper; /* the symbol of the operator */ - struct expr *op_right; -}; - -/* The following constants indicate the class of the expression: */ -#define Value 0 /* it is a value known at load time */ -#define String 1 /* it is a string constant */ -#define Float 2 /* it is a floating point constant */ -#define Oper 3 /* it is a run-time expression */ -#define Type 4 /* only its type is relevant */ - -struct expr { - struct expr *next; - char *ex_file; /* the file it (probably) comes from */ - unsigned int ex_line; /* the line it (probably) comes from */ - struct type *ex_type; - char ex_lvalue; - char ex_flags; - int ex_class; - int ex_depth; - union { - struct value ex_value; - struct string ex_string; - struct floating ex_float; - struct oper ex_oper; - } ex_object; -}; - -/* some abbreviated selections */ -#define VL_VALUE ex_object.ex_value.vl_value -#define VL_IDF ex_object.ex_value.vl_idf -#define SG_VALUE ex_object.ex_string.sg_value -#define SG_DATLAB ex_object.ex_string.sg_datlab -#define FL_VALUE ex_object.ex_float.fl_value -#define FL_DATLAB ex_object.ex_float.fl_datlab -#define OP_TYPE ex_object.ex_oper.op_type -#define OP_LEFT ex_object.ex_oper.op_left -#define OP_OPER ex_object.ex_oper.op_oper -#define OP_RIGHT ex_object.ex_oper.op_right - -#define EXPRTYPE(e) ((e)->ex_type->tp_fund) - -/* An expression is a `load-time constant' if it is of the form - +/- or ; - it is a `compile-time constant' if it is an . -*/ -#define is_ld_cst(e) ((e)->ex_lvalue == 0 && (e)->ex_class == Value) -#define is_cp_cst(e) (is_ld_cst(e) && (e)->VL_IDF == 0) - -/* a floating constant expression ? -*/ -#define is_fp_cst(e) ((e)->ex_class == Float) - -/* some bits for the ex_flag field, to keep track of various - interesting properties of an expression. -*/ -#define EX_SIZEOF 001 /* contains sizeof operator */ -#define EX_CAST 002 /* contains cast */ -#define EX_LOGICAL 004 /* contains logical operator */ -#define EX_COMMA 010 /* contains expression comma */ -#define EX_PARENS 020 /* the top level is parenthesized */ - -#define NILEXPR ((struct expr *)0) - -extern struct expr *intexpr(), *new_oper(); - - -/* allocation definitions of struct expr */ -/* ALLOCDEF "expr" */ -extern char *st_alloc(); -extern struct expr *h_expr; -#define new_expr() ((struct expr *) \ - st_alloc((char **)&h_expr, sizeof(struct expr))) -#define free_expr(p) st_free(p, h_expr, sizeof(struct expr)) - - -#define ISCOMMA(e) ((e)->ex_class == Oper && (e)->OP_OPER == INITCOMMA) diff --git a/lang/cem/cemcom/field.h b/lang/cem/cemcom/field.h deleted file mode 100644 index 794920b66..000000000 --- a/lang/cem/cemcom/field.h +++ /dev/null @@ -1,20 +0,0 @@ -/* $Header$ */ -/* FIELD DESCRIPTOR */ - -struct field { /* for field specifiers */ - struct field *next; - arith fd_mask; - int fd_shift; - int fd_width; - struct sdef *fd_sdef; /* upward pointer */ -}; - - -/* allocation definitions of struct field */ -/* ALLOCDEF "field" */ -extern char *st_alloc(); -extern struct field *h_field; -#define new_field() ((struct field *) \ - st_alloc((char **)&h_field, sizeof(struct field))) -#define free_field(p) st_free(p, h_field, sizeof(struct field)) - diff --git a/lang/cem/cemcom/idf.h b/lang/cem/cemcom/idf.h deleted file mode 100644 index 12496de18..000000000 --- a/lang/cem/cemcom/idf.h +++ /dev/null @@ -1,68 +0,0 @@ -/* $Header$ */ -/* IDENTIFIER DESCRIPTOR */ - -#include "nopp.h" - -/* Since the % operation in the calculation of the hash function - turns out to be expensive, it is replaced by the cheaper XOR (^). - Each character of the identifier is xored with an 8-bit mask which - depends on the position of the character; the sum of these results - is the hash value. The random masks are obtained from a - congruence generator in idf.c. -*/ - -#define HASHSIZE 256 /* must be a power of 2 */ -#define HASH_X 0253 /* Knuth's X */ -#define HASH_A 77 /* Knuth's a */ -#define HASH_C 153 /* Knuth's c */ - -extern char hmask[]; /* the random masks */ -#define HASHMASK (HASHSIZE-1) /* since it is a power of 2 */ -#define STARTHASH() (0) -#define ENHASH(hs,ch,ps) (hs + (ch ^ hmask[ps])) -#define STOPHASH(hs) (hs & HASHMASK) - -struct idstack_item { /* stack of identifiers */ - struct idstack_item *next; - struct idf *is_idf; -}; - - -/* allocation definitions of struct idstack_item */ -/* ALLOCDEF "idstack_item" */ -extern char *st_alloc(); -extern struct idstack_item *h_idstack_item; -#define new_idstack_item() ((struct idstack_item *) \ - st_alloc((char **)&h_idstack_item, sizeof(struct idstack_item))) -#define free_idstack_item(p) st_free(p, h_idstack_item, sizeof(struct idstack_item)) - - -struct idf { - struct idf *next; - char *id_text; -#ifndef NOPP - struct macro *id_macro; - int id_resmac; /* if nonzero: keyword of macroproc. */ -#endif NOPP - int id_reserved; /* non-zero for reserved words */ - struct def *id_def; /* variables, typedefs, enum-constants */ - struct sdef *id_sdef; /* selector tags */ - struct tag *id_struct; /* struct and union tags */ - struct tag *id_enum; /* enum tags */ - int id_special; /* special action needed at occurrence */ -}; - - -/* allocation definitions of struct idf */ -/* ALLOCDEF "idf" */ -extern char *st_alloc(); -extern struct idf *h_idf; -#define new_idf() ((struct idf *) \ - st_alloc((char **)&h_idf, sizeof(struct idf))) -#define free_idf(p) st_free(p, h_idf, sizeof(struct idf)) - - -extern struct idf *str2idf(), *idf_hashed(); - -extern int level; -extern struct idf *gen_idf(); diff --git a/lang/cem/cemcom/ival.c b/lang/cem/cemcom/ival.c deleted file mode 100644 index b439afeca..000000000 --- a/lang/cem/cemcom/ival.c +++ /dev/null @@ -1,624 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* $Header$ */ -/* CODE FOR THE INITIALISATION OF GLOBAL VARIABLES */ - -#include "nofloat.h" -#include -#include "debug.h" -#include -#include "nobitfield.h" -#include "arith.h" -#include "align.h" -#include "label.h" -#include "expr.h" -#include "type.h" -#include "struct.h" -#include "field.h" -#include "assert.h" -#include "Lpars.h" -#include "class.h" -#include "sizes.h" -#include "idf.h" -#include "level.h" -#include "def.h" - -#define con_nullbyte() C_con_ucon("0", (arith)1) - -char *symbol2str(); -char *long2str(); -char *strncpy(); -struct expr *do_array(), *do_struct(), *IVAL(); -extern char options[]; - -/* do_ival() performs the initialisation of a global variable - of type tp with the initialisation expression expr by calling IVAL(). - Guided by type tp, the expression is evaluated. -*/ -do_ival(tpp, ex) - struct type **tpp; - struct expr *ex; -{ - if (IVAL(tpp, ex) != 0) - too_many_initialisers(ex); -} - -/* IVAL() recursively guides the initialisation expression through the - different routines for the different types of initialisation: - - array initialisation - - struct initialisation - - fundamental type initialisation - Upto now, the initialisation of a union is not allowed! - An initialisation expression tree consists of normal expressions - which can be joined together by ',' nodes, which operator acts - like the lisp function "cons" to build lists. - IVAL() returns a pointer to the remaining expression tree. -*/ -struct expr * -IVAL(tpp, ex) - struct type **tpp; /* type of global variable */ - register struct expr *ex; /* initialiser expression */ -{ - register struct type *tp = *tpp; - - switch (tp->tp_fund) { - case ARRAY: /* array initialisation */ - if (valid_type(tp->tp_up, "array element") == 0) - return 0; - if (ISCOMMA(ex)) /* list of initialisation expressions */ - return do_array(ex, tpp); - if (tp->tp_up->tp_fund == CHAR && ex->ex_class == String) - /* initialisation like char s[] = "I am a string" */ - ch_array(tpp, ex); - else /* " int i[24] = 12;" */ - check_and_pad(ex, tpp); - break; - case STRUCT: /* struct initialisation */ - if (valid_type(tp, "struct") == 0) - return 0; - if (ISCOMMA(ex)) /* list of initialisation expressions */ - return do_struct(ex, tp); - check_and_pad(ex, tpp); /* "struct foo f = 12;" */ - break; - case UNION: - error("union initialisation not allowed"); - break; - case ERRONEOUS: - break; - default: /* fundamental type */ - if (ISCOMMA(ex)) { /* " int i = {12};" */ - if (IVAL(tpp, ex->OP_LEFT) != 0) - too_many_initialisers(ex); - /* return remainings of the list for the - other members of the aggregate, if this - item belongs to an aggregate. - */ - return ex->OP_RIGHT; - } - check_ival(ex, tp); /* "int i = 12;" */ - break; - } - return 0; -} - -/* do_array() initialises the members of an array described - by type tp with the expressions in expr. - Two important cases: - - the number of members is known - - the number of members is not known - In the latter case, do_array() digests the whole expression - tree it is given. - In the former case, do_array() eats as many members from - the expression tree as are needed for the array. - If there are not sufficient members for the array, the remaining - members are padded with zeroes -*/ -struct expr * -do_array(ex, tpp) - register struct expr *ex; - struct type **tpp; -{ - register struct type *tp = *tpp; - register arith elem_count; - - ASSERT(tp->tp_fund == ARRAY && ISCOMMA(ex)); - /* the following test catches initialisations like - char c[] = {"just a string"}; - or - char d[] = {{"just another string"}}; - The use of the brackets causes this problem. - Note: although the implementation of such initialisations - is completely foolish, we did it!! (no applause, thank you) - */ - if (tp->tp_up->tp_fund == CHAR) { - register struct expr *f = ex->OP_LEFT, *g = NILEXPR; - - while (ISCOMMA(f)) { /* eat the brackets!!! */ - g = f; - f = f->OP_LEFT; - } - if (f->ex_class == String) { /* hallelujah, it's a string! */ - ch_array(tpp, f); - return g ? g->OP_RIGHT : ex->OP_RIGHT; - } - /* else: just go on with the next part of this function */ - if (g != 0) - ex = g; - } - if (tp->tp_size == (arith)-1) { - /* declared with unknown size: [] */ - for (elem_count = 0; ex; elem_count++) { - /* eat whole initialisation expression */ - if (ISCOMMA(ex->OP_LEFT)) { /* embraced member */ - if (IVAL(&(tp->tp_up), ex->OP_LEFT) != 0) - too_many_initialisers(ex); - ex = ex->OP_RIGHT; - } - else { - if (aggregate_type(tp->tp_up)) - ex = IVAL(&(tp->tp_up), ex); - else { - check_ival(ex->OP_LEFT, tp->tp_up); - ex = ex->OP_RIGHT; - } - } - } - /* set the proper size */ - *tpp = construct_type(ARRAY, tp->tp_up, elem_count); - } - else { /* the number of members is already known */ - arith dim = tp->tp_size / tp->tp_up->tp_size; - - for (elem_count = 0; elem_count < dim && ex; elem_count++) { - if (ISCOMMA(ex->OP_LEFT)) { /* embraced member */ - if (IVAL(&(tp->tp_up), ex->OP_LEFT) != 0) - too_many_initialisers(ex); - ex = ex->OP_RIGHT; - } - else { - if (aggregate_type(tp->tp_up)) - ex = IVAL(&(tp->tp_up), ex); - else { - check_ival(ex->OP_LEFT, tp->tp_up); - ex = ex->OP_RIGHT; - } - } - } - if (ex && elem_count == dim) - /* all the members are initialised but there - remains a part of the expression tree which - is returned - */ - return ex; - if ((ex == 0) && elem_count < dim) - /* the expression tree is completely absorbed - but there are still members which must be - initialised with zeroes - */ - do - pad(tp->tp_up); - while (++elem_count < dim); - } - return 0; -} - - -/* do_struct() initialises a struct of type tp with the expression expr. - The main loop is just controlled by the definition of the selectors - during which alignment is taken care of. -*/ -struct expr * -do_struct(ex, tp) - register struct expr *ex; - register struct type *tp; -{ - register struct sdef *sd = tp->tp_sdef; - arith bytes_upto_here = (arith)0; - arith last_offset = (arith)-1; - - ASSERT(tp->tp_fund == STRUCT && ISCOMMA(ex)); - /* as long as there are selectors and there is an initialiser.. */ - while (sd && ex) { - if (ISCOMMA(ex->OP_LEFT)) { /* embraced expression */ - if (IVAL(&(sd->sd_type), ex->OP_LEFT) != 0) - too_many_initialisers(ex); - ex = ex->OP_RIGHT; - } - else { - if (aggregate_type(sd->sd_type)) - /* selector is an aggregate itself */ - ex = IVAL(&(sd->sd_type), ex); - else { -#ifdef NOBITFIELD - /* fundamental type, not embraced */ - check_ival(ex->OP_LEFT, sd->sd_type); - ex = ex->OP_RIGHT; -#else - if (is_anon_idf(sd->sd_idf)) - /* a hole in the struct due to - the use of ";:n;" in a struct - definition. - */ - put_bf(sd->sd_type, (arith)0); - else { /* fundamental type, not embraced */ - check_ival(ex->OP_LEFT, sd->sd_type); - ex = ex->OP_RIGHT; - } -#endif NOBITFIELD - } - } - if (sd->sd_sdef) /* align upto the next selector boundary */ - bytes_upto_here += zero_bytes(sd); - if (last_offset != sd->sd_offset) { - /* don't take the field-width more than once */ - bytes_upto_here += - size_of_type(sd->sd_type, "selector"); - last_offset = sd->sd_offset; - } - sd = sd->sd_sdef; - } - /* perfect fit if (ex && (sd == 0)) holds */ - if ((ex == 0) && (sd != 0)) { - /* there are selectors left which must be padded with zeroes */ - do { - pad(sd->sd_type); - /* take care of the alignment restrictions */ - if (sd->sd_sdef) - bytes_upto_here += zero_bytes(sd); - /* no field thrown-outs here */ - bytes_upto_here += - size_of_type(sd->sd_type, "selector"); - } while (sd = sd->sd_sdef); - } - /* keep on aligning... */ - while (bytes_upto_here++ < tp->tp_size) - con_nullbyte(); - return ex; -} - -/* check_and_pad() is given a simple initialisation expression - where the type can be either a simple or an aggregate type. - In the latter case, only the first member is initialised and - the rest is zeroed. -*/ -check_and_pad(ex, tpp) - register struct expr *ex; - struct type **tpp; -{ - /* ex is of a fundamental type */ - register struct type *tp = *tpp; - - if (tp->tp_fund == ARRAY) { - if (valid_type(tp->tp_up, "array element") == 0) - return; - check_and_pad(ex, &(tp->tp_up)); /* first member */ - if (tp->tp_size == (arith)-1) - /* no size specified upto here: just - set it to the size of one member. - */ - tp = *tpp = construct_type(ARRAY, tp->tp_up, (arith)1); - else { - register int dim = tp->tp_size / tp->tp_up->tp_size; - /* pad remaining members with zeroes */ - while (--dim > 0) - pad(tp->tp_up); - } - } - else - if (tp->tp_fund == STRUCT) { - register struct sdef *sd = tp->tp_sdef; - - if (valid_type(tp, "struct") == 0) - return; - check_and_pad(ex, &(sd->sd_type)); - /* next selector is aligned by adding extra zeroes */ - if (sd->sd_sdef) - zero_bytes(sd); - while (sd = sd->sd_sdef) { /* pad remaining selectors */ - pad(sd->sd_type); - if (sd->sd_sdef) - zero_bytes(sd); - } - } - else /* simple type */ - check_ival(ex, tp); -} - -/* pad() fills an element of type tp with zeroes. - If the element is an aggregate, pad() is called recursively. -*/ -pad(tp) - register struct type *tp; -{ - register arith sz = tp->tp_size; - - switch (tp->tp_fund) { - case ARRAY: - if (valid_type(tp->tp_up, "array element") == 0) - return; - break; - case STRUCT: - if (valid_type(tp, "struct") == 0) - return; - break; - case UNION: - if (valid_type(tp, "union") == 0) - return; - if (options['R']) { - warning("initialisation of unions not allowed"); - } - break; -#ifndef NOBITFIELD - case FIELD: - put_bf(tp, (arith)0); - return; -#endif NOBITFIELD - case ERRONEOUS: - return; - } - - while (sz >= word_size) { - C_con_cst((arith) 0); - sz -= word_size; - } - while (sz) { - C_con_icon("0", (arith) 1); - sz--; - } -} - -/* check_ival() checks whether the initialisation of an element - of a fundamental type is legal and, if so, performs the initialisation - by directly generating the necessary code. - No further comment is needed to explain the internal structure - of this straightforward function. -*/ -check_ival(expr, tp) - register struct expr *expr; - register struct type *tp; -{ - /* The philosophy here is that ch7cast puts an explicit - conversion node in front of the expression if the types - are not compatible. In this case, the initialisation - expression is no longer a constant. - */ - struct expr *ex = expr; - - switch (tp->tp_fund) { - case CHAR: - case SHORT: - case INT: - case LONG: - case ENUM: - case POINTER: - ch7cast(&ex, '=', tp); - expr = ex; -#ifdef DEBUG - print_expr("init-expr after cast", expr); -#endif DEBUG - if (!is_ld_cst(expr)) - illegal_init_cst(expr); - else - if (expr->VL_CLASS == Const) - con_int(expr); - else - if (expr->VL_CLASS == Name) { - register struct idf *idf = expr->VL_IDF; - - if (idf->id_def->df_level >= L_LOCAL) - illegal_init_cst(expr); - else /* e.g., int f(); int p = f; */ - if (idf->id_def->df_type->tp_fund == FUNCTION) - C_con_pnam(idf->id_text); - else /* e.g., int a; int *p = &a; */ - C_con_dnam(idf->id_text, expr->VL_VALUE); - } - else { - ASSERT(expr->VL_CLASS == Label); - C_con_dlb(expr->VL_LBL, expr->VL_VALUE); - } - break; -#ifndef NOFLOAT - case FLOAT: - case DOUBLE: - ch7cast(&ex, '=', tp); - expr = ex; -#ifdef DEBUG - print_expr("init-expr after cast", expr); -#endif DEBUG - if (expr->ex_class == Float) - C_con_fcon(expr->FL_VALUE, expr->ex_type->tp_size); - else - if (expr->ex_class == Oper && expr->OP_OPER == INT2FLOAT) { - /* float f = 1; */ - expr = expr->OP_RIGHT; - if (is_cp_cst(expr)) - C_con_fcon(long2str((long)expr->VL_VALUE, 10), - tp->tp_size); - else - illegal_init_cst(expr); - } - else - illegal_init_cst(expr); - break; -#endif NOFLOAT - -#ifndef NOBITFIELD - case FIELD: - ch7cast(&ex, '=', tp->tp_up); - expr = ex; -#ifdef DEBUG - print_expr("init-expr after cast", expr); -#endif DEBUG - if (is_cp_cst(expr)) - put_bf(tp, expr->VL_VALUE); - else - illegal_init_cst(expr); - break; -#endif NOBITFIELD - - case ERRONEOUS: - break; - default: - crash("check_ival"); - } -} - -/* ch_array() initialises an array of characters when given - a string constant. - Alignment is taken care of. -*/ -ch_array(tpp, ex) - struct type **tpp; /* type tp = array of characters */ - struct expr *ex; -{ - register struct type *tp = *tpp; - register arith length = ex->SG_LEN; - char *s; - arith ntopad; - - ASSERT(ex->ex_class == String); - if (tp->tp_size == (arith)-1) { - /* set the dimension */ - tp = *tpp = construct_type(ARRAY, tp->tp_up, length); - ntopad = align(tp->tp_size, word_size) - tp->tp_size; - } - else { - arith dim = tp->tp_size / tp->tp_up->tp_size; - extern char options[]; - - if (length > dim) { - if (options['R']) - too_many_initialisers(ex); - else { /* don't take the null byte into account */ - if (length > dim + 1) - expr_warning(ex, - "too many initialisers"); - length = dim; - } - } - ntopad = align(dim, word_size) - length; - } - /* throw out the characters of the already prepared string */ - s = Malloc((unsigned) (length + ntopad)); - clear(s, (int) (length + ntopad)); - strncpy(s, ex->SG_VALUE, (int) length); - free(ex->SG_VALUE); - str_cst(s, (int) (length + ntopad)); - free(s); -} - -/* As long as some parts of the pipeline cannot handle very long string - constants, string constants are written out in chunks -*/ -str_cst(str, len) - register char *str; - register int len; -{ - arith chunksize = ((127 + word_size) / word_size) * word_size; - - while (len > chunksize) { - C_con_scon(str, chunksize); - len -= chunksize; - str += chunksize; - } - C_con_scon(str, (arith) len); -} - -#ifndef NOBITFIELD -/* put_bf() takes care of the initialisation of (bit-)field - selectors of a struct: each time such an initialisation takes place, - put_bf() is called instead of the normal code generating routines. - Put_bf() stores the given integral value into "field" and - "throws" the result of "field" out if the current selector - is the last of this number of fields stored at the same address. -*/ -put_bf(tp, val) - struct type *tp; - arith val; -{ - static long field = (arith)0; - static arith offset = (arith)-1; - register struct field *fd = tp->tp_field; - register struct sdef *sd = fd->fd_sdef; - static struct expr exp; - - ASSERT(sd); - if (offset == (arith)-1) { - /* first bitfield in this field */ - offset = sd->sd_offset; - exp.ex_type = tp->tp_up; - exp.ex_class = Value; - exp.VL_CLASS = Const; - } - if (val != 0) /* insert the value into "field" */ - field |= (val & fd->fd_mask) << fd->fd_shift; - if (sd->sd_sdef == 0 || sd->sd_sdef->sd_offset != offset) { - /* the selector was the last stored at this address */ - exp.VL_VALUE = field; - con_int(&exp); - field = (arith)0; - offset = (arith)-1; - } -} -#endif NOBITFIELD - -int -zero_bytes(sd) - register struct sdef *sd; -{ - /* fills the space between a selector of a struct - and the next selector of that struct with zero-bytes. - */ - register int n = sd->sd_sdef->sd_offset - sd->sd_offset - - size_of_type(sd->sd_type, "struct member"); - register int count = n; - - while (n-- > 0) - con_nullbyte(); - return count; -} - -int -valid_type(tp, str) - struct type *tp; - char *str; -{ - if (tp->tp_size < 0) { - error("size of %s unknown", str); - return 0; - } - return 1; -} - -con_int(ex) - register struct expr *ex; -{ - register struct type *tp = ex->ex_type; - - ASSERT(is_cp_cst(ex)); - if (tp->tp_unsigned) - C_con_ucon(long2str((long)ex->VL_VALUE, -10), tp->tp_size); - else - C_con_icon(long2str((long)ex->VL_VALUE, 10), tp->tp_size); -} - -illegal_init_cst(ex) - struct expr *ex; -{ - expr_error(ex, "illegal initialisation constant"); -} - -too_many_initialisers(ex) - struct expr *ex; -{ - expr_error(ex, "too many initialisers"); -} - -aggregate_type(tp) - register struct type *tp; -{ - return tp->tp_fund == ARRAY || tp->tp_fund == STRUCT; -} diff --git a/lang/cem/cemcom/macro.h b/lang/cem/cemcom/macro.h deleted file mode 100644 index cdd023f89..000000000 --- a/lang/cem/cemcom/macro.h +++ /dev/null @@ -1,52 +0,0 @@ -/* $Header$ */ -/* PREPROCESSOR: DEFINITION OF MACRO DESCRIPTOR */ - -#include "nopp.h" - -#ifndef NOPP -/* The flags of the mc_flag field of the macro structure. Note that - these flags can be set simultaneously. -*/ -#define NOFLAG 0 /* no special flags */ -#define FUNC 01 /* function attached */ -#define PREDEF 02 /* predefined macro */ - -#define FORMALP 0200 /* mask for creating macro formal parameter */ - -/* The macro descriptor is very simple, except the fact that the - mc_text, which points to the replacement text, contains the - non-ascii characters \201, \202, etc, indicating the position of a - formal parameter in this text. -*/ -struct macro { - struct macro *next; - char * mc_text; /* the replacement text */ - int mc_nps; /* number of formal parameters */ - int mc_length; /* length of replacement text */ - char mc_flag; /* marking this macro */ -}; - - -/* allocation definitions of struct macro */ -/* ALLOCDEF "macro" */ -extern char *st_alloc(); -extern struct macro *h_macro; -#define new_macro() ((struct macro *) \ - st_alloc((char **)&h_macro, sizeof(struct macro))) -#define free_macro(p) st_free(p, h_macro, sizeof(struct macro)) - - -/* `token' numbers of keywords of command-line processor -*/ -#define K_UNKNOWN 0 -#define K_DEFINE 1 -#define K_ELIF 2 -#define K_ELSE 3 -#define K_ENDIF 4 -#define K_IF 5 -#define K_IFDEF 6 -#define K_IFNDEF 7 -#define K_INCLUDE 8 -#define K_LINE 9 -#define K_UNDEF 10 -#endif NOPP diff --git a/lang/cem/cemcom/make.emfun b/lang/cem/cemcom/make.emfun deleted file mode 100755 index d3fe92f60..000000000 --- a/lang/cem/cemcom/make.emfun +++ /dev/null @@ -1,19 +0,0 @@ -ed - $1 <<'--EOI--' -g/^%/d -g/^ /.-1,.j -1,$s/^\([^|]*\)|\([^|]*\)|\(.*\)$/\ -\1 \2 {\ -\3;\ -}/ -1i -/* EM COMPACT CODE -- PROCEDURAL INTERFACE (generated from emcode.def) */ -#include "em.h" -#ifdef PROC_INTF -#include "label.h" -#include "arith.h" -. -$a -#endif PROC_INTF -. -1,$p ---EOI-- diff --git a/lang/cem/cemcom/make.emmac b/lang/cem/cemcom/make.emmac deleted file mode 100755 index 5337f40f8..000000000 --- a/lang/cem/cemcom/make.emmac +++ /dev/null @@ -1,10 +0,0 @@ -ed - $1 <<'--EOI--' -g/^%/d -g/^ /.-1,.j -1,$s/^\([^|]*\)|[^|]*|\(.*\)$/\ -#define \1 (\2)/ -1i -/* EM COMPACT CODE -- MACRO DEFINITIONS (generated from emcode.def) */ -. -1,$p ---EOI-- diff --git a/lang/cem/cemcom/stack.h b/lang/cem/cemcom/stack.h deleted file mode 100644 index 27a7f312f..000000000 --- a/lang/cem/cemcom/stack.h +++ /dev/null @@ -1,46 +0,0 @@ -/* $Header$ */ -/* IDENTIFIER STACK DEFINITIONS */ - -/* The identifier stack is implemented as a stack of sets. - The stack is implemented by a doubly linked list, - the sets by singly linked lists. -*/ - -struct stack_level { - struct stack_level *next; - struct stack_level *sl_next; /* upward link */ - struct stack_level *sl_previous; /* downward link */ - struct stack_entry *sl_entry; /* sideward link */ - arith sl_local_offset; /* @ for first coming object */ - arith sl_max_block; /* maximum size of sub-block */ - int sl_level; -}; - - -/* allocation definitions of struct stack_level */ -/* ALLOCDEF "stack_level" */ -extern char *st_alloc(); -extern struct stack_level *h_stack_level; -#define new_stack_level() ((struct stack_level *) \ - st_alloc((char **)&h_stack_level, sizeof(struct stack_level))) -#define free_stack_level(p) st_free(p, h_stack_level, sizeof(struct stack_level)) - - -struct stack_entry { - struct stack_entry *next; - struct idf *se_idf; -}; - - -/* allocation definitions of struct stack_entry */ -/* ALLOCDEF "stack_entry" */ -extern char *st_alloc(); -extern struct stack_entry *h_stack_entry; -#define new_stack_entry() ((struct stack_entry *) \ - st_alloc((char **)&h_stack_entry, sizeof(struct stack_entry))) -#define free_stack_entry(p) st_free(p, h_stack_entry, sizeof(struct stack_entry)) - - -extern struct stack_level *local_level; -extern struct stack_level *stack_level_of(); -extern int level; diff --git a/lang/cem/cemcom/storage.c b/lang/cem/cemcom/storage.c deleted file mode 100644 index 1477f7123..000000000 --- a/lang/cem/cemcom/storage.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $Header$ */ -/* S T R U C T U R E - S T O R A G E M A N A G E M E N T */ - -/* Assume that each structure contains a field "next", of pointer - type, as first tagfield. - struct xxx serves as a general structure: it just declares the - tagfield "next" as first field of a structure. - Please don't worry about any warnings when compiling this file - because some dirty tricks are performed to obtain the necessary - actions. -*/ - -#include "debug.h" /* UF */ -#include "botch_free.h" /* UF */ -#include "assert.h" -#include "alloc.h" -#include "storage.h" - -struct xxx { - char *next; -}; - -char * -head_alloc(phead, size) - char **phead; - int size; -{ - struct xxx *tmp; - - if (*phead == 0) { - return Malloc(size); - } - tmp = (struct xxx *) (*phead); - *phead = (char *) tmp->next; - return (char *) tmp; -} - -/* instead of Calloc: */ -clear(ptr, n) - char *ptr; - int n; -{ - ASSERT((long)ptr % sizeof (long) == 0); - while (n >= sizeof (long)) { /* high-speed clear loop */ - *(long *)ptr = 0L; - ptr += sizeof (long), n -= sizeof (long); - } - while (n--) - *ptr++ = '\0'; -} - -#ifdef BOTCH_FREE -botch(ptr, n) - char *ptr; - int n; -{ /* Writes garbage over n chars starting from ptr. - Used to check if freed memory is used inappropriately. - */ - ASSERT((long)ptr % sizeof (long) == 0); - while (n >= sizeof (long)) { /* high-speed botch loop */ - *(long *)ptr = 025252525252L; - ptr += sizeof (long), n -= sizeof (long); - } - while (n--) - *ptr++ = '\252'; -} -#endif BOTCH_FREE diff --git a/lang/cem/cemcom/storage.h b/lang/cem/cemcom/storage.h deleted file mode 100644 index 8eec82148..000000000 --- a/lang/cem/cemcom/storage.h +++ /dev/null @@ -1,23 +0,0 @@ -/* $Header$ */ -/* S T R U C T U R E - S T O R A G E D E F I N I T I O N S */ - -/* Storage allocation is one of the most expensive operations in - the compiler and consequently much thought and experimentation - has gone into it. To simplify the hooking in of new super-fancy - algorithms, all allocating and freeing of storage for structs - goes through the macros - st_alloc(&head, size) - st_free(ptr, head, size) - which, hopefully, convey enough information. -*/ - -extern char *head_alloc(); - -#define st_alloc(headp, size) head_alloc((char **)headp, size) - -#ifndef BOTCH_FREE -#define st_free(ptr, head, size) (ptr->next = head, head = ptr) -#else def BOTCH_FREE -#define st_free(ptr, head, size) (botch((char *)(ptr), size), \ - ptr->next = head, head = ptr) -#endif BOTCH_FREE diff --git a/lang/cem/cemcom/string.c b/lang/cem/cemcom/string.c deleted file mode 100644 index 5a61cc304..000000000 --- a/lang/cem/cemcom/string.c +++ /dev/null @@ -1,277 +0,0 @@ -/* $Header$ */ -/* STRING MANIPULATION AND PRINT ROUTINES */ - -#include -#include "string.h" -#include "nopp.h" -#include "str_params.h" -#include "arith.h" - -doprnt(fp, fmt, argp) - File *fp; - char *fmt; - int argp[]; -{ - char buf[SSIZE]; - - sys_write(fp, buf, format(buf, fmt, (char *)argp)); -} - -/*VARARGS1*/ -printf(fmt, args) - char *fmt; - char args; -{ - char buf[SSIZE]; - - sys_write(STDOUT, buf, format(buf, fmt, &args)); -} - -/*VARARGS1*/ -fprintf(fp, fmt, args) - File *fp; - char *fmt; - char args; -{ - char buf[SSIZE]; - - sys_write(fp, buf, format(buf, fmt, &args)); -} - -/*VARARGS1*/ -char * -sprintf(buf, fmt, args) - char *buf, *fmt; - char args; -{ - buf[format(buf, fmt, &args)] = '\0'; - return buf; -} - -int -format(buf, fmt, argp) - char *buf, *fmt; - char *argp; -{ - register char *pf = fmt, *pa = argp; - register char *pb = buf; - - while (*pf) { - if (*pf == '%') { - register width, base, pad, npad; - char *arg; - char cbuf[2]; - char *badformat = ""; - - /* get padder */ - if (*++pf == '0') { - pad = '0'; - ++pf; - } - else - pad = ' '; - - /* get width */ - width = 0; - while (*pf >= '0' && *pf <= '9') - width = 10 * width + *pf++ - '0'; - - /* get text and move pa */ - if (*pf == 's') { - arg = *(char **)pa; - pa += sizeof(char *); - } - else - if (*pf == 'c') { - cbuf[0] = * (char *) pa; - cbuf[1] = '\0'; - pa += sizeof(int); - arg = &cbuf[0]; - } - else - if (*pf == 'l') { - /* alignment ??? */ - if (base = integral(*++pf)) { - arg = int_str(*(long *)pa, base); - pa += sizeof(long); - } - else { - pf--; - arg = badformat; - } - } - else - if (base = integral(*pf)) { - arg = int_str((long)*(int *)pa, base); - pa += sizeof(int); - } - else - if (*pf == '%') - arg = "%"; - else - arg = badformat; - - npad = width - strlen(arg); - - while (npad-- > 0) - *pb++ = pad; - - while (*pb++ = *arg++); - pb--; - pf++; - } - else - *pb++ = *pf++; - } - return pb - buf; -} - -integral(c) -{ - switch (c) { - case 'b': - return -2; - case 'd': - return 10; - case 'o': - return -8; - case 'u': - return -10; - case 'x': - return -16; - } - return 0; -} - -/* Integer to String translator -*/ -char * -int_str(val, base) - register long val; - register base; -{ - /* int_str() is a very simple integer to string converter. - base < 0 : unsigned. - base must be an element of [-16,-2] V [2,16]. - */ - static char numbuf[MAXWIDTH]; - static char vec[] = "0123456789ABCDEF"; - register char *p = &numbuf[MAXWIDTH]; - int sign = (base > 0); - - *--p = '\0'; /* null-terminate string */ - if (val) { - if (base > 0) { - if (val < (arith)0) { - if ((val = -val) < (arith)0) - goto overflow; - } - else - sign = 0; - } - else - if (base < 0) { /* unsigned */ - base = -base; - if (val < (arith)0) { - register mod, i; - - overflow: - /* this takes a rainy Sunday afternoon to explain */ - /* ??? */ - mod = 0; - for (i = 0; i < 8 * sizeof val; i++) { - mod <<= 1; - if (val < 0) - mod++; - val <<= 1; - if (mod >= base) { - mod -= base; - val++; - } - } - *--p = vec[mod]; - } - } - - do { - *--p = vec[(int) (val % base)]; - val /= base; - } while (val != (arith)0); - - if (sign) - *--p = '-'; /* don't forget it !! */ - } - else - *--p = '0'; /* just a simple 0 */ - - return p; -} - -/* return negative, zero or positive value if - resp. s < t, s == t or s > t -*/ -int -strcmp(s, t) - register char *s, *t; -{ - while (*s == *t++) - if (*s++ == '\0') - return 0; - return *s - *--t; -} - -/* return length of s -*/ -int -strlen(s) - char *s; -{ - register char *b = s; - - while (*b++) - ; - return b - s - 1; -} - -#ifndef NOPP -/* append t to s -*/ -char * -strcat(s, t) - register char *s, *t; -{ - register char *b = s; - - while (*s++) - ; - s--; - while (*s++ = *t++) - ; - return b; -} - -/* Copy t into s -*/ -char * -strcpy(s, t) - register char *s, *t; -{ - register char *b = s; - - while (*s++ = *t++) - ; - return b; -} - -char * -rindex(str, chr) - register char *str, chr; -{ - register char *retptr = 0; - - while (*str) - if (*str++ == chr) - retptr = &str[-1]; - return retptr; -} -#endif NOPP diff --git a/lang/cem/cemcom/string.h b/lang/cem/cemcom/string.h deleted file mode 100644 index ffeeb6bba..000000000 --- a/lang/cem/cemcom/string.h +++ /dev/null @@ -1,13 +0,0 @@ -/* $Header$ */ -/* STRING-ROUTINE DEFINITIONS */ - -#define stdin 0 -#define stdout 1 -#define stderr 2 - -#define itos(n) int_str((long)(n), 10) - -char *sprintf(); /* string.h */ -char *int_str(); /* string.h */ - -char *strcpy(), *strcat(), *rindex(); diff --git a/lang/cem/cemcom/struct.h b/lang/cem/cemcom/struct.h deleted file mode 100644 index 8caab6786..000000000 --- a/lang/cem/cemcom/struct.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $Header$ */ -/* SELECTOR DESCRIPTOR */ - -struct sdef { /* for selectors */ - struct sdef *next; - int sd_level; - struct idf *sd_idf; /* its name */ - struct sdef *sd_sdef; /* the next selector */ - struct type *sd_stype; /* the struct it belongs to */ - struct type *sd_type; /* its type */ - arith sd_offset; -}; - -extern char *st_alloc(); - - -/* allocation definitions of struct sdef */ -/* ALLOCDEF "sdef" */ -extern char *st_alloc(); -extern struct sdef *h_sdef; -#define new_sdef() ((struct sdef *) \ - st_alloc((char **)&h_sdef, sizeof(struct sdef))) -#define free_sdef(p) st_free(p, h_sdef, sizeof(struct sdef)) - - -struct tag { /* for struct-, union- and enum tags */ - struct tag *next; - int tg_level; - int tg_busy; /* non-zero during declaration of struct/union pack */ - struct type *tg_type; -}; - - - -/* allocation definitions of struct tag */ -/* ALLOCDEF "tag" */ -extern char *st_alloc(); -extern struct tag *h_tag; -#define new_tag() ((struct tag *) \ - st_alloc((char **)&h_tag, sizeof(struct tag))) -#define free_tag(p) st_free(p, h_tag, sizeof(struct tag)) - - -struct sdef *idf2sdef(); diff --git a/lang/cem/cemcom/switch.h b/lang/cem/cemcom/switch.h deleted file mode 100644 index 07998b9e7..000000000 --- a/lang/cem/cemcom/switch.h +++ /dev/null @@ -1,40 +0,0 @@ -/* $Header$ */ -/* S W I T C H - T A B L E - S T R U C T U R E */ - -struct switch_hdr { - struct switch_hdr *next; - label sh_break; - label sh_default; - label sh_table; - int sh_nrofentries; - struct type *sh_type; - arith sh_lowerbd; - arith sh_upperbd; - struct case_entry *sh_entries; -}; - - -/* allocation definitions of struct switch_hdr */ -/* ALLOCDEF "switch_hdr" */ -extern char *st_alloc(); -extern struct switch_hdr *h_switch_hdr; -#define new_switch_hdr() ((struct switch_hdr *) \ - st_alloc((char **)&h_switch_hdr, sizeof(struct switch_hdr))) -#define free_switch_hdr(p) st_free(p, h_switch_hdr, sizeof(struct switch_hdr)) - - -struct case_entry { - struct case_entry *next; - label ce_label; - arith ce_value; -}; - - -/* allocation definitions of struct case_entry */ -/* ALLOCDEF "case_entry" */ -extern char *st_alloc(); -extern struct case_entry *h_case_entry; -#define new_case_entry() ((struct case_entry *) \ - st_alloc((char **)&h_case_entry, sizeof(struct case_entry))) -#define free_case_entry(p) st_free(p, h_case_entry, sizeof(struct case_entry)) - diff --git a/lang/cem/cemcom/system.c b/lang/cem/cemcom/system.c deleted file mode 100644 index dd80863b1..000000000 --- a/lang/cem/cemcom/system.c +++ /dev/null @@ -1,72 +0,0 @@ -/* $Header$ */ -/* SYSTEM DEPENDENT ROUTINES */ - -#include "system.h" -#include "inputtype.h" -#include - -extern long lseek(); - -int -xopen(name, flag, mode) - char *name; -{ - if (name[0] == '-' && name[1] == '\0') - return (flag == OP_RDONLY) ? 0 : 1; - - switch (flag) { - - case OP_RDONLY: - return open(name, 0); - case OP_WRONLY: - return open(name, 1); - case OP_CREAT: - return creat(name, mode); - case OP_APPEND: - { - register fd; - - if ((fd = open(name, 1)) < 0) - return -1; - lseek(fd, 0L, 2); - return fd; - } - } - /*NOTREACHED*/ -} - -int -xclose(fildes) -{ - if (fildes != 0 && fildes != 1) - return close(fildes); - return -1; -} - -#ifdef READ_IN_ONE -long -xfsize(fildes) -{ - struct stat stbuf; - - if (fstat(fildes, &stbuf) != 0) - return -1; - return stbuf.st_size; -} -#endif READ_IN_ONE - -exit(n) -{ - _exit(n); -} - -xstop(how, stat) -{ - switch (how) { - case S_ABORT: - abort(); - case S_EXIT: - exit(stat); - } - /*NOTREACHED*/ -} diff --git a/lang/cem/cemcom/system.h b/lang/cem/cemcom/system.h deleted file mode 100644 index ae69ff8cb..000000000 --- a/lang/cem/cemcom/system.h +++ /dev/null @@ -1,34 +0,0 @@ -/* $Header$ */ -/* SYSTEM DEPENDANT DEFINITIONS */ - -#include -#include - -#define OP_RDONLY 0 /* open for read */ -#define OP_WRONLY 1 /* open for write */ -#define OP_CREAT 2 /* create and open for write */ -#define OP_APPEND 3 /* open for write at end */ - -#define sys_open(name, flag) xopen(name, flag, 0) -#define sys_close(fildes) xclose(fildes) -#define sys_read(fildes, buffer, nbytes) read(fildes, buffer, nbytes) -#define sys_write(fildes, buffer, nbytes) write(fildes, buffer, nbytes) -#define sys_creat(name, mode) xopen(name, OP_CREAT, mode) -#define sys_remove(name) unlink(name) -#define sys_fsize(fd) xfsize(fd) -#define sys_sbrk(incr) sbrk(incr) -#define sys_stop(how, stat) xstop(how, stat) - -#define S_ABORT 1 -#define S_EXIT 2 - -char *sbrk(); -long xfsize(); - -extern int errno; - -#define sys_errno errno - -#define time_type time_t -#define sys_time(tloc) time(tloc) -time_type time(); diff --git a/lang/cem/cemcom/type.h b/lang/cem/cemcom/type.h deleted file mode 100644 index 1937a569e..000000000 --- a/lang/cem/cemcom/type.h +++ /dev/null @@ -1,52 +0,0 @@ -/* $Header$ */ -/* TYPE DESCRIPTOR */ - -#include "nobitfield.h" - -struct type { - struct type *next; /* used only with ARRAY */ - short tp_fund; /* fundamental type */ - char tp_unsigned; - int tp_align; - arith tp_size; /* -1 if declared but not defined */ - struct idf *tp_idf; /* name of STRUCT, UNION or ENUM */ - struct sdef *tp_sdef; /* to first selector */ - struct type *tp_up; /* from FIELD, POINTER, ARRAY - or FUNCTION to fund. */ - struct field *tp_field; /* field descriptor if fund == FIELD */ - struct type *tp_pointer;/* to POINTER */ - struct type *tp_array; /* to ARRAY */ - struct type *tp_function;/* to FUNCTION */ -}; - -extern struct type - *create_type(), *standard_type(), *construct_type(), *pointer_to(), - *array_of(), *function_of(); - -#ifndef NOBITFIELD -extern struct type *field_of(); -#endif NOBITFIELD - -extern struct type - *char_type, *uchar_type, - *short_type, *ushort_type, - *word_type, *uword_type, - *int_type, *uint_type, - *long_type, *ulong_type, - *float_type, *double_type, - *void_type, *label_type, - *string_type, *funint_type, *error_type; - -extern struct type *pa_type; /* type.c */ - -extern arith size_of_type(), align(); - - -/* allocation definitions of struct type */ -/* ALLOCDEF "type" */ -extern char *st_alloc(); -extern struct type *h_type; -#define new_type() ((struct type *) \ - st_alloc((char **)&h_type, sizeof(struct type))) -#define free_type(p) st_free(p, h_type, sizeof(struct type)) - diff --git a/lang/cem/ctest/ctgen/id.cem.g b/lang/cem/ctest/ctgen/id.cem.g deleted file mode 100644 index d7b332418..000000000 --- a/lang/cem/ctest/ctgen/id.cem.g +++ /dev/null @@ -1,72 +0,0 @@ -(-40) + 300 -(-40) - 300 -(-40) / 300 -(-40) * 300 -(-40) || 300 -(-40) && 300 --(-40) -!(-40) -(-40) == 300 -(-40) != 300 -(-40) <= 300 -(-40) >= 300 -(-40) < 300 -(-40) > 300 -(-40) ? (-40) : 300 -x = (-40) -4.000000e+01 -x += (-40) -3.685850e+01 -x -= (-40) 4.314150e+01 -x /= (-40) -7.853750e-02 -x *= (-40) -1.256600e+02 -x ++ 4.141500e+00 -x -- 2.141500e+00 --- x 2.141500e+00 -++ x 4.141500e+00 -y = ( (-40) + 300 ) 17538 -y = ( (-40) - 300 ) 50346 -y = ( (-40) / 300 ) 0 -y = ( (-40) * 300 ) -2147432645 -y = ( (-40) || 300 ) 16512 -y = ( (-40) && 300 ) 16512 -y = ( -(-40) ) 17184 -y = ( !(-40) ) 0 -y = ( (-40) == 300 ) 0 -y = ( (-40) != 300 ) 16512 -y = ( (-40) <= 300 ) 16512 -y = ( (-40) >= 300 ) 0 -y = ( (-40) < 300 ) 16512 -y = ( (-40) > 300 ) 0 -y = ( (-40) ? (-40) : 300 ) 49952 -y = ( x = (-40) ) -4.000000e+01 49952 -y = ( x += (-40) ) -3.685850e+01 1864024851 -y = ( x -= (-40) ) 4.314150e+01 -1864023252 -y = ( x /= (-40) ) -7.853750e-02 -666583392 -y = ( x *= (-40) ) -1.256600e+02 1374405627 -y = ( x ++ ) 4.141500e+00 240533833 -y = ( x -- ) 2.141500e+00 240533833 -y = ( -- x ) 2.141500e+00 240533769 -y = ( ++ x ) 4.141500e+00 -2027208316 -yes if ( (-40) + 300 ) yes() ; else no() -yes if ( (-40) - 300 ) yes() ; else no() -no if ( (-40) / 300 ) yes() ; else no() -yes if ( (-40) * 300 ) yes() ; else no() -yes if ( (-40) || 300 ) yes() ; else no() -yes if ( (-40) && 300 ) yes() ; else no() -yes if ( -(-40) ) yes() ; else no() -no if ( !(-40) ) yes() ; else no() -no if ( (-40) == 300 ) yes() ; else no() -yes if ( (-40) != 300 ) yes() ; else no() -yes if ( (-40) <= 300 ) yes() ; else no() -no if ( (-40) >= 300 ) yes() ; else no() -yes if ( (-40) < 300 ) yes() ; else no() -no if ( (-40) > 300 ) yes() ; else no() -yes if ( (-40) ? (-40) : 300 ) yes() ; else no() -yes if ( x = (-40) ) yes() ; else no() -4.000000e+01 -yes if ( x += (-40) ) yes() ; else no() -3.685850e+01 -yes if ( x -= (-40) ) yes() ; else no() 4.314150e+01 -yes if ( x /= (-40) ) yes() ; else no() -7.853750e-02 -yes if ( x *= (-40) ) yes() ; else no() -1.256600e+02 -yes if ( x ++ ) yes() ; else no() 4.141500e+00 -yes if ( x -- ) yes() ; else no() 2.141500e+00 -yes if ( -- x ) yes() ; else no() 2.141500e+00 -yes if ( ++ x ) yes() ; else no() 4.141500e+00 diff --git a/lang/cem/ctest/ctill/noarg.cem.g b/lang/cem/ctest/ctill/noarg.cem.g deleted file mode 100644 index 39921f471..000000000 --- a/lang/cem/ctest/ctill/noarg.cem.g +++ /dev/null @@ -1,3 +0,0 @@ -The program whose output you are comparing this file with should -not have compiled. -It declares a function, with an argument and without a body. diff --git a/lang/cem/ctest/ctstruct/str.pcc.r b/lang/cem/ctest/ctstruct/str.pcc.r deleted file mode 100644 index a6b5ad356..000000000 --- a/lang/cem/ctest/ctstruct/str.pcc.r +++ /dev/null @@ -1,152 +0,0 @@ -w1 - st2.w1_i 506 - (*st3).w1_i 506 - st1.w1_i 711 - st2.w1_i 711 - es2[2].w1_i 711 - st2.w1_i 577 - st2.w1_i -577 - st1.w1_i 577 -w2 - s2t2: .w2_i 18000 .w2_d 3.141500 - s2t3->w2_d 3.141500 -w3 -s3t2.w3_a[ 0] a -s3t2.w3_a[ 1] b -s3t2.w3_a[ 2] c -s3t2.w3_a[ 3] d -s3t2.w3_a[ 4] e -s3t2.w3_a[ 5] f -s3t2.w3_a[ 6] g -s3t2.w3_a[ 7] h -s3t2.w3_a[ 8] i -s3t2.w3_a[ 9] j -s3t2.w3_a[10] k -s3t2.w3_a[11] l -s3t2.w3_a[12] m -s3t2.w3_a[13] n -s3t2.w3_a[14] o -s3t2.w3_a[15] p -s3t2.w3_a[16] q -s3t2.w3_a[17] r -s3t2.w3_a[18] s -s3t2.w3_a[19] t -s3t2.w3_a[20] u -s3t2.w3_a[21] v -s3t2.w3_a[22] w -s3t2.w3_a[23] x -s3t2.w3_a[24] y -s3t2.w3_a[25] z -s3t2.w3_x 1.000000 -s3t1.w3_a[ 0] A -s3t1.w3_a[ 1] B -s3t1.w3_a[ 2] C -s3t1.w3_a[ 3] D -s3t1.w3_a[ 4] E -s3t1.w3_a[ 5] F -s3t1.w3_a[ 6] G -s3t1.w3_a[ 7] H -s3t1.w3_a[ 8] I -s3t1.w3_a[ 9] J -s3t1.w3_a[10] K -s3t1.w3_a[11] L -s3t1.w3_a[12] M -s3t1.w3_a[13] N -s3t1.w3_a[14] O -s3t1.w3_a[15] P -s3t1.w3_a[16] Q -s3t1.w3_a[17] R -s3t1.w3_a[18] S -s3t1.w3_a[19] T -s3t1.w3_a[20] U -s3t1.w3_a[21] V -s3t1.w3_a[22] W -s3t1.w3_a[23] X -s3t1.w3_a[24] Y -s3t1.w3_a[25] Z -s3t1.w3_x 0.318319 -structure parameters -before -1 -str.w3_a[ 0] 1 -str.w3_a[ 1] 2 -str.w3_a[ 2] 3 -str.w3_a[ 3] 4 -str.w3_a[ 4] 5 -str.w3_a[ 5] 6 -str.w3_a[ 6] 7 -str.w3_a[ 7] 8 -str.w3_a[ 8] 9 -str.w3_a[ 9] 10 -str.w3_a[10] 11 -str.w3_a[11] 12 -str.w3_a[12] 13 -str.w3_a[13] 14 -str.w3_a[14] 15 -str.w3_a[15] 16 -str.w3_a[16] 17 -str.w3_a[17] 18 -str.w3_a[18] 19 -str.w3_a[19] 20 -str.w3_a[20] 21 -str.w3_a[21] 22 -str.w3_a[22] 23 -str.w3_a[23] 24 -str.w3_a[24] 25 -str.w3_a[25] 26 -str.w3_x 2.810000 -after 1000 - -Stucture valued functions -myp.w3_a: - 0 97 - 1 96 - 2 95 - 3 94 - 4 93 - 5 92 - 6 91 - 7 90 - 8 89 - 9 88 - 10 87 - 11 86 - 12 85 - 13 84 - 14 83 - 15 82 - 16 81 - 17 80 - 18 79 - 19 78 - 20 77 - 21 76 - 22 75 - 23 74 - 24 73 - 25 72 - 0 99 - 1 100 - 2 101 - 3 102 - 4 103 - 5 104 - 6 105 - 7 106 - 8 107 - 9 108 - 10 109 - 11 110 - 12 111 - 13 112 - 14 113 - 15 114 - 16 115 - 17 116 - 18 117 - 19 118 - 20 119 - 21 120 - 22 121 - 23 122 - 24 123 - 25 124 diff --git a/lang/cem/ctest/out.std b/lang/cem/ctest/out.std deleted file mode 100644 index ee1b594ad..000000000 --- a/lang/cem/ctest/out.std +++ /dev/null @@ -1,174 +0,0 @@ -Tue May 22 15:12:22 MDT 1984 -***** ctconv -acc conv.c -conv.c -"conv.c", line 41: warning: Overflow in constant expression -running conv.cem -comparing conv -***** ctdecl -acc decl.c -decl.c -running decl.cem -comparing decl -***** ctdivers -acc ops.c -ops.c -running ops.cem -comparing ops -***** cterr -acc bugs.c -bugs.c -"bugs.c", line 92: warning: Overflow in constant expression -running bugs.cem -comparing bugs -9,$c9,$ -< compl_ind -< END ---- -> END -***** ctest1 -acc test.c -test.c -running test.cem -comparing test -***** ctest2 -acc t7.c -t7.c -"t7.c", line 161: warning: statement not reached -"t7.c", line 178: warning: statement not reached -"t7.c", line 182: warning: statement not reached -"t7.c", line 186: warning: statement not reached -"t7.c", line 190: warning: statement not reached -"t7.c", line 194: warning: statement not reached -"t7.c", line 198: warning: statement not reached -"t7.c", line 205: warning: statement not reached -"t7.c", line 207: warning: statement not reached -"t7.c", line 211: warning: statement not reached -"t7.c", line 213: warning: statement not reached -"t7.c", line 287: warning: statement not reached -"t7.c", line 294: warning: statement not reached -"t7.c", line 300: warning: statement not reached -"t7.c", line 307: warning: statement not reached -"t7.c", line 343: warning: statement not reached -"t7.c", line 344: warning: statement not reached -"t7.c", line 345: warning: statement not reached -"t7.c", line 346: warning: statement not reached -"t7.c", line 348: warning: statement not reached -"t7.c", line 452: warning: statement not reached -"t7.c", line 561: warning: statement not reached -"t7.c", line 589: warning: statement not reached -running t7.cem -comparing t7 -***** ctest3 -acc test2.c -test2.c -running test2.cem -comparing test2 -***** ctest5 -acc test1.c -test1.c -"test1.c", line 101: warning: Illegal shift count in constant expression -"test1.c", line 370: warning: illegal pointer combination -"test1.c", line 371: warning: illegal pointer combination -"test1.c", line 372: warning: illegal pointer combination -"test1.c", line 384: warning: illegal pointer combination -"test1.c", line 407: warning: illegal pointer combination -"test1.c", line 408: warning: illegal pointer combination -"test1.c", line 409: warning: illegal pointer combination -"test1.c", line 421: warning: illegal pointer combination -running test1.cem -comparing test1 -***** ctgen -`bf.c' is up to date. -acc bf.c -bf.c -running bf.cem -comparing bf -`cel.c' is up to date. -acc cel.c -cel.c -running cel.cem -comparing cel -`clu.c' is up to date. -acc clu.c -clu.c -"clu.c", line 60: warning: Overflow in constant expression -"clu.c", line 66: warning: Overflow in constant expression -running clu.cem -comparing clu -28c28 -< x *= 40000 0 ---- -> x *= 40000 6784 -65c65 -< y = ( x *= 40000 ) 0 0 ---- -> y = ( x *= 40000 ) 6784 6784 -102c102 -< no if ( x *= 40000 ) yes() ; else no() 0 ---- -> yes if ( x *= 40000 ) yes() ; else no() 6784 -`ec.c' is up to date. -acc ec.c -ec.c -"ec.c", line 58: warning: Overflow in constant expression -"ec.c", line 64: warning: Overflow in constant expression -running ec.cem -comparing ec -`ef.c' is up to date. -acc ef.c -ef.c -running ef.cem -comparing ef -`ei.c' is up to date. -acc ei.c -ei.c -"ei.c", line 22: warning: Overflow in constant expression -"ei.c", line 65: warning: Overflow in constant expression -"ei.c", line 108: warning: Overflow in constant expression -running ei.cem -comparing ei -`el.c' is up to date. -acc el.c -el.c -running el.cem -comparing el -`eu.c' is up to date. -acc eu.c -eu.c -"eu.c", line 58: warning: Overflow in constant expression -"eu.c", line 64: warning: Overflow in constant expression -running eu.cem -comparing eu -28c28 -< x *= 40000 0 ---- -> x *= 40000 6784 -65c65 -< y = ( x *= 40000 ) 0 0 ---- -> y = ( x *= 40000 ) 6784 6784 -102c102 -< no if ( x *= 40000 ) yes() ; else no() 0 ---- -> yes if ( x *= 40000 ) yes() ; else no() 6784 -`id.c' is up to date. -acc id.c -id.c -running id.cem -comparing id -`lc.c' is up to date. -acc lc.c -lc.c -"lc.c", line 60: warning: Overflow in constant expression -"lc.c", line 66: warning: Overflow in constant expression -running lc.cem -comparing lc -`ld.c' is up to date. -acc ld.c -ld.c -running ld.cem -comparing ld -`lf.c' is up to date. -acc lf.c -lf.c diff --git a/lang/cem/libcc/.distr b/lang/cem/libcc/.distr new file mode 100644 index 000000000..eb799e928 --- /dev/null +++ b/lang/cem/libcc/.distr @@ -0,0 +1,3 @@ +gen +mon +stdio diff --git a/lang/m2/comp/LLlex.c b/lang/m2/comp/LLlex.c deleted file mode 100644 index 158bc2965..000000000 --- a/lang/m2/comp/LLlex.c +++ /dev/null @@ -1,518 +0,0 @@ -/* L E X I C A L A N A L Y S E R F O R M O D U L A - 2 */ - -#include "debug.h" -#include "idfsize.h" -#include "numsize.h" -#include "strsize.h" - -#include -#include -#include -#include - -#include "input.h" -#include "f_info.h" -#include "Lpars.h" -#include "class.h" -#include "idf.h" -#include "type.h" -#include "LLlex.h" -#include "const.h" -#include "warning.h" - -long str2long(); - -struct token dot, - aside; -struct type *toktype; -int idfsize = IDFSIZE; -#ifdef DEBUG -extern int cntlines; -#endif - -static int eofseen; - -STATIC -SkipComment() -{ - /* Skip Modula-2 comments (* ... *). - Note that comments may be nested (par. 3.5). - */ - register int ch; - register int CommentLevel = 0; - - LoadChar(ch); - for (;;) { - if (class(ch) == STNL) { - LineNumber++; -#ifdef DEBUG - cntlines++; -#endif - } - else if (ch == '(') { - LoadChar(ch); - if (ch == '*') CommentLevel++; - else continue; - } - else if (ch == '*') { - LoadChar(ch); - if (ch == ')') { - CommentLevel--; - if (CommentLevel < 0) break; - } - else continue; - } - else if (ch == EOI) { - lexerror("unterminated comment"); - break; - } - LoadChar(ch); - } -} - -STATIC struct string * -GetString(upto) -{ - /* Read a Modula-2 string, delimited by the character "upto". - */ - register int ch; - register struct string *str = (struct string *) - Malloc((unsigned) sizeof(struct string)); - register char *p; - register int len; - - len = ISTRSIZE; - str->s_str = p = Malloc((unsigned int) ISTRSIZE); - while (LoadChar(ch), ch != upto) { - if (class(ch) == STNL) { - lexerror("newline in string"); - LineNumber++; -#ifdef DEBUG - cntlines++; -#endif - break; - } - if (ch == EOI) { - lexerror("end-of-file in string"); - break; - } - *p++ = ch; - if (p - str->s_str == len) { - str->s_str = Srealloc(str->s_str, - (unsigned int) len + RSTRSIZE); - p = str->s_str + len; - len += RSTRSIZE; - } - } - str->s_length = p - str->s_str; - while (p - str->s_str < len) *p++ = '\0'; - if (str->s_length == 0) str->s_length = 1; - /* ??? string length at least 1 ??? */ - return str; -} - -static char *s_error = "illegal line directive"; - -STATIC int -getch() -{ - register int ch; - - for (;;) { - LoadChar(ch); - if ((ch & 0200) && ch != EOI) { - error("non-ascii '\\%03o' read", ch & 0377); - continue; - } - break; - } - if (ch == EOI) { - eofseen = 1; - return '\n'; - } - return ch; -} - -STATIC -linedirective() { - /* Read a line directive - */ - register int ch; - register int i = 0; - char buf[IDFSIZE + 2]; - register char *c = buf; - - do { /* - * Skip to next digit - * Do not skip newlines - */ - ch = getch(); - if (class(ch) == STNL) { - LineNumber++; - error(s_error); - return; - } - } while (class(ch) != STNUM); - do { - i = i*10 + (ch - '0'); - ch = getch(); - } while (class(ch) == STNUM); - while (ch != '"' && class(ch) != STNL) ch = getch(); - if (ch == '"') { - c = buf; - do { - *c++ = ch = getch(); - if (class(ch) == STNL) { - LineNumber++; - error(s_error); - return; - } - } while (ch != '"'); - *--c = '\0'; - do { - ch = getch(); - } while (class(ch) != STNL); - /* - * Remember the file name - */ - if (!eofseen && strcmp(FileName,buf)) { - FileName = Salloc(buf,(unsigned) strlen(buf) + 1); - } - } - if (eofseen) { - error(s_error); - return; - } - LineNumber = i; -} - -int -LLlex() -{ - /* LLlex() is the Lexical Analyzer. - The putting aside of tokens is taken into account. - */ - register struct token *tk = ˙ - char buf[(IDFSIZE > NUMSIZE ? IDFSIZE : NUMSIZE) + 2]; - register int ch, nch; - - toktype = error_type; - - if (ASIDE) { /* a token is put aside */ - *tk = aside; - ASIDE = 0; - return tk->tk_symb; - } - - tk->tk_lineno = LineNumber; - -again2: - if (eofseen) { - eofseen = 0; - ch = EOI; - } - else { -again: - LoadChar(ch); -again1: - if ((ch & 0200) && ch != EOI) { - error("non-ascii '\\%03o' read", ch & 0377); - goto again; - } - } - - switch (class(ch)) { - - case STNL: - LineNumber++; -#ifdef DEBUG - cntlines++; -#endif - tk->tk_lineno++; - LoadChar(ch); - if (ch != '#') goto again1; - linedirective(); - goto again2; - - case STSKIP: - goto again; - - case STGARB: - if ((unsigned) ch - 040 < 0137) { - lexerror("garbage char %c", ch); - } - else lexerror("garbage char \\%03o", ch); - goto again; - - case STSIMP: - if (ch == '(') { - LoadChar(nch); - if (nch == '*') { - SkipComment(); - goto again; - } - else if (nch == EOI) eofseen = 1; - else PushBack(); - } - return tk->tk_symb = ch; - - case STCOMP: - LoadChar(nch); - switch (ch) { - - case '.': - if (nch == '.') { - return tk->tk_symb = UPTO; - } - break; - - case ':': - if (nch == '=') { - return tk->tk_symb = BECOMES; - } - break; - - case '<': - if (nch == '=') { - return tk->tk_symb = LESSEQUAL; - } - if (nch == '>') { - lexwarning(W_STRICT, "'<>' is old-fashioned; use '#'"); - return tk->tk_symb = '#'; - } - break; - - case '>': - if (nch == '=') { - return tk->tk_symb = GREATEREQUAL; - } - break; - - default : - crash("(LLlex, STCOMP)"); - } - if (nch == EOI) eofseen = 1; - else PushBack(); - return tk->tk_symb = ch; - - case STIDF: - { - register char *tag = &buf[0]; - register struct idf *id; - - do { - if (tag - buf < idfsize) *tag++ = ch; - LoadChar(ch); - } while(in_idf(ch)); - - if (ch == EOI) eofseen = 1; - else PushBack(); - *tag++ = '\0'; - - tk->TOK_IDF = id = str2idf(buf, 1); - return tk->tk_symb = id->id_reserved ? id->id_reserved : IDENT; - } - - case STSTR: { - register struct string *str = GetString(ch); - - if (str->s_length == 1) { - tk->TOK_INT = *(str->s_str) & 0377; - toktype = char_type; - free(str->s_str); - free((char *) str); - } - else { - tk->tk_data.tk_str = str; - toktype = standard_type(T_STRING, 1, str->s_length); - } - return tk->tk_symb = STRING; - } - - case STNUM: - { - /* The problem arising with the "parsing" of a number - is that we don't know the base in advance so we - have to read the number with the help of a rather - complex finite automaton. - */ - enum statetp {Oct,Hex,Dec,OctEndOrHex,End,OptReal,Real}; - register enum statetp state; - register int base; - register char *np = &buf[1]; - /* allow a '-' to be added */ - - buf[0] = '-'; - *np++ = ch; - state = is_oct(ch) ? Oct : Dec; - LoadChar(ch); - for (;;) { - switch(state) { - case Oct: - while (is_oct(ch)) { - if (np < &buf[NUMSIZE]) *np++ = ch; - LoadChar(ch); - } - if (ch == 'B' || ch == 'C') { - base = 8; - state = OctEndOrHex; - break; - } - /* Fall Through */ - case Dec: - base = 10; - while (is_dig(ch)) { - if (np < &buf[NUMSIZE]) { - *np++ = ch; - } - LoadChar(ch); - } - if (is_hex(ch)) state = Hex; - else if (ch == '.') state = OptReal; - else { - state = End; - if (ch == 'H') base = 16; - else if (ch == EOI) eofseen = 1; - else PushBack(); - } - break; - - case Hex: - while (is_hex(ch)) { - if (np < &buf[NUMSIZE]) *np++ = ch; - LoadChar(ch); - } - base = 16; - state = End; - if (ch != 'H') { - lexerror("H expected after hex number"); - if (ch == EOI) eofseen = 1; - else PushBack(); - } - break; - - case OctEndOrHex: - if (np < &buf[NUMSIZE]) *np++ = ch; - LoadChar(ch); - if (ch == 'H') { - base = 16; - state = End; - break; - } - if (is_hex(ch)) { - state = Hex; - break; - } - if (ch == EOI) eofseen = 1; - else PushBack(); - ch = *--np; - *np++ = '\0'; - base = 8; - /* Fall through */ - - case End: - *np = '\0'; - if (np >= &buf[NUMSIZE]) { - tk->TOK_INT = 1; - lexerror("constant too long"); - } - else { - np = &buf[1]; - while (*np == '0') np++; - tk->TOK_INT = str2long(np, base); - if (strlen(np) > 14 /* ??? */ || - tk->TOK_INT < 0) { -lexwarning(W_ORDINARY, "overflow in constant"); - } - } - if (ch == 'C' && base == 8) { - toktype = char_type; - if (tk->TOK_INT<0 || tk->TOK_INT>255) { -lexwarning(W_ORDINARY, "character constant out of range"); - } - } - else if (tk->TOK_INT>=0 && - tk->TOK_INT<=max_int) { - toktype = intorcard_type; - } - else toktype = card_type; - return tk->tk_symb = INTEGER; - - case OptReal: - /* The '.' could be the first of the '..' - token. At this point, we need a - look-ahead of two characters. - */ - LoadChar(ch); - if (ch == '.') { - /* Indeed the '..' token - */ - PushBack(); - PushBack(); - state = End; - base = 10; - break; - } - state = Real; - break; - } - if (state == Real) break; - } - - /* a real real constant */ - if (np < &buf[NUMSIZE]) *np++ = '.'; - - while (is_dig(ch)) { - /* Fractional part - */ - if (np < &buf[NUMSIZE]) *np++ = ch; - LoadChar(ch); - } - - if (ch == 'E') { - /* Scale factor - */ - if (np < &buf[NUMSIZE]) *np++ = 'E'; - LoadChar(ch); - if (ch == '+' || ch == '-') { - /* Signed scalefactor - */ - if (np < &buf[NUMSIZE]) *np++ = ch; - LoadChar(ch); - } - if (is_dig(ch)) { - do { - if (np < &buf[NUMSIZE]) *np++ = ch; - LoadChar(ch); - } while (is_dig(ch)); - } - else { - lexerror("bad scale factor"); - } - } - - *np++ = '\0'; - if (ch == EOI) eofseen = 1; - else PushBack(); - - if (np >= &buf[NUMSIZE]) { - tk->TOK_REL = Salloc("0.0", 5); - lexerror("floating constant too long"); - } - else tk->TOK_REL = Salloc(buf, np - buf) + 1; - toktype = real_type; - return tk->tk_symb = REAL; - - /*NOTREACHED*/ - } - - case STEOI: - return tk->tk_symb = -1; - - case STCHAR: - default: - crash("(LLlex) Impossible character class"); - /*NOTREACHED*/ - } - /*NOTREACHED*/ -} diff --git a/lang/m2/comp/LLlex.h b/lang/m2/comp/LLlex.h deleted file mode 100644 index c6cc4a406..000000000 --- a/lang/m2/comp/LLlex.h +++ /dev/null @@ -1,36 +0,0 @@ -/* T O K E N D E S C R I P T O R D E F I N I T I O N */ - -/* Structure to store a string constant -*/ -struct string { - arith s_length; /* length of a string */ - char *s_str; /* the string itself */ -}; - -/* Token structure. Keep it small, as it is part of a parse-tree node -*/ -struct token { - short tk_symb; /* token itself */ - unsigned short tk_lineno; /* linenumber on which it occurred */ - union { - struct idf *tk_idf; /* IDENT */ - struct string *tk_str; /* STRING */ - arith tk_int; /* INTEGER */ - char *tk_real; /* REAL */ - arith *tk_set; /* only used in parse tree node */ - struct def *tk_def; /* only used in parse tree node */ - label tk_lab; /* only used in parse tree node */ - } tk_data; -}; - -#define TOK_IDF tk_data.tk_idf -#define TOK_STR tk_data.tk_str->s_str -#define TOK_SLE tk_data.tk_str->s_length -#define TOK_INT tk_data.tk_int -#define TOK_REL tk_data.tk_real - -extern struct token dot, aside; -extern struct type *toktype; - -#define DOT dot.tk_symb -#define ASIDE aside.tk_symb diff --git a/lang/m2/comp/LLmessage.c b/lang/m2/comp/LLmessage.c deleted file mode 100644 index a63866212..000000000 --- a/lang/m2/comp/LLmessage.c +++ /dev/null @@ -1,58 +0,0 @@ -/* S Y N T A X E R R O R R E P O R T I N G */ - -/* Defines the LLmessage routine. LLgen-generated parsers require the - existence of a routine of that name. - The routine must do syntax-error reporting and must be able to - insert tokens in the token stream. -*/ - -#include -#include -#include - -#include "idf.h" -#include "LLlex.h" -#include "Lpars.h" - -extern char *symbol2str(); -extern struct idf *gen_anon_idf(); - -LLmessage(tk) - register int tk; -{ - if (tk > 0) { - /* if (tk > 0), it represents the token to be inserted. - */ - register struct token *dotp = ˙ - - error("%s missing", symbol2str(tk)); - - aside = *dotp; - - dotp->tk_symb = tk; - - switch (tk) { - /* The operands need some body */ - case IDENT: - dotp->TOK_IDF = gen_anon_idf(); - break; - case STRING: - dotp->tk_data.tk_str = (struct string *) - Malloc(sizeof (struct string)); - dotp->TOK_SLE = 1; - dotp->TOK_STR = Salloc("", 1); - break; - case INTEGER: - dotp->TOK_INT = 1; - break; - case REAL: - dotp->TOK_REL = Salloc("0.0", 4); - break; - } - } - else if (tk < 0) { - error("garbage at end of program"); - } - else error("%s deleted", symbol2str(dot.tk_symb)); -} - diff --git a/lang/m2/comp/MakeVersion b/lang/m2/comp/MakeVersion deleted file mode 100755 index 6b9d7f5e9..000000000 --- a/lang/m2/comp/MakeVersion +++ /dev/null @@ -1,8 +0,0 @@ -V=`cat Version.c` -VERSION=`expr "$V" ':' '.*[0-9][0-9]*\.\([0-9][0-9]*\).*'` -NEWVERSION=`expr $VERSION + 1` -sed "s/\.$VERSION/.$NEWVERSION/" < Version.c > tmp$$ -mv tmp$$ Version.c -CM "$*" -V=`cat Version.c` -SV > ../versions/V`expr "$V" ':' '.*\([0-9][0-9]*\.[0-9][0-9]*\).*'` diff --git a/lang/m2/comp/Makefile b/lang/m2/comp/Makefile deleted file mode 100644 index a38abbe0f..000000000 --- a/lang/m2/comp/Makefile +++ /dev/null @@ -1,167 +0,0 @@ -# make modula-2 "compiler" -EMHOME = ../../.. -MHDIR = $(EMHOME)/modules/h -PKGDIR = $(EMHOME)/modules/pkg -LIBDIR = $(EMHOME)/modules/lib -OBJECTCODE = $(LIBDIR)/libemk.a -LLGEN = $(EMHOME)/bin/LLgen -MKDEP = $(EMHOME)/bin/mkdep -PRID = $(EMHOME)/bin/prid -CID = $(EMHOME)/bin/cid -CURRDIR = . - -INCLUDES = -I$(MHDIR) -I$(EMHOME)/h -I$(PKGDIR) - -GFILES = tokenfile.g program.g declar.g expression.g statement.g -LLGENOPTIONS = -PROFILE = -CFLAGS = $(PROFILE) $(INCLUDES) -DSTATIC= -LINTFLAGS = -DSTATIC= -DNORCSID -MALLOC = $(LIBDIR)/malloc.o -LFLAGS = $(PROFILE) -LSRC = tokenfile.c program.c declar.c expression.c statement.c -LOBJ = tokenfile.o program.o declar.o expression.o statement.o -CSRC = LLlex.c LLmessage.c char.c error.c main.c \ - symbol2str.c tokenname.c idf.c input.c type.c def.c \ - scope.c misc.c enter.c defmodule.c typequiv.c node.c \ - cstoper.c chk_expr.c options.c walk.c casestat.c desig.c \ - code.c tmpvar.c lookup.c Version.c next.c -COBJ = LLlex.o LLmessage.o char.o error.o main.o \ - symbol2str.o tokenname.o idf.o input.o type.o def.o \ - scope.o misc.o enter.o defmodule.o typequiv.o node.o \ - cstoper.o chk_expr.o options.o walk.o casestat.o desig.o \ - code.o tmpvar.o lookup.o Version.o next.o -SRC = $(CSRC) $(LSRC) Lpars.c -OBJ = $(COBJ) $(LOBJ) Lpars.o - -# Keep the next entries up to date! -GENCFILES= tokenfile.c \ - program.c declar.c expression.c statement.c \ - symbol2str.c char.c Lpars.c casestat.c tmpvar.c scope.c next.c -GENGFILES= tokenfile.g -GENHFILES= errout.h\ - idfsize.h numsize.h strsize.h target_sizes.h \ - inputtype.h maxset.h ndir.h density.h\ - def.h debugcst.h type.h Lpars.h node.h -HFILES= LLlex.h\ - chk_expr.h class.h const.h debug.h desig.h f_info.h idf.h\ - input.h main.h misc.h scope.h standards.h tokenname.h\ - walk.h warning.h $(GENHFILES) -# -GENFILES = $(GENGFILES) $(GENCFILES) $(GENHFILES) -NEXTFILES = def.H type.H node.H scope.C tmpvar.C casestat.C - -#EXCLEXCLEXCLEXCL - -all: Cfiles - sh -c 'if $(CC) nmclash.c > /dev/null 2>&1 ; then make $(CURRDIR)/main ; else sh Resolve main ; fi' - @rm -f nmclash.o a.out - -install: all - cp $(CURRDIR)/main $(EMHOME)/lib/em_m2 - -clean: - rm -f $(OBJ) $(GENFILES) LLfiles hfiles Cfiles tab clashes $(CURRDIR)/main - (cd .. ; rm -rf Xsrc) - -lint: Cfiles - sh -c 'if $(CC) nmclash.c > /dev/null 2>&1 ; then make Xlint ; else sh Resolve Xlint ; fi' - @rm -f nmclash.o a.out - -longnames: $(SRC) $(HFILES) - sh -c 'if test -f longnames ; then $(PRID) -l7 longnames $? > Xlongnames ; mv Xlongnames longnames ; else $(PRID) -l7 $? > longnames ; fi' - -# entry points not to be used directly - -Cfiles: hfiles LLfiles $(GENCFILES) $(GENHFILES) Makefile - echo $(SRC) $(HFILES) > Cfiles - -LLfiles: $(GFILES) - $(LLGEN) $(LLGENOPTIONS) $(GFILES) - @touch LLfiles - -hfiles: Parameters make.hfiles - make.hfiles Parameters - touch hfiles - -tokenfile.g: tokenname.c make.tokfile - make.tokfile tokenfile.g - -symbol2str.c: tokenname.c make.tokcase - make.tokcase symbol2str.c - -.SUFFIXES: .H .h -.H.h: - ./make.allocd < $*.H > $*.h - -.SUFFIXES: .C .c -.C.c: - ./make.allocd < $*.C > $*.c - -def.h: make.allocd -type.h: make.allocd -node.h: make.allocd -scope.c: make.allocd -tmpvar.c: make.allocd -casestat.c: make.allocd - -next.c: $(NEXTFILES) ./make.next - ./make.next $(NEXTFILES) > next.c - -char.c: char.tab tab - tab -fchar.tab >char.c - -tab: - $(CC) tab.c -o tab - -depend: - sed '/^#AUTOAUTO/,$$d' Makefile > Makefile.new - echo '#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO' >> Makefile.new - $(MKDEP) $(SRC) |\ - sed 's/\.c:/\.o:/' >> Makefile.new - mv Makefile Makefile.old - mv Makefile.new Makefile - -#INCLINCLINCLINCL - -Xlint: - lint $(INCLUDES) $(LINTFLAGS) $(SRC) - -$(CURRDIR)/main: $(OBJ) - $(CC) $(LFLAGS) $(OBJ) $(LIBDIR)/libem_mes.a $(OBJECTCODE) $(LIBDIR)/libinput.a $(LIBDIR)/libassert.a $(LIBDIR)/liballoc.a $(MALLOC) $(LIBDIR)/libprint.a $(LIBDIR)/libstring.a $(LIBDIR)/libsystem.a -o $(CURRDIR)/main - size $(CURRDIR)/main - -#AUTOAUTOAUTOAUTOAUTOAUTOAUTOAUTO -LLlex.o: LLlex.h Lpars.h class.h const.h debug.h debugcst.h f_info.h idf.h idfsize.h input.h inputtype.h numsize.h strsize.h type.h warning.h -LLmessage.o: LLlex.h Lpars.h idf.h -char.o: class.h -error.o: LLlex.h debug.h debugcst.h errout.h f_info.h input.h inputtype.h main.h node.h warning.h -main.o: LLlex.h Lpars.h debug.h debugcst.h def.h f_info.h idf.h input.h inputtype.h ndir.h node.h scope.h standards.h tokenname.h type.h warning.h -symbol2str.o: Lpars.h -tokenname.o: Lpars.h idf.h tokenname.h -idf.o: idf.h -input.o: def.h f_info.h idf.h input.h inputtype.h scope.h -type.o: LLlex.h const.h debug.h debugcst.h def.h idf.h maxset.h node.h scope.h target_sizes.h type.h walk.h -def.o: LLlex.h Lpars.h debug.h debugcst.h def.h idf.h main.h node.h scope.h type.h -scope.o: LLlex.h debug.h debugcst.h def.h idf.h node.h scope.h type.h -misc.o: LLlex.h f_info.h idf.h misc.h node.h -enter.o: LLlex.h debug.h debugcst.h def.h idf.h main.h misc.h node.h scope.h type.h -defmodule.o: LLlex.h Lpars.h debug.h debugcst.h def.h f_info.h idf.h input.h inputtype.h main.h misc.h node.h scope.h type.h -typequiv.o: LLlex.h debug.h debugcst.h def.h node.h type.h warning.h -node.o: LLlex.h debug.h debugcst.h def.h node.h type.h -cstoper.o: LLlex.h Lpars.h debug.h debugcst.h idf.h node.h standards.h target_sizes.h type.h warning.h -chk_expr.o: LLlex.h Lpars.h chk_expr.h const.h debug.h debugcst.h def.h idf.h misc.h node.h scope.h standards.h type.h warning.h -options.o: idfsize.h main.h ndir.h type.h warning.h -walk.o: LLlex.h Lpars.h chk_expr.h debug.h debugcst.h def.h desig.h f_info.h idf.h main.h node.h scope.h type.h walk.h warning.h -casestat.o: LLlex.h Lpars.h debug.h debugcst.h density.h desig.h node.h type.h walk.h -desig.o: LLlex.h debug.h debugcst.h def.h desig.h node.h scope.h type.h -code.o: LLlex.h Lpars.h debug.h debugcst.h def.h desig.h node.h scope.h standards.h type.h walk.h -tmpvar.o: debug.h debugcst.h def.h main.h scope.h type.h -lookup.o: LLlex.h debug.h debugcst.h def.h idf.h misc.h node.h scope.h type.h -next.o: debug.h debugcst.h -tokenfile.o: Lpars.h -program.o: LLlex.h Lpars.h debug.h debugcst.h def.h f_info.h idf.h main.h node.h scope.h type.h warning.h -declar.o: LLlex.h Lpars.h chk_expr.h debug.h debugcst.h def.h idf.h main.h misc.h node.h scope.h type.h warning.h -expression.o: LLlex.h Lpars.h chk_expr.h const.h debug.h debugcst.h def.h idf.h node.h type.h warning.h -statement.o: LLlex.h Lpars.h def.h idf.h node.h scope.h type.h -Lpars.o: Lpars.h diff --git a/lang/m2/comp/Parameters b/lang/m2/comp/Parameters deleted file mode 100644 index fecdc8a73..000000000 --- a/lang/m2/comp/Parameters +++ /dev/null @@ -1,65 +0,0 @@ -!File: errout.h -#define ERROUT STDERR /* file pointer for writing messages */ -#define MAXERR_LINE 100 /* maximum number of error messages given - on the same input line. */ - - -!File: idfsize.h -#define IDFSIZE 128 /* maximum significant length of an identifier */ - - -!File: numsize.h -#define NUMSIZE 256 /* maximum length of a numeric constant */ - - -!File: strsize.h -#define ISTRSIZE 32 /* minimum number of bytes allocated for - storing a string */ -#define RSTRSIZE 8 /* step size in enlarging the memory for - the storage of a string */ - - -!File: target_sizes.h -#define MAXSIZE 8 /* the maximum of the SZ_* constants */ - -/* target machine sizes */ -#define SZ_CHAR (arith)1 -#define SZ_SHORT (arith)2 -#define SZ_WORD (arith)4 -#define SZ_INT (arith)4 -#define SZ_LONG (arith)4 -#define SZ_FLOAT (arith)4 -#define SZ_DOUBLE (arith)8 -#define SZ_POINTER (arith)4 - -/* target machine alignment requirements */ -#define AL_CHAR 1 -#define AL_SHORT (int)SZ_SHORT -#define AL_WORD (int)SZ_WORD -#define AL_INT (int)SZ_WORD -#define AL_LONG (int)SZ_WORD -#define AL_FLOAT (int)SZ_WORD -#define AL_DOUBLE (int)SZ_WORD -#define AL_POINTER (int)SZ_WORD -#define AL_STRUCT 1 -#define AL_UNION 1 - - -!File: debugcst.h -#define DEBUG 1 /* perform various self-tests */ - -!File: inputtype.h -#define INP_READ_IN_ONE 1 /* read input file in one */ - - -!File: maxset.h -#define MAXSET 1024 /* maximum number of elements in a set, - but what is a reasonable choice ??? - */ - -!File: ndir.h -#define NDIRS 16 /* maximum number of directories searched */ - - -!File: density.h -#define DENSITY 3 /* see casestat.C for an explanation */ diff --git a/lang/m2/comp/Resolve b/lang/m2/comp/Resolve deleted file mode 100755 index 388b55dfa..000000000 --- a/lang/m2/comp/Resolve +++ /dev/null @@ -1,54 +0,0 @@ -: create a directory Xsrc with name clashes resolved -: and run make in that directory - -case $# in -1) - ;; -*) echo "$0: one argument expected" 1>&2 - exit 1 - ;; -esac -currdir=`pwd` -case $1 in -main) target=$currdir/$1 - ;; -Xlint) target=$1 - ;; -*) echo "$0: $1: Illegal argument" 1>&2 - exit 1 - ;; -esac -if test -d ../Xsrc -then - : -else mkdir ../Xsrc -fi -make longnames -: remove code generating routines from the clashes list as they are defines. -: code generating routine names start with C_ -sed '/^C_/d' < longnames > tmp$$ -cclash -c -l7 tmp$$ > ../Xsrc/Xclashes -rm -f tmp$$ -PW=`pwd` -cd ../Xsrc -if cmp -s Xclashes clashes -then - : -else - mv Xclashes clashes -fi -rm -f Makefile -ed - $PW/Makefile <<'EOF' -/^#EXCLEXCL/,/^#INCLINCL/d -w Makefile -q -EOF -for i in `cat $PW/Cfiles` -do - cat >> Makefile < $i -EOF -done -make CURRDIR=$currdir $target diff --git a/lang/m2/comp/Version.c b/lang/m2/comp/Version.c deleted file mode 100644 index 129bf329c..000000000 --- a/lang/m2/comp/Version.c +++ /dev/null @@ -1 +0,0 @@ -static char Version[] = "ACK Modula-2 compiler Version 0.10"; diff --git a/lang/m2/comp/casestat.C b/lang/m2/comp/casestat.C deleted file mode 100644 index 63913e73e..000000000 --- a/lang/m2/comp/casestat.C +++ /dev/null @@ -1,309 +0,0 @@ -/* C A S E S T A T E M E N T C O D E G E N E R A T I O N */ - -/* Generation of case statements is done by first creating a - description structure for the statement, build a list of the - case-labels, then generating a case description in the code, - and generating either CSA or CSB, and then generating code for the - cases themselves. -*/ - -#include "debug.h" - -#include -#include -#include -#include -#include - -#include "Lpars.h" -#include "type.h" -#include "LLlex.h" -#include "node.h" -#include "desig.h" -#include "walk.h" - -#include "density.h" - -struct switch_hdr { - struct switch_hdr *next; /* in the free list */ - label sh_break; /* label of statement after this one */ - label sh_default; /* label of ELSE part, or 0 */ - int sh_nrofentries; /* number of cases */ - struct type *sh_type; /* type of case expression */ - arith sh_lowerbd; /* lowest case label */ - arith sh_upperbd; /* highest case label */ - struct case_entry *sh_entries; /* the cases with their generated - labels - */ -}; - -/* STATICALLOCDEF "switch_hdr" 5 */ - -struct case_entry { - struct case_entry *next; /* next in list */ - label ce_label; /* generated label */ - arith ce_value; /* value of case label */ -}; - -/* STATICALLOCDEF "case_entry" 20 */ - -/* The constant DENSITY determines when CSA and when CSB instructions - are generated. Reasonable values are: 2, 3, 4. - On machines that have lots of address space and memory, higher values - might also be reasonable. On these machines the density of jump tables - may be lower. -*/ -#define compact(nr, low, up) (nr != 0 && (up - low) / nr <= DENSITY) - -CaseCode(nd, exitlabel) - struct node *nd; - label exitlabel; -{ - /* Check the expression, stack a new case header and - fill in the necessary fields. - "exitlabel" is the exit-label of the closest enclosing - LOOP-statement, or 0. - */ - register struct switch_hdr *sh = new_switch_hdr(); - register struct node *pnode = nd; - register struct case_entry *ce; - register arith val; - label CaseDescrLab; - int casecnt = 0; - - assert(pnode->nd_class == Stat && pnode->nd_symb == CASE); - - WalkExpr(pnode->nd_left); /* evaluate case expression */ - sh->sh_type = pnode->nd_left->nd_type; - sh->sh_break = ++text_label; - - /* Now, create case label list - */ - while (pnode->nd_right) { - pnode = pnode->nd_right; - if (pnode->nd_class == Link && pnode->nd_symb == '|') { - if (pnode->nd_left) { - /* non-empty case - */ - pnode->nd_lab = ++text_label; - casecnt++; - if (! AddCases(sh, /* to descriptor */ - pnode->nd_left->nd_left, - /* of case labels */ - pnode->nd_lab - /* and code label */ - )) { - FreeSh(sh); - return; - } - } - } - else { - /* Else part - */ - - sh->sh_default = ++text_label; - break; - } - } - - if (!casecnt) { - /* There were no cases, so we have to check the case-expression - here - */ - if (! (sh->sh_type->tp_fund & T_DISCRETE)) { - node_error(nd, "illegal type in CASE-expression"); - FreeSh(sh); - return; - } - } - - /* Now generate code for the switch itself - First the part that CSA and CSB descriptions have in common. - */ - CaseDescrLab = ++data_label; /* the rom must have a label */ - C_df_dlb(CaseDescrLab); - if (sh->sh_default) C_rom_ilb(sh->sh_default); - else C_rom_ucon("0", pointer_size); - if (compact(sh->sh_nrofentries, sh->sh_lowerbd, sh->sh_upperbd)) { - /* CSA - */ - C_rom_cst(sh->sh_lowerbd); - C_rom_cst(sh->sh_upperbd - sh->sh_lowerbd); - ce = sh->sh_entries; - for (val = sh->sh_lowerbd; val <= sh->sh_upperbd; val++) { - assert(ce); - if (val == ce->ce_value) { - C_rom_ilb(ce->ce_label); - ce = ce->next; - } - else if (sh->sh_default) C_rom_ilb(sh->sh_default); - else C_rom_ucon("0", pointer_size); - } - C_lae_dlb(CaseDescrLab, (arith)0); /* perform the switch */ - C_csa(word_size); - } - else { - /* CSB - */ - C_rom_cst((arith)sh->sh_nrofentries); - for (ce = sh->sh_entries; ce; ce = ce->next) { - /* generate the entries: value + prog.label - */ - C_rom_cst(ce->ce_value); - C_rom_ilb(ce->ce_label); - } - C_lae_dlb(CaseDescrLab, (arith)0); /* perform the switch */ - C_csb(word_size); - } - - /* Now generate code for the cases - */ - pnode = nd; - while (pnode->nd_right) { - pnode = pnode->nd_right; - if (pnode->nd_class == Link && pnode->nd_symb == '|') { - if (pnode->nd_left) { - C_df_ilb(pnode->nd_lab); - WalkNode(pnode->nd_left->nd_right, exitlabel); - C_bra(sh->sh_break); - } - } - else { - /* Else part - */ - assert(sh->sh_default != 0); - - C_df_ilb(sh->sh_default); - WalkNode(pnode, exitlabel); - break; - } - } - - C_df_ilb(sh->sh_break); - FreeSh(sh); -} - -FreeSh(sh) - register struct switch_hdr *sh; -{ - /* free the allocated switch structure - */ - register struct case_entry *ce; - - ce = sh->sh_entries; - while (ce) { - struct case_entry *tmp = ce->next; - - free_case_entry(ce); - ce = tmp; - } - - free_switch_hdr(sh); -} - -AddCases(sh, node, lbl) - struct switch_hdr *sh; - register struct node *node; - label lbl; -{ - /* Add case labels to the case label list - */ - register arith v1, v2; - - if (node->nd_class == Link) { - if (node->nd_symb == UPTO) { - assert(node->nd_left->nd_class == Value); - assert(node->nd_right->nd_class == Value); - - v2 = node->nd_right->nd_INT; - node->nd_type = node->nd_left->nd_type; - for (v1 = node->nd_left->nd_INT; v1 <= v2; v1++) { - node->nd_INT = v1; - if (! AddOneCase(sh, node, lbl)) return 0; - } - return 1; - } - - assert(node->nd_symb == ','); - return AddCases(sh, node->nd_left, lbl) && - AddCases(sh, node->nd_right, lbl); - } - - assert(node->nd_class == Value); - return AddOneCase(sh, node, lbl); -} - -AddOneCase(sh, node, lbl) - register struct switch_hdr *sh; - register struct node *node; - label lbl; -{ - register struct case_entry *ce = new_case_entry(); - register struct case_entry *c1 = sh->sh_entries, *c2 = 0; - - ce->ce_label = lbl; - ce->ce_value = node->nd_INT; - if (! TstCompat(sh->sh_type, node->nd_type)) { - node_error(node, "type incompatibility in case"); - free_case_entry(ce); - return 0; - } - if (sh->sh_entries == 0) { - /* first case entry - */ - ce->next = (struct case_entry *) 0; - sh->sh_entries = ce; - sh->sh_lowerbd = sh->sh_upperbd = ce->ce_value; - sh->sh_nrofentries = 1; - } - else { - /* second etc. case entry - find the proper place to put ce into the list - */ - - if (ce->ce_value < sh->sh_lowerbd) { - sh->sh_lowerbd = ce->ce_value; - } - else if (ce->ce_value > sh->sh_upperbd) { - sh->sh_upperbd = ce->ce_value; - } - while (c1 && c1->ce_value < ce->ce_value) { - c2 = c1; - c1 = c1->next; - } - /* At this point three cases are possible: - 1: c1 != 0 && c2 != 0: - insert ce somewhere in the middle - 2: c1 != 0 && c2 == 0: - insert ce right after the head - 3: c1 == 0 && c2 != 0: - append ce to last element - The case c1 == 0 && c2 == 0 cannot occur, since - the list is guaranteed not to be empty. - */ - if (c1) { - if (c1->ce_value == ce->ce_value) { -node_error(node, "multiple case entry for value %ld", ce->ce_value); - free_case_entry(ce); - return 0; - } - if (c2) { - ce->next = c2->next; - c2->next = ce; - } - else { - ce->next = sh->sh_entries; - sh->sh_entries = ce; - } - } - else { - assert(c2); - - ce->next = (struct case_entry *) 0; - c2->next = ce; - } - (sh->sh_nrofentries)++; - } - return 1; -} diff --git a/lang/m2/comp/char.tab b/lang/m2/comp/char.tab deleted file mode 100644 index e4f57402f..000000000 --- a/lang/m2/comp/char.tab +++ /dev/null @@ -1,54 +0,0 @@ -% character tables for mod2 compiler -% $Header$ -%S129 -%F %s, -% -% CHARACTER CLASSES -% -%C -STGARB:\000-\200 -STSKIP: \r\t -STNL:\012\013\014 -STSIMP:#&()*+,-/;=[]^{|}~ -STCOMP:.:<> -STIDF:a-zA-Z -STSTR:"' -STNUM:0-9 -STEOI:\200 -%T#include "class.h" -%Tchar tkclass[] = { -%p -%T}; -% -% INIDF -% -%C -1:a-zA-Z0-9 -%Tchar inidf[] = { -%F %s, -%p -%T}; -% -% ISDIG -% -%C -1:0-9 -%Tchar isdig[] = { -%p -%T}; -% -% ISHEX -% -%C -1:a-fA-F -%Tchar ishex[] = { -%p -%T}; -% -% ISOCT -% -%C -1:0-7 -%Tchar isoct[] = { -%p -%T}; diff --git a/lang/m2/comp/chk_expr.c b/lang/m2/comp/chk_expr.c deleted file mode 100644 index 401571d5f..000000000 --- a/lang/m2/comp/chk_expr.c +++ /dev/null @@ -1,1223 +0,0 @@ -/* E X P R E S S I O N C H E C K I N G */ - -/* Check expressions, and try to evaluate them as far as possible. -*/ - -#include "debug.h" - -#include -#include -#include -#include - -#include "Lpars.h" -#include "idf.h" -#include "type.h" -#include "def.h" -#include "LLlex.h" -#include "node.h" -#include "scope.h" -#include "const.h" -#include "standards.h" -#include "chk_expr.h" -#include "misc.h" -#include "warning.h" - -extern char *symbol2str(); - -STATIC -Xerror(nd, mess, edf) - struct node *nd; - char *mess; - register struct def *edf; -{ - if (edf) { - if (edf->df_kind != D_ERROR) { - node_error(nd,"\"%s\": %s", edf->df_idf->id_text, mess); - } - } - else node_error(nd, "%s", mess); -} - -int -ChkVariable(expp) - register struct node *expp; -{ - /* Check that "expp" indicates an item that can be - assigned to. - */ - - if (! ChkDesignator(expp)) return 0; - - if (expp->nd_class == Def && - !(expp->nd_def->df_kind & (D_FIELD|D_VARIABLE))) { - Xerror(expp, "variable expected", expp->nd_def); - return 0; - } - - return 1; -} - -STATIC int -ChkArrow(expp) - register struct node *expp; -{ - /* Check an application of the '^' operator. - The operand must be a variable of a pointer type. - */ - register struct type *tp; - - assert(expp->nd_class == Arrow); - assert(expp->nd_symb == '^'); - - expp->nd_type = error_type; - - if (! ChkVariable(expp->nd_right)) return 0; - - tp = expp->nd_right->nd_type; - - if (tp->tp_fund != T_POINTER) { - node_error(expp, "\"^\": illegal operand"); - return 0; - } - - expp->nd_type = RemoveEqual(PointedtoType(tp)); - return 1; -} - -STATIC int -ChkArr(expp) - register struct node *expp; -{ - /* Check an array selection. - The left hand side must be a variable of an array type, - and the right hand side must be an expression that is - assignment compatible with the array-index. - */ - - register struct type *tpl, *tpr; - int retval; - - assert(expp->nd_class == Arrsel); - assert(expp->nd_symb == '['); - - expp->nd_type = error_type; - - retval = ChkVariable(expp->nd_left) & ChkExpression(expp->nd_right); - - tpl = expp->nd_left->nd_type; - tpr = expp->nd_right->nd_type; - if (tpl == error_type || tpr == error_type) return 0; - - if (tpl->tp_fund != T_ARRAY) { - node_error(expp, "not indexing an ARRAY type"); - return 0; - } - - /* Type of the index must be assignment compatible with - the index type of the array (Def 8.1). - However, the index type of a conformant array is not specified. - Either INTEGER or CARDINAL seems reasonable. - */ - if (IsConformantArray(tpl) ? !TstAssCompat(card_type, tpr) - : !TstAssCompat(IndexType(tpl), tpr)) { - node_error(expp, "incompatible index type"); - return 0; - } - - expp->nd_type = RemoveEqual(tpl->arr_elem); - return retval; -} - -#ifdef DEBUG -STATIC int -ChkValue(expp) - struct node *expp; -{ - switch(expp->nd_symb) { - case REAL: - case STRING: - case INTEGER: - return 1; - - default: - crash("(ChkValue)"); - } - /*NOTREACHED*/ -} -#endif - -STATIC int -ChkLinkOrName(expp) - register struct node *expp; -{ - /* Check either an ID or a construction of the form - ID.ID [ .ID ]* - */ - register struct def *df; - - expp->nd_type = error_type; - - if (expp->nd_class == Name) { - expp->nd_def = lookfor(expp, CurrVis, 1); - expp->nd_class = Def; - expp->nd_type = RemoveEqual(expp->nd_def->df_type); - } - else if (expp->nd_class == Link) { - /* A selection from a record or a module. - Modules also have a record type. - */ - register struct node *left = expp->nd_left; - - assert(expp->nd_symb == '.'); - - if (! ChkDesignator(left)) return 0; - - if (left->nd_type->tp_fund != T_RECORD || - (left->nd_class == Def && - !(left->nd_def->df_kind & (D_MODULE|D_VARIABLE|D_FIELD)) - ) - ) { - Xerror(left, "illegal selection", left->nd_def); - return 0; - } - - if (!(df = lookup(expp->nd_IDF, left->nd_type->rec_scope, 1))) { - id_not_declared(expp); - return 0; - } - else { - expp->nd_def = df; - expp->nd_type = RemoveEqual(df->df_type); - expp->nd_class = LinkDef; - if (!(df->df_flags & (D_EXPORTED|D_QEXPORTED))) { - /* Fields of a record are always D_QEXPORTED, - so ... - */ -Xerror(expp, "not exported from qualifying module", df); - } - } - - if (left->nd_class == Def && - left->nd_def->df_kind == D_MODULE) { - expp->nd_class = Def; - FreeNode(left); - expp->nd_left = 0; - } - else return 1; - } - - assert(expp->nd_class == Def); - - df = expp->nd_def; - - if (df->df_kind & (D_ENUM | D_CONST)) { - /* Replace an enum-literal or a CONST identifier by its value. - */ - if (df->df_kind == D_ENUM) { - expp->nd_class = Value; - expp->nd_INT = df->enm_val; - expp->nd_symb = INTEGER; - } - else { - unsigned int ln = expp->nd_lineno; - - assert(df->df_kind == D_CONST); - *expp = *(df->con_const); - expp->nd_lineno = ln; - } - } - return df->df_kind != D_ERROR; -} - -STATIC int -ChkExLinkOrName(expp) - register struct node *expp; -{ - /* Check either an ID or an ID.ID [.ID]* occurring in an - expression. - */ - register struct def *df; - - if (! ChkLinkOrName(expp)) return 0; - if (expp->nd_class != Def) return 1; - df = expp->nd_def; - - if (!(df->df_kind & D_VALUE)) { - Xerror(expp, "value expected", df); - } - - if (df->df_kind == D_PROCEDURE) { - /* Check that this procedure is one that we may take the - address from. - */ - if (df->df_type == std_type || df->df_scope->sc_level > 0) { - /* Address of standard or nested procedure - taken. - */ -node_error(expp, "standard or local procedures may not be assigned"); - return 0; - } - } - - return 1; -} - -STATIC int -ChkElement(expp, tp, set) - register struct node *expp; - register struct type *tp; - arith **set; -{ - /* Check elements of a set. This routine may call itself - recursively. - Also try to compute the set! - */ - register struct node *left = expp->nd_left; - register struct node *right = expp->nd_right; - register int i; - - if (expp->nd_class == Link && expp->nd_symb == UPTO) { - /* { ... , expr1 .. expr2, ... } - First check expr1 and expr2, and try to compute them. - */ - if (!ChkElement(left, tp, set) || !ChkElement(right, tp, set)) { - return 0; - } - - if (left->nd_class == Value && right->nd_class == Value) { - /* We have a constant range. Put all elements in the - set - */ - - if (left->nd_INT > right->nd_INT) { -node_error(expp, "lower bound exceeds upper bound in range"); - return 0; - } - - if (*set) { - for (i=left->nd_INT+1; ind_INT; i++) { - (*set)[i/wrd_bits] |= (1<<(i%wrd_bits)); - } - } - } - else if (*set) { - free((char *) *set); - *set = 0; - } - - return 1; - } - - /* Here, a single element is checked - */ - if (!ChkExpression(expp)) return 0; - - if (!TstCompat(tp, expp->nd_type)) { - node_error(expp, "set element has incompatible type"); - return 0; - } - - if (expp->nd_class == Value) { - /* a constant element - */ - arith low, high; - - i = expp->nd_INT; - getbounds(tp, &low, &high); - - if (i < low || i > high) { - node_error(expp, "set element out of range"); - return 0; - } - - if (*set) (*set)[i/wrd_bits] |= (1 << (i%wrd_bits)); - } - - return 1; -} - -STATIC int -ChkSet(expp) - register struct node *expp; -{ - /* Check the legality of a SET aggregate, and try to evaluate it - compile time. Unfortunately this is all rather complicated. - */ - register struct type *tp; - register struct node *nd; - register struct def *df; - arith *set; - unsigned size; - - assert(expp->nd_symb == SET); - - /* First determine the type of the set - */ - if (nd = expp->nd_left) { - /* A type was given. Check it out - */ - if (! ChkDesignator(nd)) return 0; - assert(nd->nd_class == Def); - df = nd->nd_def; - - if (!is_type(df) || - (df->df_type->tp_fund != T_SET)) { - if (df->df_kind != D_ERROR) { - Xerror(expp, "not a set type", df); - } - return 0; - } - tp = df->df_type; - FreeNode(nd); - expp->nd_left = 0; - } - else tp = bitset_type; - expp->nd_type = tp; - - nd = expp->nd_right; - - /* Now check the elements given, and try to compute a constant set. - First allocate room for the set, but only if it is'nt empty. - */ - if (! nd) { - /* The resulting set IS empty, so we just return - */ - expp->nd_class = Set; - expp->nd_set = 0; - return 1; - } - size = tp->tp_size * (sizeof(arith) / word_size); - set = (arith *) Malloc(size); - clear((char *) set, size); - - /* Now check the elements, one by one - */ - while (nd) { - assert(nd->nd_class == Link && nd->nd_symb == ','); - - if (!ChkElement(nd->nd_left, ElementType(tp), &set)) return 0; - nd = nd->nd_right; - } - - if (set) { - /* Yes, it was a constant set, and we managed to compute it! - Notice that at the moment there is no such thing as - partial evaluation. Either we evaluate the set, or we - don't (at all). Improvement not neccesary (???) - ??? sets have a contant part and a variable part ??? - */ - expp->nd_class = Set; - expp->nd_set = set; - FreeNode(expp->nd_right); - expp->nd_right = 0; - } - - return 1; -} - -STATIC struct node * -getarg(argp, bases, designator, edf) - struct node **argp; - struct def *edf; -{ - /* This routine is used to fetch the next argument from an - argument list. The argument list is indicated by "argp". - The parameter "bases" is a bitset indicating which types - are allowed at this point, and "designator" is a flag - indicating that the address from this argument is taken, so - that it must be a designator and may not be a register - variable. - */ - register struct node *arg = (*argp)->nd_right; - register struct node *left; - - if (! arg) { - Xerror(*argp, "too few arguments supplied", edf); - return 0; - } - - left = arg->nd_left; - *argp = arg; - - if (designator ? !ChkVariable(left) : !ChkExpression(left)) { - return 0; - } - - if (designator && left->nd_class == Def) { - left->nd_def->df_flags |= D_NOREG; - } - - if (bases) { - if (!(BaseType(left->nd_type)->tp_fund & bases)) { - Xerror(arg, "unexpected parameter type", edf); - return 0; - } - } - - return left; -} - -STATIC struct node * -getname(argp, kinds, bases, edf) - struct node **argp; - struct def *edf; -{ - /* Get the next argument from argument list "argp". - The argument must indicate a definition, and the - definition kind must be one of "kinds". - */ - register struct node *arg = *argp; - register struct node *left; - - *argp = arg->nd_right; - - if (!arg->nd_right) { - Xerror(arg, "too few arguments supplied", edf); - return 0; - } - - arg = arg->nd_right; - left = arg->nd_left; - if (! ChkDesignator(left)) return 0; - - if (left->nd_class != Def && left->nd_class != LinkDef) { - Xerror(arg, "identifier expected", edf); - return 0; - } - - if (!(left->nd_def->df_kind & kinds)) { - Xerror(arg, "unexpected parameter type", edf); - return 0; - } - - if (bases) { - if (!(left->nd_type->tp_fund & bases)) { - Xerror(arg, "unexpected parameter type", edf); - return 0; - } - } - - return left; -} - -STATIC int -ChkProcCall(expp) - struct node *expp; -{ - /* Check a procedure call - */ - register struct node *left; - struct def *edf = 0; - register struct paramlist *param; - char ebuf[256]; - int retval = 1; - int cnt = 0; - - left = expp->nd_left; - if (left->nd_class == Def || left->nd_class == LinkDef) { - edf = left->nd_def; - } - if (left->nd_type == error_type) { - /* Just check parameters as if they were value parameters - */ - expp->nd_type = error_type; - while (expp->nd_right) { - getarg(&expp, 0, 0, edf); - } - return 0; - } - - expp->nd_type = RemoveEqual(ResultType(left->nd_type)); - - /* Check parameter list - */ - for (param = ParamList(left->nd_type); param; param = param->next) { - if (!(left = getarg(&expp, 0, IsVarParam(param), edf))) { - return 0; - } - cnt++; - if (left->nd_symb == STRING) { - TryToString(left, TypeOfParam(param)); - } - if (! TstParCompat(RemoveEqual(TypeOfParam(param)), - left->nd_type, - IsVarParam(param), - left)) { - sprint(ebuf, "type incompatibility in parameter %d", - cnt); - Xerror(left, ebuf, edf); - retval = 0; - } - } - - if (expp->nd_right) { - Xerror(expp->nd_right, "too many parameters supplied", edf); - while (expp->nd_right) { - getarg(&expp, 0, 0, edf); - } - return 0; - } - - return retval; -} - -int -ChkCall(expp) - register struct node *expp; -{ - /* Check something that looks like a procedure or function call. - Of course this does not have to be a call at all, - it may also be a cast or a standard procedure call. - */ - register struct node *left; - STATIC int ChkStandard(); - STATIC int ChkCast(); - - /* First, get the name of the function or procedure - */ - expp->nd_type = error_type; - left = expp->nd_left; - if (ChkDesignator(left)) { - if (IsCast(left)) { - /* It was a type cast. - */ - return ChkCast(expp, left); - } - - if (IsProcCall(left) || left->nd_type == error_type) { - /* A procedure call. - It may also be a call to a standard procedure - */ - if (left->nd_type == std_type) { - /* A standard procedure - */ - return ChkStandard(expp, left); - } - /* Here, we have found a real procedure call. - The left hand side may also represent a procedure - variable. - */ - } - else node_error(left, "procedure, type, or function expected"); - } - return ChkProcCall(expp); -} - -STATIC struct type * -ResultOfOperation(operator, tp) - struct type *tp; -{ - /* Return the result type of the binary operation "operator", - with operand type "tp". - */ - - switch(operator) { - case '=': - case '#': - case GREATEREQUAL: - case LESSEQUAL: - case '<': - case '>': - case IN: - return bool_type; - } - - return tp; -} - -STATIC int -Boolean(operator) -{ - return operator == OR || operator == AND || operator == '&'; -} - -STATIC int -AllowedTypes(operator) -{ - /* Return a bit mask indicating the allowed operand types - for binary operator "operator". - */ - - switch(operator) { - case '+': - case '-': - case '*': - return T_NUMERIC|T_SET; - case '/': - return T_REAL|T_SET; - case DIV: - case MOD: - return T_INTORCARD; - case OR: - case AND: - case '&': - return T_ENUMERATION; - case '=': - case '#': - return T_POINTER|T_HIDDEN|T_SET|T_NUMERIC|T_ENUMERATION|T_CHAR; - case GREATEREQUAL: - case LESSEQUAL: - return T_SET|T_NUMERIC|T_CHAR|T_ENUMERATION; - case '<': - case '>': - return T_NUMERIC|T_CHAR|T_ENUMERATION; - default: - crash("(AllowedTypes)"); - } - /*NOTREACHED*/ -} - -STATIC int -ChkAddress(tpl, tpr) - register struct type *tpl, *tpr; -{ - /* Check that either "tpl" or "tpr" are both of type - address_type, or that one of them is, but the other is - of type cardinal. - */ - - if (tpl == address_type) { - return tpr == address_type || (tpr->tp_fund & T_CARDINAL); - } - - if (tpr == address_type) { - return (tpl->tp_fund & T_CARDINAL); - } - - return 0; -} - -STATIC int -ChkBinOper(expp) - register struct node *expp; -{ - /* Check a binary operation. - */ - register struct node *left, *right; - struct type *tpl, *tpr; - int allowed; - int retval; - - left = expp->nd_left; - right = expp->nd_right; - - retval = ChkExpression(left) & ChkExpression(right); - - tpl = BaseType(left->nd_type); - tpr = BaseType(right->nd_type); - - if (tpl == intorcard_type) { - if (tpr == int_type || tpr == card_type) { - left->nd_type = tpl = tpr; - } - } - if (tpr == intorcard_type) { - if (tpl == int_type || tpl == card_type) { - right->nd_type = tpr = tpl; - } - } - - expp->nd_type = ResultOfOperation(expp->nd_symb, tpr); - - /* Check that the application of the operator is allowed on the type - of the operands. - There are three tricky parts: - - Boolean operators are only allowed on boolean operands, but - the "allowed-mask" of "AllowedTypes" can only indicate - an enumeration type. - - All operations that are allowed on CARDINALS are also allowed - on ADDRESS. - - The IN-operator has as right-hand-size operand a set. - */ - if (expp->nd_symb == IN) { - if (!TstAssCompat(tpl, ElementType(tpr))) { - /* Assignment compatible ??? - I don't know! Should we be allowed to check - if a INTEGER is a member of a BITSET??? - */ - - node_error(expp, "\"IN\": incompatible types"); - return 0; - } - if (left->nd_class == Value && right->nd_class == Set) { - cstset(expp); - } - return retval; - } - - if (!retval) return 0; - - allowed = AllowedTypes(expp->nd_symb); - - if (!(tpr->tp_fund & allowed) || !(tpl->tp_fund & allowed)) { - if (!((T_CARDINAL & allowed) && - ChkAddress(tpl, tpr))) { - node_error(expp, "\"%s\": illegal operand type(s)", - symbol2str(expp->nd_symb)); - return 0; - } - if (expp->nd_type->tp_fund & T_CARDINAL) { - expp->nd_type = address_type; - } - } - - if (Boolean(expp->nd_symb) && tpl != bool_type) { - node_error(expp, "\"%s\": illegal operand type(s)", - symbol2str(expp->nd_symb)); - return 0; - } - - /* Operands must be compatible (distilled from Def 8.2) - */ - if (!TstCompat(tpl, tpr)) { - node_error(expp, "\"%s\": incompatible types", symbol2str(expp->nd_symb)); - return 0; - } - - if (tpl->tp_fund == T_SET) { - if (left->nd_class == Set && right->nd_class == Set) { - cstset(expp); - } - } - else if ( tpl->tp_fund != T_REAL && - left->nd_class == Value && right->nd_class == Value) { - cstbin(expp); - } - - return 1; -} - -STATIC int -ChkUnOper(expp) - register struct node *expp; -{ - /* Check an unary operation. - */ - register struct node *right = expp->nd_right; - register struct type *tpr; - - if (! ChkExpression(right)) return 0; - - expp->nd_type = tpr = BaseType(right->nd_type); - if (tpr == address_type) tpr = card_type; - - switch(expp->nd_symb) { - case '+': - if (tpr->tp_fund & T_NUMERIC) { - expp->nd_token = right->nd_token; - expp->nd_class = right->nd_class; - FreeNode(right); - expp->nd_right = 0; - return 1; - } - break; - - case '-': - if (tpr->tp_fund & T_INTORCARD) { - if (tpr == intorcard_type) { - expp->nd_type = int_type; - } - if (right->nd_class == Value) { - cstunary(expp); - } - return 1; - } - else if (tpr->tp_fund == T_REAL) { - expp->nd_type = tpr; - if (right->nd_class == Value) { - if (*(right->nd_REL) == '-') (right->nd_REL)++; - else (right->nd_REL)--; - expp->nd_class = Value; - expp->nd_symb = REAL; - expp->nd_REL = right->nd_REL; - FreeNode(right); - expp->nd_right = 0; - } - return 1; - } - break; - - case NOT: - case '~': - if (tpr == bool_type) { - if (right->nd_class == Value) { - cstunary(expp); - } - return 1; - } - break; - - default: - crash("ChkUnOper"); - } - node_error(expp, "\"%s\": illegal operand", symbol2str(expp->nd_symb)); - return 0; -} - -STATIC struct node * -getvariable(argp, edf) - struct node **argp; - struct def *edf; -{ - /* Get the next argument from argument list "argp". - It must obey the rules of "ChkVariable". - */ - register struct node *arg = *argp; - - arg = arg->nd_right; - if (!arg) { - Xerror(arg, "too few parameters supplied", edf); - return 0; - } - - *argp = arg; - arg = arg->nd_left; - if (! ChkVariable(arg)) return 0; - - return arg; -} - -STATIC int -ChkStandard(expp, left) - register struct node *expp, *left; -{ - /* Check a call of a standard procedure or function - */ - struct node *arg = expp; - register struct def *edf; - int std; - - assert(left->nd_class == Def); - std = left->nd_def->df_value.df_stdname; - edf = left->nd_def; - - switch(std) { - case S_ABS: - if (!(left = getarg(&arg, T_NUMERIC, 0, edf))) return 0; - expp->nd_type = left->nd_type; - if (left->nd_class == Value && - expp->nd_type->tp_fund != T_REAL) { - cstcall(expp, S_ABS); - } - break; - - case S_CAP: - expp->nd_type = char_type; - if (!(left = getarg(&arg, T_CHAR, 0, edf))) return 0; - if (left->nd_class == Value) cstcall(expp, S_CAP); - break; - - case S_CHR: - expp->nd_type = char_type; - if (!(left = getarg(&arg, T_INTORCARD, 0, edf))) return 0; - if (left->nd_class == Value) cstcall(expp, S_CHR); - break; - - case S_FLOAT: - expp->nd_type = real_type; - if (!(left = getarg(&arg, T_INTORCARD, 0, edf))) return 0; - break; - - case S_HIGH: - if (!(left = getarg(&arg, T_ARRAY|T_STRING|T_CHAR, 0, edf))) { - return 0; - } - if (IsConformantArray(left->nd_type)) { - /* A conformant array has no explicit index type, - but it is a subrange with lower bound 0, so - it is of type CARDINAL !!! - */ - expp->nd_type = card_type; - break; - } - if (left->nd_type->tp_fund == T_ARRAY) { - expp->nd_type = IndexType(left->nd_type); - cstcall(expp, S_MAX); - break; - } - if (left->nd_symb != STRING) { - Xerror(left,"array parameter expected", edf); - return 0; - } - expp->nd_type = card_type; - expp->nd_class = Value; - /* Notice that we could disallow HIGH("") here by checking - that left->nd_type->tp_fund != T_CHAR || left->nd_INT != 0. - ??? For the time being, we don't. !!! - Maybe the empty string should not be allowed at all. - */ - expp->nd_INT = left->nd_type->tp_fund == T_CHAR ? 0 : - left->nd_SLE - 1; - expp->nd_symb = INTEGER; - break; - - case S_MAX: - case S_MIN: - if (!(left = getname(&arg, D_ISTYPE, T_DISCRETE, edf))) { - return 0; - } - expp->nd_type = left->nd_type; - cstcall(expp,std); - break; - - case S_ODD: - if (!(left = getarg(&arg, T_INTORCARD, 0, edf))) return 0; - expp->nd_type = bool_type; - if (left->nd_class == Value) cstcall(expp, S_ODD); - break; - - case S_ORD: - if (!(left = getarg(&arg, T_DISCRETE, 0, edf))) return 0; - expp->nd_type = card_type; - if (left->nd_class == Value) cstcall(expp, S_ORD); - break; - - case S_NEW: - case S_DISPOSE: - { - static int warning_given = 0; - - if (!warning_given) { - warning_given = 1; - node_warning(expp, W_OLDFASHIONED, "NEW and DISPOSE are obsolete"); - } - } - if (! (left = getvariable(&arg, edf))) return 0; - if (! (left->nd_type->tp_fund == T_POINTER)) { - Xerror(left, "pointer variable expected", edf); - return 0; - } - if (left->nd_class == Def) { - left->nd_def->df_flags |= D_NOREG; - } - /* Now, make it look like a call to ALLOCATE or DEALLOCATE */ - { - struct token dt; - register struct token *tk = &dt; - struct node *nd; - - tk->TOK_INT = PointedtoType(left->nd_type)->tp_size; - tk->tk_symb = INTEGER; - tk->tk_lineno = left->nd_lineno; - nd = MkLeaf(Value, &dt); - nd->nd_type = card_type; - tk->tk_symb = ','; - arg->nd_right = MkNode(Link, nd, NULLNODE, tk); - /* Ignore other arguments to NEW and/or DISPOSE ??? */ - - FreeNode(expp->nd_left); - tk->tk_symb = IDENT; - tk->tk_lineno = expp->nd_left->nd_lineno; - tk->TOK_IDF = str2idf(std == S_NEW ? - "ALLOCATE" : "DEALLOCATE", 0); - expp->nd_left = MkLeaf(Name, tk); - } - return ChkCall(expp); - - case S_TSIZE: /* ??? */ - case S_SIZE: - expp->nd_type = intorcard_type; - if (!(left = getname(&arg,D_FIELD|D_VARIABLE|D_ISTYPE,0,edf))) { - return 0; - } - if (! IsConformantArray(left->nd_type)) cstcall(expp, S_SIZE); - else node_warning(expp, - W_STRICT, - "%s on conformant array", - expp->nd_left->nd_def->df_idf->id_text); - break; - - case S_TRUNC: - expp->nd_type = card_type; - if (!(left = getarg(&arg, T_REAL, 0, edf))) return 0; - break; - - case S_VAL: - if (!(left = getname(&arg, D_ISTYPE, T_DISCRETE, edf))) { - return 0; - } - expp->nd_type = left->nd_def->df_type; - expp->nd_right = arg->nd_right; - arg->nd_right = 0; - FreeNode(arg); - arg = expp; - if (!(left = getarg(&arg, T_INTORCARD, 0, edf))) return 0; - if (left->nd_class == Value) cstcall(expp, S_VAL); - break; - - case S_ADR: - expp->nd_type = address_type; - if (!(left = getarg(&arg, 0, 1, edf))) return 0; - break; - - case S_DEC: - case S_INC: - expp->nd_type = 0; - if (! (left = getvariable(&arg, edf))) return 0; - if (! (left->nd_type->tp_fund & T_DISCRETE)) { - Xerror(left,"illegal parameter type", edf); - return 0; - } - if (arg->nd_right) { - if (! getarg(&arg, T_INTORCARD, 0, edf)) return 0; - } - break; - - case S_HALT: - expp->nd_type = 0; - break; - - case S_EXCL: - case S_INCL: - { - struct type *tp; - - expp->nd_type = 0; - if (!(left = getvariable(&arg, edf))) return 0; - tp = left->nd_type; - if (tp->tp_fund != T_SET) { - Xerror(arg, "SET parameter expected", edf); - return 0; - } - if (!(left = getarg(&arg, T_DISCRETE, 0, edf))) return 0; - if (!TstAssCompat(ElementType(tp), left->nd_type)) { - /* What type of compatibility do we want here? - apparently assignment compatibility! ??? ??? - */ - Xerror(arg, "unexpected parameter type", edf); - return 0; - } - break; - } - - default: - crash("(ChkStandard)"); - } - - if (arg->nd_right) { - Xerror(arg->nd_right, "too many parameters supplied", edf); - return 0; - } - - return 1; -} - -STATIC int -ChkCast(expp, left) - register struct node *expp, *left; -{ - /* Check a cast and perform it if the argument is constant. - If the sizes don't match, only complain if at least one of them - has a size larger than the word size. - If both sizes are equal to or smaller than the word size, there - is no problem as such values take a word on the EM stack - anyway. - */ - register struct node *arg = expp->nd_right; - - if ((! arg) || arg->nd_right) { - Xerror(expp, "too many parameters in type cast", left->nd_def); - return 0; - } - - arg = arg->nd_left; - if (! ChkExpression(arg)) return 0; - - if (arg->nd_type->tp_size != left->nd_type->tp_size && - (arg->nd_type->tp_size > word_size || - left->nd_type->tp_size > word_size)) { - Xerror(expp, "unequal sizes in type cast", left->nd_def); - } - - if (arg->nd_class == Value) { - struct type *tp = left->nd_type; - - FreeNode(left); - expp->nd_right->nd_left = 0; - FreeNode(expp->nd_right); - expp->nd_left = expp->nd_right = 0; - *expp = *arg; - expp->nd_type = tp; - } - else expp->nd_type = left->nd_type; - - return 1; -} - -TryToString(nd, tp) - register struct node *nd; - struct type *tp; -{ - /* Try a coercion from character constant to string. - */ - - assert(nd->nd_symb == STRING); - - if (tp->tp_fund == T_ARRAY && nd->nd_type == char_type) { - int ch = nd->nd_INT; - - nd->nd_type = standard_type(T_STRING, 1, (arith) 2); - nd->nd_token.tk_data.tk_str = - (struct string *) Malloc(sizeof(struct string)); - nd->nd_STR = Salloc("X", 2); - *(nd->nd_STR) = ch; - nd->nd_SLE = 1; - } -} - -STATIC int -no_desig(expp) - struct node *expp; -{ - node_error(expp, "designator expected"); - return 0; -} - -STATIC int -done_before() -{ - return 1; -} - -extern int NodeCrash(); - -int (*ExprChkTable[])() = { -#ifdef DEBUG - ChkValue, -#else - done_before, -#endif - ChkArr, - ChkBinOper, - ChkUnOper, - ChkArrow, - ChkCall, - ChkExLinkOrName, - NodeCrash, - ChkSet, - NodeCrash, - NodeCrash, - ChkExLinkOrName, - NodeCrash -}; - -int (*DesigChkTable[])() = { -#ifdef DEBUG - ChkValue, -#else - done_before, -#endif - ChkArr, - no_desig, - no_desig, - ChkArrow, - no_desig, - ChkLinkOrName, - NodeCrash, - no_desig, - done_before, - NodeCrash, - ChkLinkOrName, - done_before -}; diff --git a/lang/m2/comp/chk_expr.h b/lang/m2/comp/chk_expr.h deleted file mode 100644 index 7b9b4b187..000000000 --- a/lang/m2/comp/chk_expr.h +++ /dev/null @@ -1,11 +0,0 @@ -/* E X P R E S S I O N C H E C K I N G */ - -extern int (*ExprChkTable[])(); /* table of expression checking - functions, indexed by node class - */ -extern int (*DesigChkTable[])(); /* table of designator checking - functions, indexed by node class - */ - -#define ChkExpression(expp) ((*ExprChkTable[(expp)->nd_class])(expp)) -#define ChkDesignator(expp) ((*DesigChkTable[(expp)->nd_class])(expp)) diff --git a/lang/m2/comp/class.h b/lang/m2/comp/class.h deleted file mode 100644 index 50f88e540..000000000 --- a/lang/m2/comp/class.h +++ /dev/null @@ -1,36 +0,0 @@ -/* U S E O F C H A R A C T E R C L A S S E S */ - -/* As a starter, chars are divided into classes, according to which - token they can be the start of. - At present such a class number is supposed to fit in 4 bits. -*/ - -#define class(ch) (tkclass[ch]) - -/* Being the start of a token is, fortunately, a mutual exclusive - property, so, as there are less than 16 classes they can be - packed in 4 bits. -*/ - -#define STSKIP 0 /* spaces and so on: skipped characters */ -#define STNL 1 /* newline character(s): update linenumber etc. */ -#define STGARB 2 /* garbage ascii character: not allowed */ -#define STSIMP 3 /* this character can occur as token */ -#define STCOMP 4 /* this one can start a compound token */ -#define STIDF 5 /* being the initial character of an identifier */ -#define STCHAR 6 /* the starter of a character constant */ -#define STSTR 7 /* the starter of a string */ -#define STNUM 8 /* the starter of a numeric constant */ -#define STEOI 9 /* End-Of-Information mark */ - -/* But occurring inside a token is not, so we need 1 bit for each - class. This is implemented as a collection of tables to speed up - the decision whether a character has a special meaning. -*/ -#define in_idf(ch) ((unsigned)ch < 0177 && inidf[ch]) -#define is_oct(ch) ((unsigned)ch < 0177 && isoct[ch]) -#define is_dig(ch) ((unsigned)ch < 0177 && isdig[ch]) -#define is_hex(ch) ((unsigned)ch < 0177 && ishex[ch]) - -extern char tkclass[]; -extern char inidf[], isoct[], isdig[], ishex[]; diff --git a/lang/m2/comp/code.c b/lang/m2/comp/code.c deleted file mode 100644 index d415d7a9e..000000000 --- a/lang/m2/comp/code.c +++ /dev/null @@ -1,1021 +0,0 @@ -/* C O D E G E N E R A T I O N R O U T I N E S */ - -/* Code generation for expressions and coercions -*/ - -#include "debug.h" - -#include -#include -#include -#include - -#include "type.h" -#include "def.h" -#include "scope.h" -#include "desig.h" -#include "LLlex.h" -#include "node.h" -#include "Lpars.h" -#include "standards.h" -#include "walk.h" - -extern char *long2str(); -extern char *symbol2str(); -extern int proclevel; -int fp_used; - -CodeConst(cst, size) - arith cst, size; -{ - /* Generate code to push constant "cst" with size "size" - */ - - if (size <= word_size) { - C_loc(cst); - } - else if (size == dword_size) { - C_ldc(cst); - } - else { - crash("(CodeConst)"); -/* - label dlab = ++data_label; - - C_df_dlb(dlab); - C_rom_icon(long2str((long) cst), size); - C_lae_dlb(dlab, (arith) 0); - C_loi(size); -*/ - } -} - -CodeString(nd) - register struct node *nd; -{ - if (nd->nd_type->tp_fund != T_STRING) { - C_loc(nd->nd_INT); - } - else { - label lab = ++data_label; - - C_df_dlb(lab); - C_rom_scon(nd->nd_STR, WA(nd->nd_SLE + 1)); - C_lae_dlb(lab, (arith) 0); - } -} - -CodeExpr(nd, ds, true_label, false_label) - register struct node *nd; - register struct desig *ds; - label true_label, false_label; -{ - register struct type *tp = nd->nd_type; - - if (tp->tp_fund == T_REAL) fp_used = 1; - switch(nd->nd_class) { - case Def: - if (nd->nd_def->df_kind & (D_PROCEDURE|D_PROCHEAD)) { - C_lpi(NameOfProc(nd->nd_def)); - ds->dsg_kind = DSG_LOADED; - break; - } - /* Fall through */ - - case Link: - case LinkDef: - case Arrsel: - case Arrow: - CodeDesig(nd, ds); - break; - - case Oper: - CodeOper(nd, true_label, false_label); - if (true_label == 0) ds->dsg_kind = DSG_LOADED; - else { - ds->dsg_kind = DSG_INIT; - true_label = 0; - } - break; - - case Uoper: - CodeUoper(nd); - ds->dsg_kind = DSG_LOADED; - break; - - case Value: - switch(nd->nd_symb) { - case REAL: { - label lab = ++data_label; - - C_df_dlb(lab); - C_rom_fcon(nd->nd_REL, nd->nd_type->tp_size); - C_lae_dlb(lab, (arith) 0); - C_loi(nd->nd_type->tp_size); - } - break; - case STRING: - CodeString(nd); - break; - case INTEGER: - CodeConst(nd->nd_INT, tp->tp_size); - break; - default: - crash("Value error"); - } - ds->dsg_kind = DSG_LOADED; - break; - - case Call: - CodeCall(nd); - ds->dsg_kind = DSG_LOADED; - break; - - case Set: { - register arith *st = nd->nd_set; - register int i; - - st = nd->nd_set; - ds->dsg_kind = DSG_LOADED; - if (!st) { - C_zer(tp->tp_size); - break; - } - for (i = tp->tp_size / word_size, st += i; i > 0; i--) { - C_loc(*--st); - } - } - break; - - case Xset: - CodeSet(nd); - ds->dsg_kind = DSG_LOADED; - break; - - default: - crash("(CodeExpr) bad node type"); - } - - if (true_label != 0) { - /* Only for boolean expressions - */ - CodeValue(ds, tp->tp_size, tp->tp_align); - *ds = InitDesig; - C_zne(true_label); - C_bra(false_label); - } -} - -CodeCoercion(t1, t2) - register struct type *t1, *t2; -{ - register int fund1, fund2; - - t1 = BaseType(t1); - t2 = BaseType(t2); - if (t1 == t2) return; - if ((fund1 = t1->tp_fund) == T_WORD) fund1 = T_INTEGER; - if ((fund2 = t2->tp_fund) == T_WORD) fund2 = T_INTEGER; - switch(fund1) { - case T_INTEGER: - switch(fund2) { - case T_INTEGER: - if (t2->tp_size != t1->tp_size) { - C_loc(t1->tp_size); - C_loc(t2->tp_size); - C_cii(); - } - break; - case T_ENUMERATION: - case T_CHAR: - case T_CARDINAL: - if (t1->tp_size != word_size) { - C_loc(t1->tp_size); - C_loc(word_size); - C_ciu(); - } - break; - case T_REAL: - C_loc(t1->tp_size); - C_loc(t2->tp_size); - C_cif(); - break; - default: - crash("Funny integer conversion"); - } - break; - - case T_CHAR: - case T_ENUMERATION: - case T_CARDINAL: - case T_INTORCARD: - switch(fund2) { - case T_ENUMERATION: - case T_CHAR: - case T_CARDINAL: - case T_POINTER: - case T_EQUAL: - case T_INTORCARD: - if (t2->tp_size > word_size) { - C_loc(word_size); - C_loc(t2->tp_size); - C_cuu(); - } - break; - case T_INTEGER: - C_loc(word_size); - C_loc(t2->tp_size); - C_cui(); - break; - case T_REAL: - C_loc(word_size); - C_loc(t2->tp_size); - C_cuf(); - break; - default: - crash("Funny cardinal conversion"); - } - break; - - case T_REAL: - switch(fund2) { - case T_REAL: - if (t2->tp_size != t1->tp_size) { - C_loc(t1->tp_size); - C_loc(t2->tp_size); - C_cff(); - } - break; - case T_INTEGER: - C_loc(t1->tp_size); - C_loc(t2->tp_size); - C_cfi(); - break; - case T_CARDINAL: - C_loc(t1->tp_size); - C_loc(t2->tp_size); - C_cfu(); - break; - default: - crash("Funny REAL conversion"); - } - break; - } -} - -CodeCall(nd) - register struct node *nd; -{ - /* Generate code for a procedure call. Checking of parameters - and result is already done. - */ - register struct node *left = nd->nd_left; - register struct node *right = nd->nd_right; - register struct type *result_tp; - - if (left->nd_type == std_type) { - CodeStd(nd); - return; - } - - if (IsCast(left)) { - /* it was just a cast. Simply ignore it - */ - CodePExpr(right->nd_left); - *nd = *(right->nd_left); - nd->nd_type = left->nd_def->df_type; - return; - } - - assert(IsProcCall(left)); - - if (right) { - CodeParameters(ParamList(left->nd_type), right); - } - - switch(left->nd_class) { - case Def: { - register struct def *df = left->nd_def; - - if (df->df_kind == D_PROCEDURE) { - arith level = df->df_scope->sc_level; - - if (level > 0) { - C_lxl((arith) proclevel - level); - } - C_cal(NameOfProc(df)); - break; - } - else if (df->df_kind == D_PROCHEAD) { - C_cal(df->for_name); - break; - }} - /* Fall through */ - default: - CodePExpr(left); - C_cai(); - } - if (left->nd_type->prc_nbpar) C_asp(left->nd_type->prc_nbpar); - if (result_tp = ResultType(left->nd_type)) { - if (IsConstructed(result_tp)) { - C_lfr(pointer_size); - C_loi(result_tp->tp_size); - } - else C_lfr(WA(result_tp->tp_size)); - } -} - -CodeParameters(param, arg) - struct paramlist *param; - struct node *arg; -{ - register struct type *tp; - register struct node *left; - register struct type *left_type; - - assert(param != 0 && arg != 0); - - if (param->next) { - CodeParameters(param->next, arg->nd_right); - } - - tp = TypeOfParam(param); - left = arg->nd_left; - left_type = left->nd_type; - if (IsConformantArray(tp)) { - register struct type *elem = tp->arr_elem; - - C_loc(tp->arr_elsize); - if (IsConformantArray(left_type)) { - DoHIGH(left); - if (elem->tp_size != left_type->arr_elem->tp_size) { - /* This can only happen if the formal type is - ARRAY OF (WORD|BYTE) - */ - C_loc(left_type->arr_elem->tp_size); - C_mli(word_size); - if (elem == word_type) { - C_loc(word_size - 1); - C_adi(word_size); - C_loc(word_size); - C_dvi(word_size); - } - else { - assert(elem == byte_type); - } - } - } - else if (left->nd_symb == STRING) { - C_loc(left->nd_SLE - 1); - } - else if (elem == word_type) { - C_loc((left_type->tp_size+word_size-1) / word_size - 1); - } - else if (elem == byte_type) { - C_loc(left_type->tp_size - 1); - } - else { - arith lb, ub; - getbounds(IndexType(left_type), &lb, &ub); - C_loc(ub - lb); - } - C_loc((arith) 0); - if (left->nd_symb == STRING) { - CodeString(left); - } - else if (left->nd_class == Call) { - /* ouch! forgot about this one! */ - arith tmp, TmpSpace(); - - CodePExpr(left); - tmp = TmpSpace(left->nd_type->tp_size, left->nd_type->tp_align); - C_lal(tmp); - C_sti(WA(left->nd_type->tp_size)); - C_lal(tmp); - } - else CodeDAddress(left); - return; - } - if (IsVarParam(param)) { - CodeDAddress(left); - return; - } - if (left_type->tp_fund == T_STRING) { - CodePString(left, tp); - return; - } - CodePExpr(left); - RangeCheck(tp, left_type); - CodeCoercion(left_type, tp); -} - -CodePString(nd, tp) - struct node *nd; - struct type *tp; -{ - arith szarg = WA(nd->nd_type->tp_size); - register arith zersz = WA(tp->tp_size) - szarg; - - if (zersz) { - /* null padding required */ - assert(zersz > 0); - C_zer(zersz); - } - CodeString(nd); /* push address of string */ - C_loi(szarg); -} - -CodeStd(nd) - struct node *nd; -{ - register struct node *arg = nd->nd_right; - register struct node *left = 0; - register struct type *tp; - int std = nd->nd_left->nd_def->df_value.df_stdname; - - if (arg) { - left = arg->nd_left; - tp = BaseType(left->nd_type); - arg = arg->nd_right; - } - - switch(std) { - case S_ABS: - CodePExpr(left); - if (tp->tp_fund == T_INTEGER) { - if (tp->tp_size == int_size) C_cal("_absi"); - else C_cal("_absl"); - } - else if (tp->tp_fund == T_REAL) { - if (tp->tp_size == float_size) C_cal("_absf"); - else C_cal("_absd"); - } - C_asp(tp->tp_size); - C_lfr(tp->tp_size); - break; - - case S_CAP: - CodePExpr(left); - C_loc((arith) 0137); /* ASCII assumed */ - C_and(word_size); - break; - - case S_CHR: - CodePExpr(left); - RangeCheck(char_type, tp); - break; - - case S_FLOAT: - CodePExpr(left); - CodeCoercion(tp, real_type); - break; - - case S_HIGH: - assert(IsConformantArray(tp)); - DoHIGH(left); - break; - - case S_SIZE: - case S_TSIZE: - assert(IsConformantArray(tp)); - DoHIGH(left); - C_inc(); - C_loc(tp->arr_elem->tp_size); - C_mlu(word_size); - break; - - case S_ODD: - CodePExpr(left); - if (tp->tp_size == word_size) { - C_loc((arith) 1); - C_and(word_size); - } - else { - assert(tp->tp_size == dword_size); - C_ldc((arith) 1); - C_and(dword_size); - C_ior(word_size); - } - break; - - case S_ORD: - CodePExpr(left); - break; - - case S_TRUNC: - CodePExpr(left); - CodeCoercion(tp, card_type); - break; - - case S_VAL: - CodePExpr(left); - RangeCheck(nd->nd_type, tp); - break; - - case S_ADR: - CodeDAddress(left); - break; - - case S_DEC: - case S_INC: { - register arith size = tp->tp_size; - - if (size < word_size) size = word_size; - CodePExpr(left); - if (arg) CodePExpr(arg->nd_left); - else C_loc((arith) 1); - if (std == S_DEC) { - if (tp->tp_fund == T_INTEGER) C_sbi(size); - else C_sbu(size); - } - else { - if (tp->tp_fund == T_INTEGER) C_adi(size); - else C_adu(size); - } - if (size == word_size) RangeCheck(tp, int_type); - CodeDStore(left); - break; - } - - case S_HALT: - C_cal("_halt"); - break; - - case S_INCL: - case S_EXCL: - CodePExpr(left); - CodePExpr(arg->nd_left); - C_set(tp->tp_size); - if (std == S_INCL) { - C_ior(tp->tp_size); - } - else { - C_com(tp->tp_size); - C_and(tp->tp_size); - } - CodeDStore(left); - break; - - default: - crash("(CodeStd)"); - } -} - -RangeCheck(tpl, tpr) - register struct type *tpl, *tpr; -{ - /* Generate a range check if neccessary - */ - - arith llo, lhi, rlo, rhi; - - if (bounded(tpl)) { - /* in this case we might need a range check */ - if (!bounded(tpr)) { - /* yes, we need one */ - genrck(tpl); - } - else { - /* both types are restricted. check the bounds - to see wether we need a range check. - We don't need one if the range of values of the - right hand side is a subset of the range of values - of the left hand side. - */ - getbounds(tpl, &llo, &lhi); - getbounds(tpr, &rlo, &rhi); - if (llo > rlo || lhi < rhi) { - genrck(tpl); - } - } - } -} - -Operands(leftop, rightop, tp) - register struct node *leftop, *rightop; - struct type *tp; -{ - - CodePExpr(leftop); - CodeCoercion(leftop->nd_type, tp); - CodePExpr(rightop); - CodeCoercion(rightop->nd_type, tp); -} - -CodeOper(expr, true_label, false_label) - register struct node *expr; /* the expression tree itself */ - label true_label; - label false_label; /* labels to jump to in logical expr's */ -{ - register struct node *leftop = expr->nd_left; - register struct node *rightop = expr->nd_right; - register struct type *tp = expr->nd_type; - - switch (expr->nd_symb) { - case '+': - Operands(leftop, rightop, tp); - switch (tp->tp_fund) { - case T_INTEGER: - C_adi(tp->tp_size); - break; - case T_REAL: - C_adf(tp->tp_size); - break; - case T_POINTER: - case T_EQUAL: - case T_CARDINAL: - case T_INTORCARD: - C_adu(tp->tp_size); - break; - case T_SET: - C_ior(tp->tp_size); - break; - default: - crash("bad type +"); - } - break; - case '-': - Operands(leftop, rightop, tp); - switch (tp->tp_fund) { - case T_INTEGER: - C_sbi(tp->tp_size); - break; - case T_REAL: - C_sbf(tp->tp_size); - break; - case T_POINTER: - case T_EQUAL: - case T_CARDINAL: - case T_INTORCARD: - C_sbu(tp->tp_size); - break; - case T_SET: - C_com(tp->tp_size); - C_and(tp->tp_size); - break; - default: - crash("bad type -"); - } - break; - case '*': - Operands(leftop, rightop, tp); - switch (tp->tp_fund) { - case T_INTEGER: - C_mli(tp->tp_size); - break; - case T_POINTER: - case T_EQUAL: - case T_CARDINAL: - case T_INTORCARD: - C_mlu(tp->tp_size); - break; - case T_REAL: - C_mlf(tp->tp_size); - break; - case T_SET: - C_and(tp->tp_size); - break; - default: - crash("bad type *"); - } - break; - case '/': - Operands(leftop, rightop, tp); - switch (tp->tp_fund) { - case T_REAL: - C_dvf(tp->tp_size); - break; - case T_SET: - C_xor(tp->tp_size); - break; - default: - crash("bad type /"); - } - break; - case DIV: - Operands(leftop, rightop, tp); - switch(tp->tp_fund) { - case T_INTEGER: - C_dvi(tp->tp_size); - break; - case T_POINTER: - case T_EQUAL: - case T_CARDINAL: - case T_INTORCARD: - C_dvu(tp->tp_size); - break; - default: - crash("bad type DIV"); - } - break; - case MOD: - Operands(leftop, rightop, tp); - switch(tp->tp_fund) { - case T_INTEGER: - C_rmi(tp->tp_size); - break; - case T_POINTER: - case T_EQUAL: - case T_CARDINAL: - case T_INTORCARD: - C_rmu(tp->tp_size); - break; - default: - crash("bad type MOD"); - } - break; - case '<': - case LESSEQUAL: - case '>': - case GREATEREQUAL: - case '=': - case '#': - tp = BaseType(leftop->nd_type); - if (tp == intorcard_type) tp = BaseType(rightop->nd_type); - Operands(leftop, rightop, tp); - switch (tp->tp_fund) { - case T_INTEGER: - C_cmi(tp->tp_size); - break; - case T_POINTER: - case T_HIDDEN: - case T_EQUAL: - case T_CARDINAL: - case T_INTORCARD: - C_cmu(tp->tp_size); - break; - case T_ENUMERATION: - case T_CHAR: - C_cmu(word_size); - break; - case T_REAL: - C_cmf(tp->tp_size); - break; - case T_SET: - if (expr->nd_symb == GREATEREQUAL) { - /* A >= B is the same as A equals A + B - */ - C_dup(2*tp->tp_size); - C_asp(tp->tp_size); - C_ior(tp->tp_size); - } - else if (expr->nd_symb == LESSEQUAL) { - /* A <= B is the same as A - B = {} - */ - C_com(tp->tp_size); - C_and(tp->tp_size); - C_zer(tp->tp_size); - } - C_cms(tp->tp_size); - break; - default: - crash("bad type COMPARE"); - } - if (true_label != 0) { - compare(expr->nd_symb, true_label); - C_bra(false_label); - } - else { - truthvalue(expr->nd_symb); - } - break; - case IN: - /* In this case, evaluate right hand side first! The - INN instruction expects the bit number on top of the - stack - */ - CodePExpr(rightop); - CodePExpr(leftop); - CodeCoercion(leftop->nd_type, word_type); - C_inn(rightop->nd_type->tp_size); - if (true_label != 0) { - C_zne(true_label); - C_bra(false_label); - } - break; - case OR: - case AND: - case '&': { - label l_maybe = ++text_label, l_end; - struct desig Des; - int genlabels = 0; - - if (true_label == 0) { - genlabels = 1; - true_label = ++text_label; - false_label = ++text_label; - l_end = ++text_label; - } - - Des = InitDesig; - if (expr->nd_symb == OR) { - CodeExpr(leftop, &Des, true_label, l_maybe); - } - else CodeExpr(leftop, &Des, l_maybe, false_label); - C_df_ilb(l_maybe); - Des = InitDesig; - CodeExpr(rightop, &Des, true_label, false_label); - if (genlabels) { - C_df_ilb(true_label); - C_loc((arith)1); - C_bra(l_end); - C_df_ilb(false_label); - C_loc((arith)0); - C_df_ilb(l_end); - } - break; - } - default: - crash("(CodeOper) Bad operator %s\n",symbol2str(expr->nd_symb)); - } -} - -/* compare() serves as an auxiliary function of CodeOper */ -compare(relop, lbl) - int relop; - register label lbl; -{ - switch (relop) { - case '<': - C_zlt(lbl); - break; - case LESSEQUAL: - C_zle(lbl); - break; - case '>': - C_zgt(lbl); - break; - case GREATEREQUAL: - C_zge(lbl); - break; - case '=': - C_zeq(lbl); - break; - case '#': - C_zne(lbl); - break; - default: - crash("(compare)"); - } -} - -/* truthvalue() serves as an auxiliary function of CodeOper */ -truthvalue(relop) - int relop; -{ - switch (relop) { - case '<': - C_tlt(); - break; - case LESSEQUAL: - C_tle(); - break; - case '>': - C_tgt(); - break; - case GREATEREQUAL: - C_tge(); - break; - case '=': - C_teq(); - break; - case '#': - C_tne(); - break; - default: - crash("(truthvalue)"); - } -} - -CodeUoper(nd) - register struct node *nd; -{ - register struct type *tp = nd->nd_type; - - CodePExpr(nd->nd_right); - switch(nd->nd_symb) { - case '~': - case NOT: - C_teq(); - break; - case '-': - switch(tp->tp_fund) { - case T_INTEGER: - case T_INTORCARD: - C_ngi(tp->tp_size); - break; - case T_REAL: - C_ngf(tp->tp_size); - break; - default: - crash("Bad operand to unary -"); - } - break; - default: - crash("Bad unary operator"); - } -} - -CodeSet(nd) - register struct node *nd; -{ - register struct type *tp = nd->nd_type; - - C_zer(tp->tp_size); /* empty set */ - nd = nd->nd_right; - while (nd) { - assert(nd->nd_class == Link && nd->nd_symb == ','); - - CodeEl(nd->nd_left, tp); - nd = nd->nd_right; - } -} - -CodeEl(nd, tp) - register struct node *nd; - register struct type *tp; -{ - register struct type *eltype = ElementType(tp); - - if (nd->nd_class == Link && nd->nd_symb == UPTO) { - C_loc(tp->tp_size); /* push size */ - if (eltype->tp_fund == T_SUBRANGE) { - C_loc(eltype->sub_ub); - } - else C_loc((arith) (eltype->enm_ncst - 1)); - Operands(nd->nd_left, nd->nd_right, word_type); - C_cal("_LtoUset"); /* library routine to fill set */ - C_asp(4 * word_size); - } - else { - CodePExpr(nd); - C_set(tp->tp_size); - C_ior(tp->tp_size); - } -} - -CodePExpr(nd) - register struct node *nd; -{ - /* Generate code to push the value of the expression "nd" - on the stack. - */ - struct desig designator; - - designator = InitDesig; - CodeExpr(nd, &designator, NO_LABEL, NO_LABEL); - CodeValue(&designator, nd->nd_type->tp_size, nd->nd_type->tp_align); -} - -CodeDAddress(nd) - struct node *nd; -{ - /* Generate code to push the address of the designator "nd" - on the stack. - */ - - struct desig designator; - - designator = InitDesig; - CodeDesig(nd, &designator); - CodeAddress(&designator); -} - -CodeDStore(nd) - register struct node *nd; -{ - /* Generate code to store the expression on the stack into the - designator "nd". - */ - - struct desig designator; - - designator = InitDesig; - CodeDesig(nd, &designator); - CodeStore(&designator, nd->nd_type->tp_size, nd->nd_type->tp_align); -} - -DoHIGH(nd) - struct node *nd; -{ - /* Get the high index of a conformant array, indicated by "nd". - The high index is the second field in the descriptor of - the array, so it is easily found. - */ - register struct def *df = nd->nd_def; - register arith highoff; - - assert(nd->nd_class == Def); - assert(df->df_kind == D_VARIABLE); - assert(IsConformantArray(df->df_type)); - - highoff = df->var_off /* base address and descriptor */ - + 2 * word_size; /* skip base and first field of - descriptor - */ - if (df->df_scope->sc_level < proclevel) { - C_lxa((arith) (proclevel - df->df_scope->sc_level)); - C_lof(highoff); - } - else C_lol(highoff); -} diff --git a/lang/m2/comp/const.h b/lang/m2/comp/const.h deleted file mode 100644 index 378748082..000000000 --- a/lang/m2/comp/const.h +++ /dev/null @@ -1,11 +0,0 @@ -/* C O N S T A N T S F O R E X P R E S S I O N H A N D L I N G */ - -extern long - mach_long_sign; /* sign bit of the machine long */ -extern int - mach_long_size; /* size of long on this machine == sizeof(long) */ -extern arith - max_int, /* maximum integer on target machine */ - max_unsigned, /* maximum unsigned on target machine */ - max_longint, /* maximum longint on target machine */ - wrd_bits; /* Number of bits in a word */ diff --git a/lang/m2/comp/cstoper.c b/lang/m2/comp/cstoper.c deleted file mode 100644 index 878bc2c6f..000000000 --- a/lang/m2/comp/cstoper.c +++ /dev/null @@ -1,556 +0,0 @@ -/* C O N S T A N T E X P R E S S I O N H A N D L I N G */ - -#include "debug.h" -#include "target_sizes.h" - -#include -#include -#include - -#include "idf.h" -#include "type.h" -#include "LLlex.h" -#include "node.h" -#include "Lpars.h" -#include "standards.h" -#include "warning.h" - -long mach_long_sign; /* sign bit of the machine long */ -int mach_long_size; /* size of long on this machine == sizeof(long) */ -long full_mask[MAXSIZE];/* full_mask[1] == 0xFF, full_mask[2] == 0xFFFF, .. */ -arith max_int; /* maximum integer on target machine */ -arith max_unsigned; /* maximum unsigned on target machine */ -arith max_longint; /* maximum longint on target machine */ -arith wrd_bits; /* number of bits in a word */ - -static char ovflow[] = "overflow in constant expression"; - -cstunary(expp) - register struct node *expp; -{ - /* The unary operation in "expp" is performed on the constant - expression below it, and the result restored in expp. - */ - register arith o1 = expp->nd_right->nd_INT; - - switch(expp->nd_symb) { - /* Should not get here - case '+': - break; - */ - - case '-': - o1 = -o1; - if (expp->nd_type->tp_fund == T_INTORCARD) { - expp->nd_type = int_type; - } - break; - - case NOT: - case '~': - o1 = !o1; - break; - - default: - crash("(cstunary)"); - } - - expp->nd_class = Value; - expp->nd_token = expp->nd_right->nd_token; - expp->nd_INT = o1; - CutSize(expp); - FreeNode(expp->nd_right); - expp->nd_right = 0; -} - -cstbin(expp) - register struct node *expp; -{ - /* The binary operation in "expp" is performed on the constant - expressions below it, and the result restored in - expp. - */ - register arith o1 = expp->nd_left->nd_INT; - register arith o2 = expp->nd_right->nd_INT; - register int uns = expp->nd_left->nd_type != int_type; - - assert(expp->nd_class == Oper); - assert(expp->nd_left->nd_class == Value); - assert(expp->nd_right->nd_class == Value); - - switch (expp->nd_symb) { - case '*': - o1 *= o2; - break; - - case DIV: - if (o2 == 0) { - node_error(expp, "division by 0"); - return; - } - if (uns) { - /* this is more of a problem than you might - think on C compilers which do not have - unsigned long. - */ - if (o2 & mach_long_sign) {/* o2 > max_long */ - o1 = ! (o1 >= 0 || o1 < o2); - /* this is the unsigned test - o1 < o2 for o2 > max_long - */ - } - else { /* o2 <= max_long */ - long half, bit, hdiv, hrem, rem; - - half = (o1 >> 1) & ~mach_long_sign; - bit = o1 & 01; - /* now o1 == 2 * half + bit - and half <= max_long - and bit <= max_long - */ - hdiv = half / o2; - hrem = half % o2; - rem = 2 * hrem + bit; - o1 = 2 * hdiv + (rem < 0 || rem >= o2); - /* that is the unsigned compare - rem >= o2 for o2 <= max_long - */ - } - } - else - o1 /= o2; - break; - - case MOD: - if (o2 == 0) { - node_error(expp, "modulo by 0"); - return; - } - if (uns) { - if (o2 & mach_long_sign) {/* o2 > max_long */ - o1 = (o1 >= 0 || o1 < o2) ? o1 : o1 - o2; - /* this is the unsigned test - o1 < o2 for o2 > max_long - */ - } - else { /* o2 <= max_long */ - long half, bit, hrem, rem; - - half = (o1 >> 1) & ~mach_long_sign; - bit = o1 & 01; - /* now o1 == 2 * half + bit - and half <= max_long - and bit <= max_long - */ - hrem = half % o2; - rem = 2 * hrem + bit; - o1 = (rem < 0 || rem >= o2) ? rem - o2 : rem; - } - } - else - o1 %= o2; - break; - - case '+': - o1 += o2; - break; - - case '-': - o1 -= o2; - if (expp->nd_type->tp_fund == T_INTORCARD) { - if (o1 < 0) expp->nd_type = int_type; - } - break; - - case '<': - { arith tmp = o1; - - o1 = o2; - o2 = tmp; - } - /* Fall through */ - - case '>': - if (uns) { - o1 = (o1 & mach_long_sign ? - (o2 & mach_long_sign ? o1 > o2 : 1) : - (o2 & mach_long_sign ? 0 : o1 > o2) - ); - } - else - o1 = (o1 > o2); - break; - - case LESSEQUAL: - { arith tmp = o1; - - o1 = o2; - o2 = tmp; - } - /* Fall through */ - - case GREATEREQUAL: - if (uns) { - o1 = (o1 & mach_long_sign ? - (o2 & mach_long_sign ? o1 >= o2 : 1) : - (o2 & mach_long_sign ? 0 : o1 >= o2) - ); - } - else - o1 = (o1 >= o2); - break; - - case '=': - o1 = (o1 == o2); - break; - - case '#': - o1 = (o1 != o2); - break; - - case AND: - case '&': - o1 = (o1 && o2); - break; - - case OR: - o1 = (o1 || o2); - break; - - default: - crash("(cstbin)"); - } - - expp->nd_class = Value; - expp->nd_token = expp->nd_right->nd_token; - if (expp->nd_type == bool_type) expp->nd_symb = INTEGER; - expp->nd_INT = o1; - CutSize(expp); - FreeNode(expp->nd_left); - FreeNode(expp->nd_right); - expp->nd_left = expp->nd_right = 0; -} - -cstset(expp) - register struct node *expp; -{ - register arith *set1, *set2; - arith *resultset = 0; - register int setsize, j; - - assert(expp->nd_right->nd_class == Set); - assert(expp->nd_symb == IN || expp->nd_left->nd_class == Set); - set2 = expp->nd_right->nd_set; - setsize = expp->nd_right->nd_type->tp_size / word_size; - - if (expp->nd_symb == IN) { - arith i; - - assert(expp->nd_left->nd_class == Value); - - i = expp->nd_left->nd_INT; - expp->nd_class = Value; - expp->nd_INT = (i >= 0 && set2 != 0 && - i < setsize * wrd_bits && - (set2[i / wrd_bits] & (1 << (i % wrd_bits)))); - if (set2) free((char *) set2); - } - else { - set1 = expp->nd_left->nd_set; - resultset = set1; - expp->nd_left->nd_set = 0; - switch(expp->nd_symb) { - case '+': - /* Set union - */ - if (!set1) { - resultset = set2; - expp->nd_right->nd_set = 0; - break; - } - if (set2) for (j = 0; j < setsize; j++) { - *set1++ |= *set2++; - } - break; - - case '-': - /* Set difference - */ - if (!set1 || !set2) { - /* The set from which something is substracted - is already empty, or the set that is - substracted is empty. In either case, the - result set is set1. - */ - break; - } - for (j = 0; j < setsize; j++) { - *set1++ &= ~*set2++; - } - break; - - case '*': - /* Set intersection - */ - if (!set1) { - /* set1 is empty, and so is the result set - */ - break; - } - if (!set2) { - /* set 2 is empty, so the result set must be - empty too. - */ - resultset = set2; - expp->nd_right->nd_set = 0; - break; - } - for (j = 0; j < setsize; j++) { - *set1++ &= *set2++; - } - break; - - case '/': - /* Symmetric set difference - */ - if (!set1) { - resultset = set2; - expp->nd_right->nd_set = 0; - break; - } - if (set2) { - for (j = 0; j < setsize; j++) { - *set1++ ^= *set2++; - } - } - break; - - case GREATEREQUAL: - case LESSEQUAL: - case '=': - case '#': - /* Constant set comparisons - */ - expp->nd_left->nd_set = set1; /* may be disposed of */ - for (j = 0; j < setsize; j++) { - switch(expp->nd_symb) { - case GREATEREQUAL: - if (!set2) {j = setsize; break; } - if (!set1) break; - if ((*set1 | *set2++) != *set1) break; - set1++; - continue; - case LESSEQUAL: - if (!set1) {j = setsize; break; } - if (!set2) break; - if ((*set2 | *set1++) != *set2) break; - set2++; - continue; - case '=': - case '#': - if (!set1 && !set2) { - j = setsize; break; - } - if (!set1 || !set2) break; - if (*set1++ != *set2++) break; - continue; - } - if (j < setsize) { - expp->nd_INT = expp->nd_symb == '#'; - } - else { - expp->nd_INT = expp->nd_symb != '#'; - } - break; - } - expp->nd_class = Value; - expp->nd_symb = INTEGER; - if (expp->nd_left->nd_set) { - free((char *) expp->nd_left->nd_set); - } - if (expp->nd_right->nd_set) { - free((char *) expp->nd_right->nd_set); - } - FreeNode(expp->nd_left); - FreeNode(expp->nd_right); - expp->nd_left = expp->nd_right = 0; - return; - default: - crash("(cstset)"); - } - if (expp->nd_right->nd_set) { - free((char *) expp->nd_right->nd_set); - } - if (expp->nd_left->nd_set) { - free((char *) expp->nd_left->nd_set); - } - expp->nd_class = Set; - expp->nd_set = resultset; - } - FreeNode(expp->nd_left); - FreeNode(expp->nd_right); - expp->nd_left = expp->nd_right = 0; -} - -cstcall(expp, call) - register struct node *expp; -{ - /* a standard procedure call is found that can be evaluated - compile time, so do so. - */ - register struct node *expr = 0; - - assert(expp->nd_class == Call); - - if (expp->nd_right) { - expr = expp->nd_right->nd_left; - expp->nd_right->nd_left = 0; - FreeNode(expp->nd_right); - } - - expp->nd_class = Value; - expp->nd_symb = INTEGER; - switch(call) { - case S_ABS: - if (expr->nd_INT < 0) expp->nd_INT = - expr->nd_INT; - else expp->nd_INT = expr->nd_INT; - CutSize(expp); - break; - - case S_CAP: - if (expr->nd_INT >= 'a' && expr->nd_INT <= 'z') { - expp->nd_INT = expr->nd_INT + ('A' - 'a'); - } - else expp->nd_INT = expr->nd_INT; - CutSize(expp); - break; - - case S_CHR: - expp->nd_INT = expr->nd_INT; - CutSize(expp); - break; - - case S_MAX: - if (expp->nd_type == int_type) { - expp->nd_INT = max_int; - } - else if (expp->nd_type == longint_type) { - expp->nd_INT = max_longint; - } - else if (expp->nd_type == card_type) { - expp->nd_INT = max_unsigned; - } - else if (expp->nd_type->tp_fund == T_SUBRANGE) { - expp->nd_INT = expp->nd_type->sub_ub; - } - else expp->nd_INT = expp->nd_type->enm_ncst - 1; - break; - - case S_MIN: - if (expp->nd_type == int_type) { - expp->nd_INT = (-max_int) - 1; - } - else if (expp->nd_type == longint_type) { - expp->nd_INT = (-max_longint) - 1; - } - else if (expp->nd_type->tp_fund == T_SUBRANGE) { - expp->nd_INT = expp->nd_type->sub_lb; - } - else expp->nd_INT = 0; - break; - - case S_ODD: - expp->nd_INT = (expr->nd_INT & 1); - break; - - case S_ORD: - expp->nd_INT = expr->nd_INT; - CutSize(expp); - break; - - case S_SIZE: - expp->nd_INT = expr->nd_type->tp_size; - break; - - case S_VAL: - expp->nd_INT = expr->nd_INT; - if ( /* Check overflow of subranges or enumerations */ - ( expp->nd_type->tp_fund == T_SUBRANGE - && - ( expp->nd_INT < expp->nd_type->sub_lb - || expp->nd_INT > expp->nd_type->sub_ub - ) - ) - || - ( expp->nd_type->tp_fund == T_ENUMERATION - && - ( expp->nd_INT < 0 - || expp->nd_INT >= expp->nd_type->enm_ncst - ) - ) - ) node_warning(expp, W_ORDINARY, ovflow); - else CutSize(expp); - break; - - default: - crash("(cstcall)"); - } - FreeNode(expr); - FreeNode(expp->nd_left); - expp->nd_right = expp->nd_left = 0; -} - -CutSize(expr) - register struct node *expr; -{ - /* The constant value of the expression expr is made to - conform to the size of the type of the expression. - */ - register arith o1 = expr->nd_INT; - register struct type *tp = BaseType(expr->nd_type); - int uns; - int size = tp->tp_size; - - assert(expr->nd_class == Value); - uns = (tp->tp_fund & (T_CARDINAL|T_CHAR)); - if (uns) { - if (o1 & ~full_mask[size]) { - node_warning(expr, W_ORDINARY, ovflow); - o1 &= full_mask[size]; - } - } - else { - int nbits = (int) (mach_long_size - size) * 8; - long remainder = o1 & ~full_mask[size]; - - if (remainder != 0 && remainder != ~full_mask[size]) { - node_warning(expr, W_ORDINARY, ovflow); - o1 <<= nbits; - o1 >>= nbits; - } - } - expr->nd_INT = o1; -} - -InitCst() -{ - register int i = 0; - register arith bt = (arith)0; - - while (!(bt < 0)) { - bt = (bt << 8) + 0377, i++; - if (i == MAXSIZE) - fatal("array full_mask too small for this machine"); - full_mask[i] = bt; - } - mach_long_size = i; - mach_long_sign = 1 << (mach_long_size * 8 - 1); - if (long_size > mach_long_size) { - fatal("sizeof (long) insufficient on this machine"); - } - - max_int = full_mask[int_size] & ~(1 << (int_size * 8 - 1)); - max_unsigned = full_mask[int_size]; - max_longint = full_mask[long_size] & ~(1 << (long_size * 8 - 1)); - wrd_bits = 8 * word_size; -} diff --git a/lang/m2/comp/debug.h b/lang/m2/comp/debug.h deleted file mode 100644 index 670c29d18..000000000 --- a/lang/m2/comp/debug.h +++ /dev/null @@ -1,10 +0,0 @@ -/* A debugging macro -*/ - -#include "debugcst.h" - -#ifdef DEBUG -#define DO_DEBUG(x, y) ((x) && (y)) -#else -#define DO_DEBUG(x, y) -#endif diff --git a/lang/m2/comp/declar.g b/lang/m2/comp/declar.g deleted file mode 100644 index 12a6e0689..000000000 --- a/lang/m2/comp/declar.g +++ /dev/null @@ -1,546 +0,0 @@ -/* D E C L A R A T I O N S */ - -{ -#include "debug.h" - -#include -#include -#include -#include - -#include "idf.h" -#include "LLlex.h" -#include "def.h" -#include "type.h" -#include "scope.h" -#include "node.h" -#include "misc.h" -#include "main.h" -#include "chk_expr.h" -#include "warning.h" - -int proclevel = 0; /* nesting level of procedures */ -int return_occurred; /* set if a return occurs in a block */ -} - -ProcedureDeclaration -{ - struct def *df; -} : - { ++proclevel; } - ProcedureHeading(&df, D_PROCEDURE) - ';' block(&(df->prc_body)) - IDENT - { EndProc(df, dot.TOK_IDF); - --proclevel; - } -; - -ProcedureHeading(struct def **pdf; int type;) -{ - struct type *tp = 0; -#define needs_static_link() (proclevel > 1) - arith parmaddr = needs_static_link() ? pointer_size : 0; - struct paramlist *pr = 0; -} : - PROCEDURE IDENT - { *pdf = DeclProc(type, dot.TOK_IDF); } - FormalParameters(&pr, &parmaddr, &tp)? - { CheckWithDef(*pdf, proc_type(tp, pr, parmaddr)); - if (tp && IsConstructed(tp)) { -warning(W_STRICT, "procedure \"%s\" has a constructed result type", - (*pdf)->df_idf->id_text); - } - } -; - -block(struct node **pnd;) : - [ %persistent - declaration - ]* - { return_occurred = 0; *pnd = 0; } - [ %persistent - BEGIN - StatementSequence(pnd) - ]? - END -; - -declaration: - CONST [ %persistent ConstantDeclaration ';' ]* -| - TYPE [ %persistent TypeDeclaration ';' ]* -| - VAR [ %persistent VariableDeclaration ';' ]* -| - ProcedureDeclaration ';' -| - ModuleDeclaration ';' -; - -FormalParameters(struct paramlist **ppr; arith *parmaddr; struct type **ptp;): - '(' - [ - FPSection(ppr, parmaddr) - [ - ';' FPSection(ppr, parmaddr) - ]* - ]? - ')' - [ ':' qualtype(ptp) - ]? -; - -FPSection(struct paramlist **ppr; arith *parmaddr;) -{ - struct node *FPList; - struct type *tp; - int VARp; -} : - var(&VARp) IdentList(&FPList) ':' FormalType(&tp) - { EnterParamList(ppr, FPList, tp, VARp, parmaddr); } -; - -FormalType(struct type **ptp;) -{ - extern arith ArrayElSize(); -} : - ARRAY OF qualtype(ptp) - { register struct type *tp = construct_type(T_ARRAY, NULLTYPE); - - tp->arr_elem = *ptp; - *ptp = tp; - tp->arr_elsize = ArrayElSize(tp->arr_elem); - tp->tp_align = tp->arr_elem->tp_align; - } -| - qualtype(ptp) -; - -TypeDeclaration -{ - struct def *df; - struct type *tp; - struct node *nd; -}: - IDENT { df = define(dot.TOK_IDF, CurrentScope, D_TYPE); - nd = MkLeaf(Name, &dot); - } - '=' type(&tp) - { DeclareType(nd, df, tp); - free_node(nd); - } -; - -type(struct type **ptp;): - %default SimpleType(ptp) -| - ArrayType(ptp) -| - RecordType(ptp) -| - SetType(ptp) -| - PointerType(ptp) -| - ProcedureType(ptp) -; - -SimpleType(struct type **ptp;) -{ - struct type *tp; -} : - qualtype(ptp) - [ - /* nothing */ - | - SubrangeType(&tp) - /* The subrange type is given a base type by the - qualident (this is new modula-2). - */ - { chk_basesubrange(tp, *ptp); } - ] -| - enumeration(ptp) -| - SubrangeType(ptp) -; - -enumeration(struct type **ptp;) -{ - struct node *EnumList; -} : - '(' IdentList(&EnumList) ')' - { register struct type *tp = - standard_type(T_ENUMERATION, int_align, int_size); - - *ptp = tp; - EnterEnumList(EnumList, tp); - if (ufit(tp->enm_ncst-1, 1)) { - tp->tp_size = 1; - tp->tp_align = 1; - } - else if (ufit(tp->enm_ncst-1, short_size)) { - tp->tp_size = short_size; - tp->tp_align = short_align; - } - } -; - -IdentList(struct node **p;) -{ - register struct node *q; -} : - IDENT { *p = q = MkLeaf(Value, &dot); } - [ %persistent - ',' IDENT - { q->next = MkLeaf(Value, &dot); - q = q->next; - } - ]* - { q->next = 0; } -; - -SubrangeType(struct type **ptp;) -{ - struct node *nd1, *nd2; -}: - /* - This is not exactly the rule in the new report, but see - the rule for "SimpleType". - */ - '[' ConstExpression(&nd1) - UPTO ConstExpression(&nd2) - ']' - { *ptp = subr_type(nd1, nd2); - free_node(nd1); - free_node(nd2); - } -; - -ArrayType(struct type **ptp;) -{ - struct type *tp; - register struct type *tp2; -} : - ARRAY SimpleType(&tp) - { *ptp = tp2 = construct_type(T_ARRAY, tp); } - [ - ',' SimpleType(&tp) - { tp2->arr_elem = construct_type(T_ARRAY, tp); - tp2 = tp2->arr_elem; - } - ]* OF type(&tp) - { tp2->arr_elem = tp; - ArraySizes(*ptp); - } -; - -RecordType(struct type **ptp;) -{ - register struct scope *scope; - arith size = 0; - int xalign = struct_align; -} -: - RECORD - { open_scope(OPENSCOPE); /* scope for fields of record */ - scope = CurrentScope; - close_scope(0); - } - FieldListSequence(scope, &size, &xalign) - { if (size == 0) { - warning(W_ORDINARY, "empty record declaration"); - size = 1; - } - *ptp = standard_type(T_RECORD, xalign, size); - (*ptp)->rec_scope = scope; - } - END -; - -FieldListSequence(struct scope *scope; arith *cnt; int *palign;): - FieldList(scope, cnt, palign) - [ - ';' FieldList(scope, cnt, palign) - ]* -; - -FieldList(struct scope *scope; arith *cnt; int *palign;) -{ - struct node *FldList; - register struct idf *id = 0; - struct type *tp; - struct node *nd1; - register struct node *nd; - arith tcnt, max; -} : -[ - IdentList(&FldList) ':' type(&tp) - { *palign = lcm(*palign, tp->tp_align); - EnterFieldList(FldList, tp, scope, cnt); - } -| - CASE - /* Also accept old fashioned Modula-2 syntax, but give a warning. - Sorry for the complicated code. - */ - [ qualident(&nd1) - { nd = nd1; } - [ ':' qualtype(&tp) - /* This is correct, in both kinds of Modula-2, if - the first qualident is a single identifier. - */ - { if (nd->nd_class != Name) { - error("illegal variant tag"); - } - else id = nd->nd_IDF; - FreeNode(nd); - } - | /* Old fashioned! the first qualident now represents - the type - */ - { warning(W_OLDFASHIONED, "old fashioned Modula-2 syntax; ':' missing"); - if (ChkDesignator(nd) && - (nd->nd_class != Def || - !(nd->nd_def->df_kind&(D_ERROR|D_ISTYPE)) || - !nd->nd_def->df_type)) { - node_error(nd, "type expected"); - tp = error_type; - } - else tp = nd->nd_def->df_type; - FreeNode(nd); - } - ] - | ':' qualtype(&tp) - /* Aha, third edition. Well done! */ - ] - { if (id) { - register struct def *df = define(id, - scope, - D_FIELD); - if (!(tp->tp_fund & T_DISCRETE)) { - error("illegal type in variant"); - } - df->df_type = tp; - df->fld_off = align(*cnt, tp->tp_align); - *cnt = df->fld_off + tp->tp_size; - df->df_flags |= D_QEXPORTED; - } - tcnt = *cnt; - } - OF variant(scope, &tcnt, tp, palign) - { max = tcnt; tcnt = *cnt; } - [ - '|' variant(scope, &tcnt, tp, palign) - { if (tcnt > max) max = tcnt; tcnt = *cnt; } - ]* - [ ELSE FieldListSequence(scope, &tcnt, palign) - { if (tcnt > max) max = tcnt; } - ]? - END - { *cnt = max; } -]? -; - -variant(struct scope *scope; arith *cnt; struct type *tp; int *palign;) -{ - struct node *nd; -} : - [ - CaseLabelList(&tp, &nd) - { /* Ignore the cases for the time being. - Maybe a checking version will be supplied - later ??? (Improbable) - */ - FreeNode(nd); - } - ':' FieldListSequence(scope, cnt, palign) - ]? - /* Changed rule in new modula-2 */ -; - -CaseLabelList(struct type **ptp; struct node **pnd;): - CaseLabels(ptp, pnd) - [ - { *pnd = MkNode(Link, *pnd, NULLNODE, &dot); } - ',' CaseLabels(ptp, &((*pnd)->nd_right)) - { pnd = &((*pnd)->nd_right); } - ]* -; - -CaseLabels(struct type **ptp; register struct node **pnd;) -{ - register struct node *nd1; -}: - ConstExpression(pnd) - { nd1 = *pnd; } - [ - UPTO { *pnd = MkNode(Link,nd1,NULLNODE,&dot); } - ConstExpression(&(*pnd)->nd_right) - { if (!TstCompat(nd1->nd_type, - (*pnd)->nd_right->nd_type)) { - node_error((*pnd)->nd_right, - "type incompatibility in case label"); - nd1->nd_type = error_type; - } - } - ]? - { if (*ptp != 0 && !TstCompat(*ptp, nd1->nd_type)) { - node_error(nd1, - "type incompatibility in case label"); - } - *ptp = nd1->nd_type; - } -; - -SetType(struct type **ptp;) : - SET OF SimpleType(ptp) - { *ptp = set_type(*ptp); } -; - -/* In a pointer type definition, the type pointed at does not - have to be declared yet, so be careful about identifying - type-identifiers -*/ -PointerType(struct type **ptp;) -{ - register struct node *nd = 0; -} : - POINTER TO - { *ptp = construct_type(T_POINTER, NULLTYPE); } - [ %if ( lookup(dot.TOK_IDF, CurrentScope, 1) - /* Either a Module or a Type, but in both cases defined - in this scope, so this is the correct identification - */ - || - ( nd = new_node(), - nd->nd_token = dot, - lookfor(nd, CurrVis, 0)->df_kind == D_MODULE - ) - /* A Modulename in one of the enclosing scopes. - It is not clear from the language definition that - it is correct to handle these like this, but - existing compilers do it like this, and the - alternative is difficult with a lookahead of only - one token. - ??? - */ - ) - type(&((*ptp)->next)) - { if (nd) free_node(nd); } - | - IDENT { if (nd) { - /* nd could be a null pointer, if we had a - syntax error exactly at this alternation. - MORAL: Be careful with %if resolvers with - side effects! - */ - Forward(nd, (*ptp)); - } - } - ] -; - -qualtype(struct type **ptp;) -{ - register struct node *nd; - struct node *nd1; /* because &nd is illegal */ -} : - qualident(&nd1) - { nd = nd1; - *ptp = error_type; - if (ChkDesignator(nd)) { - if (nd->nd_class != Def) { - node_error(nd, "type expected"); - } - else { - register struct def *df = nd->nd_def; - - if (df->df_kind&(D_ISTYPE|D_FORWARD|D_ERROR)) { - if (! df->df_type) { -node_error(nd,"type \"%s\" not (yet) declared", df->df_idf->id_text); - } - else *ptp = df->df_type; - } - else { -node_error(nd,"identifier \"%s\" is not a type", df->df_idf->id_text); - } - } - } - FreeNode(nd); - } -; - -ProcedureType(struct type **ptp;) -{ - struct paramlist *pr = 0; - arith parmaddr = 0; -} -: - { *ptp = 0; } - PROCEDURE - [ - FormalTypeList(&pr, &parmaddr, ptp) - ]? - { *ptp = proc_type(*ptp, pr, parmaddr); } -; - -FormalTypeList(struct paramlist **ppr; arith *parmaddr; struct type **ptp;) -{ - struct type *tp; - int VARp; -} : - '(' - [ - var(&VARp) FormalType(&tp) - { EnterParamList(ppr,NULLNODE,tp,VARp,parmaddr); } - [ - ',' var(&VARp) FormalType(&tp) - { EnterParamList(ppr,NULLNODE,tp,VARp,parmaddr); } - ]* - ]? - ')' - [ ':' qualtype(ptp) - ]? -; - -var(int *VARp;): - VAR { *VARp = D_VARPAR; } -| - /* empty */ { *VARp = D_VALPAR; } -; - -ConstantDeclaration -{ - struct idf *id; - struct node *nd; -}: - IDENT { id = dot.TOK_IDF; } - '=' ConstExpression(&nd) - { define(id,CurrentScope,D_CONST)->con_const = nd; } -; - -VariableDeclaration -{ - struct node *VarList; - register struct node *nd; - struct type *tp; -} : - IdentAddr(&VarList) - { nd = VarList; } - [ %persistent - ',' IdentAddr(&(nd->nd_right)) - { nd = nd->nd_right; } - ]* - ':' type(&tp) - { EnterVarList(VarList, tp, proclevel > 0); } -; - -IdentAddr(struct node **pnd;) : - IDENT { *pnd = MkLeaf(Name, &dot); } - [ '[' - ConstExpression(&((*pnd)->nd_left)) - ']' - ]? -; diff --git a/lang/m2/comp/def.H b/lang/m2/comp/def.H deleted file mode 100644 index 3462d4b25..000000000 --- a/lang/m2/comp/def.H +++ /dev/null @@ -1,135 +0,0 @@ -/* I D E N T I F I E R D E S C R I P T O R S T R U C T U R E */ - -struct module { - struct node *mo_priority;/* priority of a module */ - struct scopelist *mo_vis;/* scope of this module */ - struct node *mo_body; /* body of this module */ -#define mod_priority df_value.df_module.mo_priority -#define mod_vis df_value.df_module.mo_vis -#define mod_body df_value.df_module.mo_body -}; - -struct variable { - arith va_off; /* address or offset of variable */ - char *va_name; /* name of variable if given */ - char va_addrgiven; /* an address was given in the program */ -#define var_off df_value.df_variable.va_off -#define var_name df_value.df_variable.va_name -#define var_addrgiven df_value.df_variable.va_addrgiven -}; - -struct constant { - struct node *co_const; /* result of a constant expression */ -#define con_const df_value.df_constant.co_const -}; - -struct enumval { - unsigned int en_val; /* value of this enumeration literal */ - struct def *en_next; /* next enumeration literal */ -#define enm_val df_value.df_enum.en_val -#define enm_next df_value.df_enum.en_next -}; - -struct field { - arith fd_off; - struct variant { - struct caselabellist *v_cases; - label v_casedescr; - struct def *v_varianttag; - } *fd_variant; -#define fld_off df_value.df_field.fd_off -#define fld_variant df_value.df_field.fd_variant -}; - -struct dfproc { - struct scopelist *pr_vis; /* scope of procedure */ - struct node *pr_body; /* body of this procedure */ -#define prc_vis df_value.df_proc.pr_vis -#define prc_body df_value.df_proc.pr_body -#define NameOfProc(xdf) ((xdf)->prc_vis->sc_scope->sc_name) -}; - -struct import { - struct def *im_def; /* imported definition */ -#define imp_def df_value.df_import.im_def -}; - -struct dforward { - struct scopelist *fo_vis; - struct node *fo_node; - char *fo_name; -#define for_node df_value.df_forward.fo_node -#define for_vis df_value.df_forward.fo_vis -#define for_name df_value.df_forward.fo_name -}; - -struct forwtype { - struct node *f_node; - struct type *f_type; -#define df_forw_type df_value.df_fortype.f_type -#define df_forw_node df_value.df_fortype.f_node -}; - -struct def { /* list of definitions for a name */ - struct def *next; /* next definition in definitions chain */ - struct def *df_nextinscope; - /* link all definitions in a scope */ - struct idf *df_idf; /* link back to the name */ - struct scope *df_scope; /* scope in which this definition resides */ - unsigned short df_kind; /* the kind of this definition: */ -#define D_MODULE 0x0001 /* a module */ -#define D_PROCEDURE 0x0002 /* procedure of function */ -#define D_VARIABLE 0x0004 /* a variable */ -#define D_FIELD 0x0008 /* a field in a record */ -#define D_TYPE 0x0010 /* a type */ -#define D_ENUM 0x0020 /* an enumeration literal */ -#define D_CONST 0x0040 /* a constant */ -#define D_IMPORT 0x0080 /* an imported definition */ -#define D_PROCHEAD 0x0100 /* a procedure heading in a definition module */ -#define D_HIDDEN 0x0200 /* a hidden type */ -#define D_FORWARD 0x0400 /* not yet defined */ -#define D_FORWMODULE 0x0800 /* module must be declared later */ -#define D_FORWTYPE 0x1000 /* forward type */ -#define D_FTYPE 0x2000 /* resolved forward type */ -#define D_ERROR 0x4000 /* a compiler generated definition for an - undefined variable - */ -#define D_VALUE (D_PROCEDURE|D_VARIABLE|D_FIELD|D_ENUM|D_CONST|D_PROCHEAD) -#define D_ISTYPE (D_HIDDEN|D_TYPE|D_FTYPE) -#define is_type(dfx) ((dfx)->df_kind & D_ISTYPE) - unsigned short df_flags; -#define D_NOREG 0x01 /* set if it may not reside in a register */ -#define D_USED 0x02 /* set if used (future use ???) */ -#define D_DEFINED 0x04 /* set if it is assigned a value (future use ???) */ -#define D_VARPAR 0x08 /* set if it is a VAR parameter */ -#define D_VALPAR 0x10 /* set if it is a value parameter */ -#define D_EXPORTED 0x20 /* set if exported */ -#define D_QEXPORTED 0x40 /* set if qualified exported */ -#define D_BUSY 0x80 /* set if busy reading this definition module */ - struct type *df_type; - union { - struct module df_module; - struct variable df_variable; - struct constant df_constant; - struct enumval df_enum; - struct field df_field; - struct import df_import; - struct dfproc df_proc; - struct dforward df_forward; - struct forwtype df_fortype; - int df_stdname; /* define for standard name */ - } df_value; -}; - -/* ALLOCDEF "def" 50 */ - -extern struct def - *define(), - *DefineLocalModule(), - *MkDef(), - *DeclProc(); - -extern struct def - *lookup(), - *lookfor(); -#define NULLDEF ((struct def *) 0) diff --git a/lang/m2/comp/def.c b/lang/m2/comp/def.c deleted file mode 100644 index 40d613eb4..000000000 --- a/lang/m2/comp/def.c +++ /dev/null @@ -1,364 +0,0 @@ -/* D E F I N I T I O N M E C H A N I S M */ - -#include "debug.h" - -#include -#include -#include -#include - -#include "main.h" -#include "def.h" -#include "type.h" -#include "idf.h" -#include "scope.h" -#include "LLlex.h" -#include "node.h" -#include "Lpars.h" - -extern int (*c_inp)(); - -STATIC -DefInFront(df) - register struct def *df; -{ - /* Put definition "df" in front of the list of definitions - in its scope. - This is neccessary because in some cases the order in this - list is important. - */ - register struct def *df1 = df->df_scope->sc_def; - - if (df1 != df) { - /* Definition "df" is not in front of the list - */ - while (df1) { - /* Find definition "df" - */ - if (df1->df_nextinscope == df) { - /* It already was in the list. Remove it - */ - df1->df_nextinscope = df->df_nextinscope; - break; - } - df1 = df1->df_nextinscope; - } - - /* Now put it in front - */ - df->df_nextinscope = df->df_scope->sc_def; - df->df_scope->sc_def = df; - } -} - -struct def * -MkDef(id, scope, kind) - register struct idf *id; - register struct scope *scope; -{ - /* Create a new definition structure in scope "scope", with - id "id" and kind "kind". - */ - register struct def *df; - - df = new_def(); - df->df_idf = id; - df->df_scope = scope; - df->df_kind = kind; - df->next = id->id_def; - id->id_def = df; - - /* enter the definition in the list of definitions in this scope - */ - df->df_nextinscope = scope->sc_def; - scope->sc_def = df; - return df; -} - -struct def * -define(id, scope, kind) - register struct idf *id; - register struct scope *scope; - int kind; -{ - /* Declare an identifier in a scope, but first check if it - already has been defined. - If so, then check for the cases in which this is legal, - and otherwise give an error message. - */ - register struct def *df; - - df = lookup(id, scope, 1); - if ( /* Already in this scope */ - df - || /* A closed scope, and id defined in the pervasive scope */ - ( - scopeclosed(scope) - && - (df = lookup(id, PervasiveScope, 1))) - ) { - switch(df->df_kind) { - case D_HIDDEN: - /* An opaque type. We may now have found the - definition of this type. - */ - if (kind == D_TYPE && !DefinitionModule) { - df->df_kind = D_TYPE; - return df; - } - break; - - case D_FORWMODULE: - /* A forward reference to a module. We may have found - another one, or we may have found the definition - for this module. - */ - if (kind == D_FORWMODULE) { - return df; - } - - if (kind == D_MODULE) { - FreeNode(df->for_node); - df->mod_vis = df->for_vis; - df->df_kind = kind; - DefInFront(df); - return df; - } - break; - - case D_TYPE: - if (kind == D_FORWTYPE) return df; - break; - case D_FORWTYPE: - if (kind == D_FORWTYPE) return df; - if (kind == D_TYPE) { - df->df_kind = D_FTYPE; - FreeNode(df->df_forw_node); - } - else { - error("identifier \"%s\" must be a type", - id->id_text); - } - return df; - - case D_FORWARD: - /* A forward reference, for which we may now have - found a definition. - */ - if (kind != D_FORWARD) { - FreeNode(df->for_node); - } - - /* Fall through */ - - case D_ERROR: - /* A definition generated by the compiler, because - it found an error. Maybe, the user gives a - definition after all. - */ - df->df_kind = kind; - return df; - } - - if (kind != D_ERROR) { - /* Avoid spurious error messages - */ - error("identifier \"%s\" already declared", - id->id_text); - } - - return df; - } - - return MkDef(id, scope, kind); -} - -RemoveImports(pdf) - register struct def **pdf; -{ - /* Remove all imports from a definition module. This is - neccesary because the implementation module might import - them again. - */ - register struct def *df = *pdf; - - while (df) { - if (df->df_kind == D_IMPORT) { - RemoveFromIdList(df); - *pdf = df->df_nextinscope; - free_def(df); - } - else { - pdf = &(df->df_nextinscope); - } - df = *pdf; - } -} - -RemoveFromIdList(df) - register struct def *df; -{ - /* Remove definition "df" from the definition list - */ - register struct idf *id = df->df_idf; - register struct def *df1; - - if ((df1 = id->id_def) == df) id->id_def = df->next; - else { - while (df1->next != df) { - assert(df1->next != 0); - df1 = df1->next; - } - df1->next = df->next; - } -} - -struct def * -DeclProc(type, id) - register struct idf *id; -{ - /* A procedure is declared, either in a definition or a program - module. Create a def structure for it (if neccessary). - Also create a name for it. - */ - register struct def *df; - register struct scope *scope; - extern char *sprint(); - static int nmcount; - char buf[256]; - - assert(type & (D_PROCEDURE | D_PROCHEAD)); - - if (type == D_PROCHEAD) { - /* In a definition module - */ - df = define(id, CurrentScope, type); - df->for_node = MkLeaf(Name, &dot); - sprint(buf,"%s_%s",CurrentScope->sc_name,id->id_text); - df->for_name = Salloc(buf, (unsigned) (strlen(buf)+1)); - if (CurrVis == Defined->mod_vis) { - /* The current module will define this routine. - make sure the name is exported. - */ - C_exp(df->for_name); - } - } - else { - char *name; - - df = lookup(id, CurrentScope, 1); - if (df && df->df_kind == D_PROCHEAD) { - /* C_exp already generated when we saw the definition - in the definition module - */ - df->df_kind = D_PROCEDURE; - name = df->for_name; - DefInFront(df); - } - else { - df = define(id, CurrentScope, type); - sprint(buf,"_%d_%s",++nmcount,id->id_text); - name = Salloc(buf, (unsigned)(strlen(buf)+1)); - (*c_inp)(buf); - } - open_scope(OPENSCOPE); - scope = CurrentScope; - scope->sc_name = name; - scope->sc_definedby = df; - df->prc_vis = CurrVis; - } - - return df; -} - -EndProc(df, id) - register struct def *df; - struct idf *id; -{ - /* The end of a procedure declaration. - Check that the closing identifier matches the name of the - procedure, close the scope, and check that a function - procedure has at least one RETURN statement. - */ - extern int return_occurred; - - match_id(id, df->df_idf); - close_scope(SC_CHKFORW|SC_REVERSE); - if (! return_occurred && ResultType(df->df_type)) { - error("function procedure %s does not return a value", - df->df_idf->id_text); - } -} - -struct def * -DefineLocalModule(id) - struct idf *id; -{ - /* Create a definition for a local module. Also give it - a name to be used for code generation. - */ - register struct def *df = define(id, CurrentScope, D_MODULE); - register struct scope *sc; - static int modulecount = 0; - char buf[256]; - extern char *sprint(); - extern int proclevel; - - sprint(buf, "_%d%s", ++modulecount, id->id_text); - - if (!df->mod_vis) { - /* We never saw the name of this module before. Create a - scope for it. - */ - open_scope(CLOSEDSCOPE); - df->mod_vis = CurrVis; - } - - CurrVis = df->mod_vis; - - sc = CurrentScope; - sc->sc_level = proclevel; - sc->sc_definedby = df; - sc->sc_name = Salloc(buf, (unsigned) (strlen(buf) + 1)); - - /* Create a type for it - */ - df->df_type = standard_type(T_RECORD, 1, (arith) 0); - df->df_type->rec_scope = sc; - - /* Generate code that indicates that the initialization procedure - for this module is local. - */ - (*c_inp)(buf); - - return df; -} - -CheckWithDef(df, tp) - register struct def *df; - struct type *tp; -{ - /* Check the header of a procedure declaration against a - possible earlier definition in the definition module. - */ - - if (df->df_type) { - /* We already saw a definition of this type - in the definition module. - */ - if (!TstProcEquiv(tp, df->df_type)) { - error("inconsistent procedure declaration for \"%s\"", - df->df_idf->id_text); - } - FreeType(df->df_type); - } - df->df_type = tp; -} - -#ifdef DEBUG -PrDef(df) - register struct def *df; -{ - print("n: %s, k: %d\n", df->df_idf->id_text, df->df_kind); -} -#endif DEBUG diff --git a/lang/m2/comp/def_sizes.h b/lang/m2/comp/def_sizes.h deleted file mode 100644 index a8543f8b2..000000000 --- a/lang/m2/comp/def_sizes.h +++ /dev/null @@ -1,22 +0,0 @@ -/* D E F A U L T S I Z E S A N D A L I G N M E N T S */ - -/* $Header$ */ - -#define MAXSIZE 8 /* the maximum of the SZ_* constants */ -/* target machine sizes */ -#define SZ_CHAR (arith)1 -#define SZ_WORD (arith)4 -#define SZ_INT (arith)4 -#define SZ_LONG (arith)4 -#define SZ_FLOAT (arith)4 -#define SZ_DOUBLE (arith)8 -#define SZ_POINTER (arith)4 -/* target machine alignment requirements */ -#define AL_CHAR 1 -#define AL_WORD (int) SZ_WORD -#define AL_INT (int) SZ_WORD -#define AL_LONG (int) SZ_WORD -#define AL_FLOAT (int) SZ_WORD -#define AL_DOUBLE (int) SZ_WORD -#define AL_POINTER (int) SZ_WORD -#define AL_STRUCT 1 diff --git a/lang/m2/comp/defmodule.c b/lang/m2/comp/defmodule.c deleted file mode 100644 index d5f68767e..000000000 --- a/lang/m2/comp/defmodule.c +++ /dev/null @@ -1,115 +0,0 @@ -/* D E F I N I T I O N M O D U L E S */ - -#include "debug.h" - -#include -#include -#include - -#include "idf.h" -#include "input.h" -#include "scope.h" -#include "def.h" -#include "LLlex.h" -#include "Lpars.h" -#include "f_info.h" -#include "main.h" -#include "node.h" -#include "type.h" -#include "misc.h" - -#ifdef DEBUG -long sys_filesize(); -#endif - -struct idf *DefId; - -STATIC -GetFile(name) - char *name; -{ - /* Try to find a file with basename "name" and extension ".def", - in the directories mentioned in "DEFPATH". - */ - char buf[15]; - char *strcpy(), *strcat(); - - strncpy(buf, name, 10); - buf[10] = '\0'; /* maximum length */ - strcat(buf, ".def"); - if (! InsertFile(buf, DEFPATH, &(FileName))) { - error("could not find a DEFINITION MODULE for \"%s\"", name); - return 0; - } - LineNumber = 1; - DO_DEBUG(options['F'], debug("File %s : %ld characters", FileName, sys_filesize(FileName))); - return 1; -} - -struct def * -GetDefinitionModule(id, incr) - register struct idf *id; -{ - /* Return a pointer to the "def" structure of the definition - module indicated by "id". - We may have to read the definition module itself. - Also increment level by "incr". - */ - register struct def *df; - static int level; - struct scopelist *vis; - - level += incr; - df = lookup(id, GlobalScope, 1); - if (!df) { - /* Read definition module. Make an exception for SYSTEM. - */ - if (!strcmp(id->id_text, "SYSTEM")) { - do_SYSTEM(); - } - else { - open_scope(CLOSEDSCOPE); - if (!is_anon_idf(id) && GetFile(id->id_text)) { - DefId = id; - DefModule(); - if (level == 1) { - /* The module is directly imported by - the currently defined module, so we - have to remember its name because - we have to call its initialization - routine - */ - static struct node *nd_end; - register struct node *n; - extern struct node *Modules; - - n = MkLeaf(Name, &dot); - n->nd_IDF = id; - n->nd_symb = IDENT; - if (nd_end) nd_end->next = n; - else Modules = n; - nd_end = n; - } - } - vis = CurrVis; - close_scope(SC_CHKFORW); - } - df = lookup(id, GlobalScope, 1); - if (! df) { - df = MkDef(id, GlobalScope, D_ERROR); - df->df_type = error_type; - df->mod_vis = vis; - } - } - else if (df->df_flags & D_BUSY) { - error("definition module \"%s\" depends on itself", - id->id_text); - } - else if (df == Defined && level == 1) { - error("cannot import from currently defined module"); - df->df_kind = D_ERROR; - } - assert(df); - level -= incr; - return df; -} diff --git a/lang/m2/comp/desig.c b/lang/m2/comp/desig.c deleted file mode 100644 index 09e66db07..000000000 --- a/lang/m2/comp/desig.c +++ /dev/null @@ -1,572 +0,0 @@ -/* D E S I G N A T O R E V A L U A T I O N */ - -/* Code generation for designators. - This file contains some routines that generate code common to address - as well as value computations, and leave a description in a "desig" - structure. It also contains routines to load an address, load a value - or perform a store. -*/ - -#include "debug.h" - -#include -#include -#include -#include - -#include "type.h" -#include "def.h" -#include "scope.h" -#include "desig.h" -#include "LLlex.h" -#include "node.h" - -extern int proclevel; -struct desig InitDesig = {DSG_INIT, 0, 0}; - -STATIC int -properly(ds, size, al) - register struct desig *ds; - arith size; -{ - /* Check if it is allowed to load or store the value indicated - by "ds" with LOI/STI. - - if the size is not either a multiple or a dividor of the - wordsize, then not. - - if the alignment is at least "word" then OK. - - if size is dividor of word_size and alignment >= size then OK. - - otherwise check alignment of address. This can only be done - with DSG_FIXED. - */ - - arith szmodword = size % word_size; /* 0 if multiple of wordsize */ - arith wordmodsz = word_size % size; /* 0 if dividor of wordsize */ - - if (szmodword && wordmodsz) return 0; - if (al >= word_size) return 1; - if (szmodword && al >= szmodword) return 1; - - return ds->dsg_kind == DSG_FIXED && - ((! szmodword && ds->dsg_offset % word_size == 0) || - (! wordmodsz && ds->dsg_offset % size == 0)); -} - -CodeValue(ds, size, al) - register struct desig *ds; - arith size; -{ - /* Generate code to load the value of the designator described - in "ds" - */ - arith tmp = 0; - - switch(ds->dsg_kind) { - case DSG_LOADED: - break; - - case DSG_FIXED: - if (ds->dsg_offset % word_size == 0) { - if (size == word_size) { - if (ds->dsg_name) { - C_loe_dnam(ds->dsg_name,ds->dsg_offset); - } - else C_lol(ds->dsg_offset); - break; - } - - if (size == dword_size) { - if (ds->dsg_name) { - C_lde_dnam(ds->dsg_name,ds->dsg_offset); - } - else C_ldl(ds->dsg_offset); - break; - } - } - /* Fall through */ - case DSG_PLOADED: - case DSG_PFIXED: - if (properly(ds, size, al)) { - CodeAddress(ds); - C_loi(size); - break; - } - if (ds->dsg_kind == DSG_PLOADED) { - tmp = NewPtr(); - C_stl(tmp); - } - C_asp(-WA(size)); - if (!tmp) CodeAddress(ds); - else { - C_lol(tmp); - FreePtr(tmp); - } - C_loc(size); - C_cal("_load"); - C_asp(2 * word_size); - break; - - case DSG_INDEXED: - C_lar(word_size); - break; - - default: - crash("(CodeValue)"); - } - - ds->dsg_kind = DSG_LOADED; -} - -CodeStore(ds, size, al) - register struct desig *ds; - arith size; -{ - /* Generate code to store the value on the stack in the designator - described in "ds" - */ - struct desig save; - - save = *ds; - switch(ds->dsg_kind) { - case DSG_FIXED: - if (ds->dsg_offset % word_size == 0) { - if (size == word_size) { - if (ds->dsg_name) { - C_ste_dnam(ds->dsg_name,ds->dsg_offset); - } - else C_stl(ds->dsg_offset); - break; - } - - if (size == dword_size) { - if (ds->dsg_name) { - C_sde_dnam(ds->dsg_name,ds->dsg_offset); - } - else C_sdl(ds->dsg_offset); - break; - } - } - /* Fall through */ - case DSG_PLOADED: - case DSG_PFIXED: - CodeAddress(&save); - if (properly(ds, size, al)) { - C_sti(size); - break; - } - C_loc(size); - C_cal("_store"); - C_asp(2 * word_size + WA(size)); - break; - - case DSG_INDEXED: - C_sar(word_size); - break; - - default: - crash("(CodeStore)"); - } - - ds->dsg_kind = DSG_INIT; -} - -CodeCopy(lhs, rhs, sz, psize) - register struct desig *lhs, *rhs; - arith sz, *psize; -{ - struct desig l, r; - - l = *lhs; r = *rhs; - *psize -= sz; - lhs->dsg_offset += sz; - rhs->dsg_offset += sz; - CodeAddress(&r); - C_loi(sz); - CodeAddress(&l); - C_sti(sz); -} - -CodeMove(rhs, left, rtp) - register struct desig *rhs; - register struct node *left; - struct type *rtp; -{ - struct desig dsl; - register struct desig *lhs = &dsl; - register struct type *tp = left->nd_type; - int loadedflag = 0; - - dsl = InitDesig; - - /* Generate code for an assignment. Testing of type - compatibility and the like is already done. - Go through some (considerable) trouble to see if a BLM can be - generated. - */ - - switch(rhs->dsg_kind) { - case DSG_LOADED: - CodeDesig(left, lhs); - CodeAddress(lhs); - if (rtp->tp_fund == T_STRING) { - C_loc(rtp->tp_size); - C_loc(tp->tp_size); - C_cal("_StringAssign"); - C_asp(word_size << 2); - return; - } - CodeStore(lhs, tp->tp_size, tp->tp_align); - return; - case DSG_PLOADED: - case DSG_PFIXED: - CodeAddress(rhs); - if (tp->tp_size % word_size == 0 && tp->tp_align >= word_size) { - CodeDesig(left, lhs); - CodeAddress(lhs); - C_blm(tp->tp_size); - return; - } - CodeValue(rhs, tp->tp_size, tp->tp_align); - CodeDStore(left); - return; - case DSG_FIXED: - CodeDesig(left, lhs); - if (lhs->dsg_kind == DSG_FIXED && - lhs->dsg_offset % word_size == - rhs->dsg_offset % word_size) { - register arith sz; - arith size = tp->tp_size; - - while (size && (sz = (lhs->dsg_offset % word_size))) { - /* First copy up to word-aligned - boundaries - */ - if (sz < 0) sz = -sz; /* bloody '%' */ - while (word_size % sz) sz--; - CodeCopy(lhs, rhs, sz, &size); - } - if (size > 3*dword_size) { - /* Do a block move - */ - struct desig l, r; - - sz = (size / word_size) * word_size; - l = *lhs; r = *rhs; - CodeAddress(&r); - CodeAddress(&l); - C_blm(sz); - rhs->dsg_offset += sz; - lhs->dsg_offset += sz; - size -= sz; - } - else for (sz = dword_size; sz; sz -= word_size) { - while (size >= sz) { - /* Then copy dwords, words. - Depend on peephole optimizer - */ - CodeCopy(lhs, rhs, sz, &size); - } - } - sz = word_size; - while (size && --sz) { - /* And then copy remaining parts - */ - while (word_size % sz) sz--; - while (size >= sz) { - CodeCopy(lhs, rhs, sz, &size); - } - } - return; - } - if (lhs->dsg_kind == DSG_PLOADED || - lhs->dsg_kind == DSG_INDEXED) { - CodeAddress(lhs); - loadedflag = 1; - } - if (tp->tp_size % word_size == 0 && tp->tp_align >= word_size) { - CodeAddress(rhs); - if (loadedflag) C_exg(pointer_size); - else CodeAddress(lhs); - C_blm(tp->tp_size); - return; - } - { - arith tmp; - - if (loadedflag) { - tmp = NewPtr(); - lhs->dsg_offset = tmp; - lhs->dsg_name = 0; - lhs->dsg_kind = DSG_PFIXED; - C_stl(tmp); /* address of lhs */ - } - CodeValue(rhs, tp->tp_size, tp->tp_align); - CodeStore(lhs, tp->tp_size, tp->tp_align); - if (loadedflag) FreePtr(tmp); - return; - } - default: - crash("CodeMove"); - } -} - -CodeAddress(ds) - register struct desig *ds; -{ - /* Generate code to load the address of the designator described - in "ds" - */ - - switch(ds->dsg_kind) { - case DSG_PLOADED: - if (ds->dsg_offset) { - C_adp(ds->dsg_offset); - } - break; - - case DSG_FIXED: - if (ds->dsg_name) { - C_lae_dnam(ds->dsg_name, ds->dsg_offset); - break; - } - C_lal(ds->dsg_offset); - break; - - case DSG_PFIXED: - if (ds->dsg_name) { - C_loe_dnam(ds->dsg_name,ds->dsg_offset); - break; - } - C_lol(ds->dsg_offset); - break; - - case DSG_INDEXED: - C_aar(word_size); - break; - - default: - crash("(CodeAddress)"); - } - - ds->dsg_offset = 0; - ds->dsg_kind = DSG_PLOADED; -} - -CodeFieldDesig(df, ds) - register struct def *df; - register struct desig *ds; -{ - /* Generate code for a field designator. Only the code common for - address as well as value computation is generated, and the - resulting information on where to find the designator is placed - in "ds". "df" indicates the definition of the field. - */ - - if (ds->dsg_kind == DSG_INIT) { - /* In a WITH statement. We must find the designator in the - WITH statement, and act as if the field is a selection - of this designator. - So, first find the right WITH statement, which is the - first one of the proper record type, which is - recognized by its scope indication. - */ - register struct withdesig *wds = WithDesigs; - - assert(wds != 0); - - while (wds->w_scope != df->df_scope) { - wds = wds->w_next; - assert(wds != 0); - } - - /* Found it. Now, act like it was a selection. - */ - *ds = wds->w_desig; - assert(ds->dsg_kind == DSG_PFIXED); - } - - switch(ds->dsg_kind) { - case DSG_PLOADED: - case DSG_FIXED: - ds->dsg_offset += df->fld_off; - break; - - case DSG_PFIXED: - case DSG_INDEXED: - CodeAddress(ds); - ds->dsg_kind = DSG_PLOADED; - ds->dsg_offset = df->fld_off; - break; - - default: - crash("(CodeFieldDesig)"); - } -} - -CodeVarDesig(df, ds) - register struct def *df; - register struct desig *ds; -{ - /* Generate code for a variable represented by a "def" structure. - Of course, there are numerous cases: the variable is local, - it is a value parameter, it is a var parameter, it is one of - those of an enclosing procedure, or it is global. - */ - register struct scope *sc = df->df_scope; - - /* Selections from a module are handled earlier, when identifying - the variable, so ... - */ - assert(ds->dsg_kind == DSG_INIT); - - if (df->var_addrgiven) { - /* the programmer specified an address in the declaration of - the variable. Generate code to push the address. - */ - CodeConst(df->var_off, pointer_size); - ds->dsg_kind = DSG_PLOADED; - ds->dsg_offset = 0; - return; - } - - if (df->var_name) { - /* this variable has been given a name, so it is global. - It is directly accessible. - */ - ds->dsg_name = df->var_name; - ds->dsg_offset = 0; - ds->dsg_kind = DSG_FIXED; - return; - } - - if (sc->sc_level != proclevel) { - /* the variable is local to a statically enclosing procedure. - */ - assert(proclevel > sc->sc_level); - - df->df_flags |= D_NOREG; - if (df->df_flags & (D_VARPAR|D_VALPAR)) { - /* value or var parameter - */ - C_lxa((arith) (proclevel - sc->sc_level)); - if ((df->df_flags & D_VARPAR) || - IsConformantArray(df->df_type)) { - /* var parameter or conformant array. - For conformant array's, the address is - passed. - */ - C_adp(df->var_off); - C_loi(pointer_size); - ds->dsg_offset = 0; - ds->dsg_kind = DSG_PLOADED; - return; - } - } - else C_lxl((arith) (proclevel - sc->sc_level)); - ds->dsg_kind = DSG_PLOADED; - ds->dsg_offset = df->var_off; - return; - } - - /* Now, finally, we have a local variable or a local parameter - */ - if ((df->df_flags & D_VARPAR) || IsConformantArray(df->df_type)) { - /* a var parameter; address directly accessible. - */ - ds->dsg_kind = DSG_PFIXED; - } - else ds->dsg_kind = DSG_FIXED; - ds->dsg_offset =df->var_off; -} - -CodeDesig(nd, ds) - register struct node *nd; - register struct desig *ds; -{ - /* Generate code for a designator. Use divide and conquer - principle - */ - register struct def *df; - - switch(nd->nd_class) { /* Divide */ - case Def: - df = nd->nd_def; - - switch(df->df_kind) { - case D_FIELD: - CodeFieldDesig(df, ds); - break; - - case D_VARIABLE: - CodeVarDesig(df, ds); - break; - - default: - crash("(CodeDesig) Def"); - } - break; - - case LinkDef: - assert(nd->nd_symb == '.'); - - CodeDesig(nd->nd_left, ds); - CodeFieldDesig(nd->nd_def, ds); - break; - - case Arrsel: - assert(nd->nd_symb == '['); - - CodeDesig(nd->nd_left, ds); - CodeAddress(ds); - CodePExpr(nd->nd_right); - if (nd->nd_right->nd_type->tp_size > word_size) { - CodeCoercion(nd->nd_right->nd_type, int_type); - } - - /* Now load address of descriptor - */ - if (IsConformantArray(nd->nd_left->nd_type)) { - assert(nd->nd_left->nd_class == Def); - - df = nd->nd_left->nd_def; - if (proclevel > df->df_scope->sc_level) { - C_lxa((arith) (proclevel - df->df_scope->sc_level)); - C_adp(df->var_off + pointer_size); - } - else C_lal(df->var_off + pointer_size); - } - else { - C_lae_dlb(nd->nd_left->nd_type->arr_descr, (arith) 0); - } - ds->dsg_kind = DSG_INDEXED; - break; - - case Arrow: - assert(nd->nd_symb == '^'); - - CodeDesig(nd->nd_right, ds); - switch(ds->dsg_kind) { - case DSG_LOADED: - ds->dsg_kind = DSG_PLOADED; - break; - - case DSG_INDEXED: - case DSG_PLOADED: - case DSG_PFIXED: - CodeValue(ds, pointer_size, pointer_align); - ds->dsg_kind = DSG_PLOADED; - ds->dsg_offset = 0; - break; - - case DSG_FIXED: - ds->dsg_kind = DSG_PFIXED; - break; - - default: - crash("(CodeDesig) Uoper"); - } - break; - - default: - crash("(CodeDesig) class"); - } -} diff --git a/lang/m2/comp/desig.h b/lang/m2/comp/desig.h deleted file mode 100644 index 4b6bb97bb..000000000 --- a/lang/m2/comp/desig.h +++ /dev/null @@ -1,53 +0,0 @@ -/* D E S I G N A T O R D E S C R I P T I O N S */ - -/* Generating code for designators is not particularly easy, especially if - you don't know wether you want the address or the value. - The next structure is used to generate code for designators. - It contains information on how to find the designator, after generation - of the code that is common to both address and value computations. -*/ - -struct desig { - int dsg_kind; -#define DSG_INIT 0 /* don't know anything yet */ -#define DSG_LOADED 1 /* designator loaded on top of the stack */ -#define DSG_PLOADED 2 /* designator accessible through pointer on - stack, possibly with an offset - */ -#define DSG_FIXED 3 /* designator directly accessible */ -#define DSG_PFIXED 4 /* designator accessible through directly - accessible pointer - */ -#define DSG_INDEXED 5 /* designator accessible through array - operation. Address of array descriptor on - top of the stack, index beneath that, and - base address beneath that - */ - arith dsg_offset; /* contains an offset for PLOADED, - or for FIXED or PFIXED it contains an - offset from dsg_name, if it exists, - or from the current Local Base - */ - char *dsg_name; /* name of global variable, used for - FIXED and PFIXED - */ -}; - -/* The next structure describes the designator in a with-statement. - We have a linked list of them, as with-statements may be nested. -*/ - -struct withdesig { - struct withdesig *w_next; - struct scope *w_scope; /* scope in which fields of this record - reside - */ - struct desig w_desig; /* a desig structure for this particular - designator - */ -}; - -extern struct withdesig *WithDesigs; -extern struct desig InitDesig; - -#define NO_LABEL ((label) 0) diff --git a/lang/m2/comp/enter.c b/lang/m2/comp/enter.c deleted file mode 100644 index 52debbc75..000000000 --- a/lang/m2/comp/enter.c +++ /dev/null @@ -1,451 +0,0 @@ -/* H I G H L E V E L S Y M B O L E N T R Y */ - -#include "debug.h" - -#include -#include -#include -#include -#include - -#include "idf.h" -#include "def.h" -#include "type.h" -#include "scope.h" -#include "LLlex.h" -#include "node.h" -#include "main.h" -#include "misc.h" - -struct def * -Enter(name, kind, type, pnam) - char *name; - struct type *type; -{ - /* Enter a definition for "name" with kind "kind" and type - "type" in the Current Scope. If it is a standard name, also - put its number in the definition structure. - */ - register struct def *df; - - df = define(str2idf(name, 0), CurrentScope, kind); - df->df_type = type; - if (pnam) df->df_value.df_stdname = pnam; - return df; -} - -EnterEnumList(Idlist, type) - struct node *Idlist; - register struct type *type; -{ - /* Put a list of enumeration literals in the symbol table. - They all have type "type". - Also assign numbers to them, and link them together. - We must link them together because an enumeration type may - be exported, in which case its literals must also be exported. - Thus, we need an easy way to get to them. - */ - register struct def *df; - register struct node *idlist = Idlist; - - type->enm_ncst = 0; - for (; idlist; idlist = idlist->next) { - df = define(idlist->nd_IDF, CurrentScope, D_ENUM); - df->df_type = type; - df->enm_val = (type->enm_ncst)++; - df->enm_next = type->enm_enums; - type->enm_enums = df; - } - FreeNode(Idlist); -} - -EnterFieldList(Idlist, type, scope, addr) - struct node *Idlist; - register struct type *type; - struct scope *scope; - arith *addr; -{ - /* Put a list of fields in the symbol table. - They all have type "type", and are put in scope "scope". - Mark them as QUALIFIED EXPORT, because that's exactly what - fields are, you can get to them by qualifying them. - */ - register struct def *df; - register struct node *idlist = Idlist; - - for (; idlist; idlist = idlist->next) { - df = define(idlist->nd_IDF, scope, D_FIELD); - df->df_type = type; - df->df_flags |= D_QEXPORTED; - df->fld_off = align(*addr, type->tp_align); - *addr = df->fld_off + type->tp_size; - } - FreeNode(Idlist); -} - -EnterVarList(Idlist, type, local) - struct node *Idlist; - struct type *type; -{ - /* Enter a list of identifiers representing variables into the - name list. "type" represents the type of the variables. - "local" is set if the variables are declared local to a - procedure. - */ - register struct def *df; - register struct node *idlist = Idlist; - register struct scopelist *sc; - char buf[256]; - extern char *sprint(); - - sc = CurrVis; - - if (local) { - /* Find the closest enclosing open scope. This - is the procedure that we are dealing with - */ - while (sc->sc_scope->sc_scopeclosed) sc = enclosing(sc); - } - - for (; idlist; idlist = idlist->nd_right) { - df = define(idlist->nd_IDF, CurrentScope, D_VARIABLE); - df->df_type = type; - if (idlist->nd_left) { - /* An address was supplied - */ - register struct type *tp = idlist->nd_left->nd_type; - - df->var_addrgiven = 1; - df->df_flags |= D_NOREG; - if (tp != error_type && !(tp->tp_fund & T_CARDINAL)){ - node_error(idlist->nd_left, - "illegal type for address"); - } - df->var_off = idlist->nd_left->nd_INT; - } - else if (local) { - /* subtract aligned size of variable to the offset, - as the variable list exists only local to a - procedure - */ - sc->sc_scope->sc_off = - -WA(align(type->tp_size - sc->sc_scope->sc_off, - type->tp_align)); - df->var_off = sc->sc_scope->sc_off; - } - else { - /* Global name, possibly external - */ - sprint(buf,"%s_%s", sc->sc_scope->sc_name, - df->df_idf->id_text); - df->var_name = Salloc(buf, (unsigned)(strlen(buf)+1)); - df->df_flags |= D_NOREG; - - if (DefinitionModule) { - if (sc == Defined->mod_vis) { - C_exa_dnam(df->var_name); - } - } - else { - C_ina_dnam(df->var_name); - } - } - } - FreeNode(Idlist); -} - -EnterParamList(ppr, Idlist, type, VARp, off) - struct paramlist **ppr; - struct node *Idlist; - struct type *type; - int VARp; - arith *off; -{ - /* Create (part of) a parameterlist of a procedure. - "ids" indicates the list of identifiers, "tp" their type, and - "VARp" indicates D_VARPAR or D_VALPAR. - */ - register struct paramlist *pr; - register struct def *df; - register struct node *idlist = Idlist; - struct node *dummy = 0; - static struct paramlist *last; - - if (! idlist) { - /* Can only happen when a procedure type is defined */ - dummy = Idlist = idlist = MkLeaf(Name, &dot); - } - for ( ; idlist; idlist = idlist->next) { - pr = new_paramlist(); - pr->next = 0; - if (!*ppr) *ppr = pr; - else last->next = pr; - last = pr; - if (!DefinitionModule && idlist != dummy) { - df = define(idlist->nd_IDF, CurrentScope, D_VARIABLE); - df->var_off = *off; - } - else df = new_def(); - pr->par_def = df; - df->df_type = type; - df->df_flags = VARp; - - if (IsConformantArray(type)) { - /* we need room for the base address and a descriptor - */ - *off += pointer_size + 3 * word_size; - } - else if (VARp == D_VARPAR) { - *off += pointer_size; - } - else { - *off += WA(type->tp_size); - } - } - FreeNode(Idlist); -} - -STATIC -DoImport(df, scope) - register struct def *df; - struct scope *scope; -{ - /* Definition "df" is imported to scope "scope". - Handle the case that it is an enumeration type or a module. - */ - - define(df->df_idf, scope, D_IMPORT)->imp_def = df; - - if (df->df_kind == D_TYPE && df->df_type->tp_fund == T_ENUMERATION) { - /* Also import all enumeration literals - */ - for (df = df->df_type->enm_enums; df; df = df->enm_next) { - define(df->df_idf, scope, D_IMPORT)->imp_def = df; - } - } - else if (df->df_kind == D_MODULE) { - /* Also import all definitions that are exported from this - module - */ - if (df->mod_vis == CurrVis) { - error("cannot import current module \"%s\"", - df->df_idf->id_text); - return; - } - for (df = df->mod_vis->sc_scope->sc_def; - df; - df = df->df_nextinscope) { - if (df->df_flags & D_EXPORTED) { - define(df->df_idf,scope,D_IMPORT)->imp_def = df; - } - } - } -} - -STATIC struct scopelist * -ForwModule(df, nd) - register struct def *df; - struct node *nd; -{ - /* An import is done from a not yet defined module "df". - We could also end up here for not found DEFINITION MODULES. - Create a declaration and a scope for this module. - */ - struct scopelist *vis; - - if (df->df_scope != GlobalScope) { - df->df_scope = enclosing(CurrVis)->sc_scope; - df->df_kind = D_FORWMODULE; - } - open_scope(CLOSEDSCOPE); - vis = CurrVis; /* The new scope, but watch out, it's "sc_encl" - field is not set right. It must indicate the - enclosing scope, but this must be done AFTER - closing this one - */ - close_scope(0); - vis->sc_encl = enclosing(CurrVis); - /* Here ! */ - df->for_vis = vis; - df->for_node = nd; - return vis; -} - -STATIC struct def * -ForwDef(ids, scope) - register struct node *ids; - struct scope *scope; -{ - /* Enter a forward definition of "ids" in scope "scope", - if it is not already defined. - */ - register struct def *df; - - if (!(df = lookup(ids->nd_IDF, scope, 1))) { - df = define(ids->nd_IDF, scope, D_FORWARD); - df->for_node = MkLeaf(Name, &(ids->nd_token)); - } - return df; -} - -EnterExportList(Idlist, qualified) - struct node *Idlist; -{ - /* From the current scope, the list of identifiers "ids" is - exported. Note this fact. If the export is not qualified, make - all the "ids" visible in the enclosing scope by defining them - in this scope as "imported". - */ - register struct node *idlist = Idlist; - register struct def *df, *df1; - - for (;idlist; idlist = idlist->next) { - df = lookup(idlist->nd_IDF, CurrentScope, 0); - - if (!df) { - /* undefined item in export list - */ - node_error(idlist, - "identifier \"%s\" not defined", - idlist->nd_IDF->id_text); - continue; - } - - if (df->df_flags & (D_EXPORTED|D_QEXPORTED)) { - node_error(idlist, - "multiple occurrences of \"%s\" in export list", - idlist->nd_IDF->id_text); - } - - if (df->df_kind == D_IMPORT) df = df->imp_def; - - df->df_flags |= qualified; - if (qualified == D_EXPORTED) { - /* Export, but not qualified. - Find all imports of the module in which this export - occurs, and export the current definition to it - */ - df1 = CurrentScope->sc_definedby->df_idf->id_def; - while (df1) { - if (df1->df_kind == D_IMPORT && - df1->imp_def == CurrentScope->sc_definedby) { - DoImport(df, df1->df_scope); - } - df1 = df1->next; - } - - /* Also handle the definition as if the enclosing - scope imports it. - */ - df1 = lookup(idlist->nd_IDF, - enclosing(CurrVis)->sc_scope, 1); - if (df1) { - /* It was already defined in the enclosing - scope. There are two legal possibilities, - which are examined below. - */ - if (df1->df_kind == D_PROCHEAD && - df->df_kind == D_PROCEDURE) { - df1->df_kind = D_IMPORT; - df1->imp_def = df; - continue; - } - if (df1->df_kind == D_HIDDEN && - df->df_kind == D_TYPE) { - DeclareType(idlist, df1, df->df_type); - df1->df_kind = D_TYPE; - continue; - } - } - - DoImport(df, enclosing(CurrVis)->sc_scope); - } - } - FreeNode(Idlist); -} - -EnterFromImportList(Idlist, FromDef, FromId) - struct node *Idlist; - register struct def *FromDef; - struct node *FromId; -{ - /* Import the list Idlist from the module indicated by Fromdef. - */ - register struct node *idlist = Idlist; - register struct scopelist *vis; - register struct def *df; - char *module_name = FromDef->df_idf->id_text; - int forwflag = 0; - - switch(FromDef->df_kind) { - case D_ERROR: - /* The module from which the import was done - is not yet declared. I'm not sure if I must - accept this, but for the time being I will. - We also end up here if some definition module could not - be found. - ??? - */ - vis = ForwModule(FromDef, FromId); - forwflag = 1; - break; - case D_FORWMODULE: - vis = FromDef->for_vis; - break; - case D_MODULE: - vis = FromDef->mod_vis; - if (vis == CurrVis) { -node_error(FromId, "cannot import from current module \"%s\"", module_name); - return; - } - break; - default: -node_error(FromId,"identifier \"%s\" does not represent a module",module_name); - return; - } - - for (; idlist; idlist = idlist->next) { - if (forwflag) df = ForwDef(idlist, vis->sc_scope); - else if (! (df = lookup(idlist->nd_IDF, vis->sc_scope, 1))) { - if (! is_anon_idf(idlist->nd_IDF)) { - node_error(idlist, - "identifier \"%s\" not declared in module \"%s\"", - idlist->nd_IDF->id_text, - module_name); - } - df = define(idlist->nd_IDF,vis->sc_scope,D_ERROR); - } - else if (! (df->df_flags & (D_EXPORTED|D_QEXPORTED))) { - node_error(idlist, - "identifier \"%s\" not exported from module \"%s\"", - idlist->nd_IDF->id_text, - module_name); - df->df_flags |= D_QEXPORTED; - } - DoImport(df, CurrentScope); - } - - if (!forwflag) FreeNode(FromId); - FreeNode(Idlist); -} - -EnterImportList(Idlist, local) - struct node *Idlist; -{ - /* Import "Idlist" from the enclosing scope. - An exception must be made for imports of the compilation unit. - In this case, definition modules must be read for "Idlist". - This case is indicated by the value 0 of the "local" flag. - */ - register struct node *idlist = Idlist; - struct scope *sc = enclosing(CurrVis)->sc_scope; - extern struct def *GetDefinitionModule(); - - for (; idlist; idlist = idlist->next) { - DoImport(local ? - ForwDef(idlist, sc) : - GetDefinitionModule(idlist->nd_IDF, 1) , - CurrentScope); - } - FreeNode(Idlist); -} diff --git a/lang/m2/comp/error.c b/lang/m2/comp/error.c deleted file mode 100644 index 468abbe04..000000000 --- a/lang/m2/comp/error.c +++ /dev/null @@ -1,233 +0,0 @@ -/* E R R O R A N D D I A G N O S T I C R O U T I N E S */ - -/* This file contains the (non-portable) error-message and diagnostic - giving functions. Be aware that they are called with a variable - number of arguments! -*/ - -#include "errout.h" -#include "debug.h" - -#include -#include -#include - -#include "input.h" -#include "f_info.h" -#include "LLlex.h" -#include "main.h" -#include "node.h" -#include "warning.h" - -/* error classes */ -#define ERROR 1 -#define WARNING 2 -#define LEXERROR 3 -#define LEXWARNING 4 -#define CRASH 5 -#define FATAL 6 -#ifdef DEBUG -#define VDEBUG 7 -#endif - -int err_occurred; -static int warn_class; - -extern char *symbol2str(); - -/* There are three general error-message functions: - lexerror() lexical and pre-processor error messages - error() syntactic and semantic error messages - node_error() errors in nodes - The difference lies in the place where the file name and line - number come from. - Lexical errors report from the global variables LineNumber and - FileName, node errors get their information from the - node, whereas other errors use the information in the token. -*/ - -#ifdef DEBUG -/*VARARGS1*/ -debug(fmt, args) - char *fmt; -{ - _error(VDEBUG, NULLNODE, fmt, &args); -} -#endif DEBUG - -/*VARARGS1*/ -error(fmt, args) - char *fmt; -{ - _error(ERROR, NULLNODE, fmt, &args); -} - -/*VARARGS2*/ -node_error(node, fmt, args) - struct node *node; - char *fmt; -{ - _error(ERROR, node, fmt, &args); -} - -/*VARARGS1*/ -warning(class, fmt, args) - char *fmt; -{ - warn_class = class; - if (class & warning_classes) _error(WARNING, NULLNODE, fmt, &args); -} - -/*VARARGS2*/ -node_warning(node, class, fmt, args) - struct node *node; - char *fmt; -{ - warn_class = class; - if (class & warning_classes) _error(WARNING, node, fmt, &args); -} - -/*VARARGS1*/ -lexerror(fmt, args) - char *fmt; -{ - _error(LEXERROR, NULLNODE, fmt, &args); -} - -/*VARARGS1*/ -lexwarning(class, fmt, args) - char *fmt; -{ - warn_class = class; - if (class & warning_classes) _error(LEXWARNING, NULLNODE, fmt, &args); -} - -/*VARARGS1*/ -fatal(fmt, args) - char *fmt; - int args; -{ - - _error(FATAL, NULLNODE, fmt, &args); - sys_stop(S_EXIT); -} - -/*VARARGS1*/ -crash(fmt, args) - char *fmt; - int args; -{ - - _error(CRASH, NULLNODE, fmt, &args); -#ifdef DEBUG - sys_stop(S_ABORT); -#else - sys_stop(S_EXIT); -#endif -} - -_error(class, node, fmt, argv) - int class; - struct node *node; - char *fmt; - int argv[]; -{ - /* _error attempts to limit the number of error messages - for a given line to MAXERR_LINE. - */ - static unsigned int last_ln = 0; - unsigned int ln = 0; - static char * last_fn = 0; - static int e_seen = 0; - register char *remark = 0; - - /* Since name and number are gathered from different places - depending on the class, we first collect the relevant - values and then decide what to print. - */ - /* preliminaries */ - switch (class) { - case ERROR: - case LEXERROR: - case CRASH: - case FATAL: - if (C_busy()) C_ms_err(); - err_occurred = 1; - break; - } - - /* the remark */ - switch (class) { - case WARNING: - case LEXWARNING: - switch(warn_class) { - case W_OLDFASHIONED: - remark = "(old-fashioned use)"; - break; - case W_STRICT: - remark = "(strict)"; - break; - default: - remark = "(warning)"; - break; - } - break; - case CRASH: - remark = "CRASH\007"; - break; - case FATAL: - remark = "fatal error --"; - break; -#ifdef DEBUG - case VDEBUG: - remark = "(debug)"; - break; -#endif DEBUG - } - - /* the place */ - switch (class) { - case WARNING: - case ERROR: - ln = node ? node->nd_lineno : dot.tk_lineno; - break; - case LEXWARNING: - case LEXERROR: - case CRASH: - case FATAL: -#ifdef DEBUG - case VDEBUG: -#endif DEBUG - ln = LineNumber; - break; - } - -#ifdef DEBUG - if (class != VDEBUG) { -#endif - if (FileName == last_fn && ln == last_ln) { - /* we've seen this place before */ - e_seen++; - if (e_seen == MAXERR_LINE) fmt = "etc ..."; - else - if (e_seen > MAXERR_LINE) - /* and too often, I'd say ! */ - return; - } - else { - /* brand new place */ - last_ln = ln; - last_fn = FileName; - e_seen = 0; - } -#ifdef DEBUG - } -#endif DEBUG - - if (FileName) fprint(ERROUT, "\"%s\", line %u: ", FileName, ln); - - if (remark) fprint(ERROUT, "%s ", remark); - - doprnt(ERROUT, fmt, argv); /* contents of error */ - fprint(ERROUT, "\n"); -} diff --git a/lang/m2/comp/expression.g b/lang/m2/comp/expression.g deleted file mode 100644 index 542d18e8e..000000000 --- a/lang/m2/comp/expression.g +++ /dev/null @@ -1,242 +0,0 @@ -/* E X P R E S S I O N S */ - -{ -#include "debug.h" - -#include -#include -#include -#include - -#include "LLlex.h" -#include "idf.h" -#include "def.h" -#include "node.h" -#include "const.h" -#include "type.h" -#include "chk_expr.h" -#include "warning.h" - -extern char options[]; -} - -number(struct node **p;) : -[ - %default - INTEGER -| - REAL -] { *p = MkLeaf(Value, &dot); - (*p)->nd_type = toktype; - } -; - -qualident(struct node **p;) -{ -} : - IDENT { *p = MkLeaf(Name, &dot); } - [ - selector(p) - ]* -; - -selector(struct node **pnd;): - '.' { *pnd = MkNode(Link,*pnd,NULLNODE,&dot); } - IDENT { (*pnd)->nd_IDF = dot.TOK_IDF; } -; - -ExpList(struct node **pnd;) -{ - register struct node *nd; -} : - expression(pnd) { *pnd = nd = MkNode(Link,*pnd,NULLNODE,&dot); - nd->nd_symb = ','; - } - [ - ',' { nd->nd_right = MkLeaf(Link, &dot); - nd = nd->nd_right; - } - expression(&(nd->nd_left)) - ]* -; - -ConstExpression(struct node **pnd;) -{ - register struct node *nd; -}: - expression(pnd) - /* - * Changed rule in new Modula-2. - * Check that the expression is a constant expression and evaluate! - */ - { nd = *pnd; - DO_DEBUG(options['X'], print("CONSTANT EXPRESSION\n")); - DO_DEBUG(options['X'], PrNode(nd, 0)); - - if (ChkExpression(nd) && - ((nd)->nd_class != Set && (nd)->nd_class != Value)) { - error("constant expression expected"); - } - - DO_DEBUG(options['X'], print("RESULTS IN\n")); - DO_DEBUG(options['X'], PrNode(nd, 0)); - } -; - -expression(struct node **pnd;) -{ -} : - SimpleExpression(pnd) - [ - /* relation */ - [ '=' | '#' | '<' | LESSEQUAL | '>' | GREATEREQUAL | IN ] - { *pnd = MkNode(Oper, *pnd, NULLNODE, &dot); } - SimpleExpression(&((*pnd)->nd_right)) - ]? -; - -/* Inline in expression -relation: - '=' | '#' | '<' | LESSEQUAL | '>' | GREATEREQUAL | IN -; -*/ - -SimpleExpression(struct node **pnd;) -{ -} : - [ - [ '+' | '-' ] - { *pnd = MkLeaf(Uoper, &dot); - pnd = &((*pnd)->nd_right); - /* priority of unary operator ??? */ - } - ]? - term(pnd) - [ - /* AddOperator */ - [ '+' | '-' | OR ] - { *pnd = MkNode(Oper, *pnd, NULLNODE, &dot); } - term(&((*pnd)->nd_right)) - ]* -; - -/* Inline in "SimpleExpression" -AddOperator: - '+' | '-' | OR -; -*/ - -term(struct node **pnd;) -{ -}: - factor(pnd) - [ - /* MulOperator */ - [ '*' | '/' | DIV | MOD | AND | '&' ] - { *pnd = MkNode(Oper, *pnd, NULLNODE, &dot); } - factor(&((*pnd)->nd_right)) - ]* -; - -/* inline in "term" -MulOperator: - '*' | '/' | DIV | MOD | AND | '&' -; -*/ - -factor(register struct node **p;) -{ - struct node *nd; -} : - qualident(p) - [ - designator_tail(p)? - [ - { *p = MkNode(Call, *p, NULLNODE, &dot); } - ActualParameters(&((*p)->nd_right)) - ]? - | - bare_set(&nd) - { nd->nd_left = *p; *p = nd; } - ] -| - bare_set(p) -| %default - number(p) -| - STRING { *p = MkLeaf(Value, &dot); - (*p)->nd_type = toktype; - } -| - '(' expression(p) ')' -| - NOT { *p = MkLeaf(Uoper, &dot); } - factor(&((*p)->nd_right)) -; - -bare_set(struct node **pnd;) -{ - register struct node *nd; -} : - '{' { dot.tk_symb = SET; - *pnd = nd = MkLeaf(Xset, &dot); - nd->nd_type = bitset_type; - } - [ - element(nd) - [ { nd = nd->nd_right; } - ',' element(nd) - ]* - ]? - '}' -; - -ActualParameters(struct node **pnd;): - '(' ExpList(pnd)? ')' -; - -element(struct node *nd;) -{ - struct node *nd1; -} : - expression(&nd1) - [ - UPTO - { nd1 = MkNode(Link, nd1, NULLNODE, &dot);} - expression(&(nd1->nd_right)) - ]? - { nd->nd_right = MkNode(Link, nd1, NULLNODE, &dot); - nd->nd_right->nd_symb = ','; - } -; - -designator(struct node **pnd;) -: - qualident(pnd) - designator_tail(pnd)? -; - -designator_tail(struct node **pnd;): - visible_designator_tail(pnd) - [ %persistent - %default - selector(pnd) - | - visible_designator_tail(pnd) - ]* -; - -visible_designator_tail(register struct node **pnd;): - '[' { *pnd = MkNode(Arrsel, *pnd, NULLNODE, &dot); } - expression(&((*pnd)->nd_right)) - [ - ',' - { *pnd = MkNode(Arrsel, *pnd, NULLNODE, &dot); - (*pnd)->nd_symb = '['; - } - expression(&((*pnd)->nd_right)) - ]* - ']' -| - '^' { *pnd = MkNode(Arrow, NULLNODE, *pnd, &dot); } -; diff --git a/lang/m2/comp/f_info.h b/lang/m2/comp/f_info.h deleted file mode 100644 index 7efbec727..000000000 --- a/lang/m2/comp/f_info.h +++ /dev/null @@ -1,11 +0,0 @@ -/* F I L E D E S C R I P T O R S T R U C T U R E */ - -struct f_info { - unsigned short f_lineno; - char *f_filename; - char *f_workingdir; -}; - -extern struct f_info file_info; -#define LineNumber file_info.f_lineno -#define FileName file_info.f_filename diff --git a/lang/m2/comp/idf.c b/lang/m2/comp/idf.c deleted file mode 100644 index 6fc41b525..000000000 --- a/lang/m2/comp/idf.c +++ /dev/null @@ -1,4 +0,0 @@ -/* I N S T A N T I A T I O N O F I D F P A C K A G E */ - -#include "idf.h" -#include diff --git a/lang/m2/comp/idf.h b/lang/m2/comp/idf.h deleted file mode 100644 index 62e72bb57..000000000 --- a/lang/m2/comp/idf.h +++ /dev/null @@ -1,12 +0,0 @@ -/* U S E R D E C L A R E D P A R T O F I D F */ - -struct id_u { - int id_res; - struct def *id_df; -}; - -#define IDF_TYPE struct id_u -#define id_reserved id_user.id_res -#define id_def id_user.id_df - -#include diff --git a/lang/m2/comp/idlist.H b/lang/m2/comp/idlist.H deleted file mode 100644 index 9d320bb99..000000000 --- a/lang/m2/comp/idlist.H +++ /dev/null @@ -1,12 +0,0 @@ -/* $Header$ */ - -#include - -/* Structure to link idf structures together -*/ -struct id_list { - struct id_list *next; - struct idf *id_ptr; -}; - -/* ALLOCDEF "id_list" */ diff --git a/lang/m2/comp/idlist.c b/lang/m2/comp/idlist.c deleted file mode 100644 index 3b067af2b..000000000 --- a/lang/m2/comp/idlist.c +++ /dev/null @@ -1,20 +0,0 @@ -static char *RcsId = "$Header$"; - -#include "idf.h" -#include "idlist.h" - -struct id_list *h_id_list; /* Header of free list */ - -/* FreeIdList: take a list of id_list structures and put them - on the free list of id_list structures -*/ -FreeIdList(p) - struct id_list *p; -{ - register struct id_list *q; - - while (q = p) { - p = p->next; - free_id_list(q); - } -} diff --git a/lang/m2/comp/input.c b/lang/m2/comp/input.c deleted file mode 100644 index 48f0525a1..000000000 --- a/lang/m2/comp/input.c +++ /dev/null @@ -1,27 +0,0 @@ -/* I N S T A N T I A T I O N O F I N P U T P A C K A G E */ - -#include "f_info.h" -struct f_info file_info; -#include "input.h" -#include -#include -#include "def.h" -#include "idf.h" -#include "scope.h" -#include - - -AtEoIF() -{ - /* Make the unstacking of input streams noticable to the - lexical analyzer - */ - return 1; -} - -AtEoIT() -{ - /* Make the end of the text noticable - */ - return 1; -} diff --git a/lang/m2/comp/input.h b/lang/m2/comp/input.h deleted file mode 100644 index 74ac774bd..000000000 --- a/lang/m2/comp/input.h +++ /dev/null @@ -1,9 +0,0 @@ -/* I N S T A N T I A T I O N O F I N P U T M O D U L E */ - -#include "inputtype.h" - -#define INP_NPUSHBACK 2 -#define INP_TYPE struct f_info -#define INP_VAR file_info - -#include diff --git a/lang/m2/comp/lookup.c b/lang/m2/comp/lookup.c deleted file mode 100644 index c4c297a09..000000000 --- a/lang/m2/comp/lookup.c +++ /dev/null @@ -1,77 +0,0 @@ -/* L O O K U P R O U T I N E S */ - -#include "debug.h" - -#include -#include -#include - -#include "def.h" -#include "idf.h" -#include "scope.h" -#include "LLlex.h" -#include "node.h" -#include "type.h" -#include "misc.h" - -struct def * -lookup(id, scope, import) - register struct idf *id; - struct scope *scope; -{ - /* Look up a definition of an identifier in scope "scope". - Make the "def" list self-organizing. - Return a pointer to its "def" structure if it exists, - otherwise return 0. - */ - register struct def *df, *df1; - - /* Look in the chain of definitions of this "id" for one with scope - "scope". - */ - for (df = id->id_def, df1 = 0; - df && df->df_scope != scope; - df1 = df, df = df->next) { /* nothing */ } - - if (df) { - /* Found it - */ - if (df1) { - /* Put the definition in front - */ - df1->next = df->next; - df->next = id->id_def; - id->id_def = df; - } - if (import && df->df_kind == D_IMPORT) { - assert(df->imp_def != 0); - return df->imp_def; - } - } - return df; -} - -struct def * -lookfor(id, vis, give_error) - register struct node *id; - struct scopelist *vis; -{ - /* Look for an identifier in the visibility range started by "vis". - If it is not defined create a dummy definition and, - if "give_error" is set, give an error message. - */ - register struct def *df; - register struct scopelist *sc = vis; - - while (sc) { - df = lookup(id->nd_IDF, sc->sc_scope, 1); - if (df) return df; - sc = nextvisible(sc); - } - - if (give_error) id_not_declared(id); - - df = MkDef(id->nd_IDF, vis->sc_scope, D_ERROR); - df->df_type = error_type; - return df; -} diff --git a/lang/m2/comp/main.c b/lang/m2/comp/main.c deleted file mode 100644 index 80ed934c0..000000000 --- a/lang/m2/comp/main.c +++ /dev/null @@ -1,233 +0,0 @@ -/* M A I N P R O G R A M */ - -#include "debug.h" -#include "ndir.h" - -#include -#include -#include - -#include "input.h" -#include "f_info.h" -#include "idf.h" -#include "LLlex.h" -#include "Lpars.h" -#include "type.h" -#include "def.h" -#include "scope.h" -#include "standards.h" -#include "tokenname.h" -#include "node.h" -#include "warning.h" - -int state; /* either IMPLEMENTATION or PROGRAM */ -char options[128]; -int DefinitionModule; -char *ProgName; -char *DEFPATH[NDIRS+1]; -struct def *Defined; -extern int err_occurred; -extern int fp_used; /* set if floating point used */ - -extern C_inp(), C_exp(); -int (*c_inp)() = C_inp; - -main(argc, argv) - register char **argv; -{ - register int Nargc = 1; - register char **Nargv = &argv[0]; - - ProgName = *argv++; - warning_classes = W_INITIAL; - - while (--argc > 0) { - if (**argv == '-') - DoOption((*argv++) + 1); - else - Nargv[Nargc++] = *argv++; - } - Nargv[Nargc] = 0; /* terminate the arg vector */ - if (Nargc < 2) { - fprint(STDERR, "%s: Use a file argument\n", ProgName); - return 1; - } - if (options['x']) c_inp = C_exp; - return !Compile(Nargv[1], Nargv[2]); -} - -Compile(src, dst) - char *src, *dst; -{ - extern struct tokenname tkidf[]; - - if (! InsertFile(src, (char **) 0, &src)) { - fprint(STDERR,"%s: cannot open %s\n", ProgName, src); - return 0; - } - LineNumber = 1; - FileName = src; - DEFPATH[0] = "."; - DEFPATH[NDIRS] = 0; - init_idf(); - InitCst(); - reserve(tkidf); - InitScope(); - InitTypes(); - AddStandards(); -#ifdef DEBUG - if (options['l']) { - LexScan(); - return 1; - } -#endif DEBUG - open_scope(OPENSCOPE); - GlobalVis = CurrVis; - close_scope(0); - C_init(word_size, pointer_size); - if (! C_open(dst)) fatal("could not open output file"); - C_magic(); - C_ms_emx(word_size, pointer_size); - CompUnit(); - C_ms_src((arith) (LineNumber - 1), FileName); - if (!err_occurred) { - C_exp(Defined->mod_vis->sc_scope->sc_name); - WalkModule(Defined); - if (fp_used) C_ms_flt(); - } - C_close(); -#ifdef DEBUG - if (options['i']) Info(); -#endif - return ! err_occurred; -} - -#ifdef DEBUG -LexScan() -{ - register struct token *tkp = ˙ - extern char *symbol2str(); - - while (LLlex() > 0) { - print(">>> %s ", symbol2str(tkp->tk_symb)); - switch(tkp->tk_symb) { - - case IDENT: - print("%s\n", tkp->TOK_IDF->id_text); - break; - - case INTEGER: - print("%ld\n", tkp->TOK_INT); - break; - - case REAL: - print("%s\n", tkp->TOK_REL); - break; - - case STRING: - print("\"%s\"\n", tkp->TOK_STR); - break; - - default: - print("\n"); - } - } -} -#endif - -AddStandards() -{ - register struct def *df; - 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); - df = Enter("NIL", D_CONST, address_type, 0); - df->con_const = &nilnode; - nilnode.nd_INT = 0; - nilnode.nd_type = address_type; - - (void) Enter("PROC", - D_TYPE, - construct_type(T_PROCEDURE, NULLTYPE), - 0); - df = Enter("BITSET", D_TYPE, bitset_type, 0); - df = Enter("TRUE", D_ENUM, bool_type, 0); - df->enm_val = 1; - df->enm_next = Enter("FALSE", D_ENUM, bool_type, 0); - df = df->enm_next; - df->enm_val = 0; - df->enm_next = 0; -} - -/* How do you like that! Modula-2 in a C-program. -*/ -char SYSTEM[] = "\ -DEFINITION MODULE SYSTEM;\n\ -TYPE PROCESS = ADDRESS;\n\ -PROCEDURE NEWPROCESS(P:PROC; A:ADDRESS; n:CARDINAL; VAR p1:ADDRESS);\n\ -PROCEDURE TRANSFER(VAR p1,p2:ADDRESS);\n\ -END SYSTEM.\n"; - -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); - if (!InsertText(SYSTEM, sizeof(SYSTEM) - 1)) { - fatal("could not insert text"); - } - DefModule(); - close_scope(SC_CHKFORW); -} - -#ifdef DEBUG - -int cntlines; - -Info() -{ - extern int cnt_def, cnt_node, cnt_paramlist, cnt_type, - cnt_switch_hdr, cnt_case_entry, - cnt_scope, cnt_scopelist, cnt_tmpvar; - - print("\ -%6d def\n%6d node\n%6d paramlist\n%6d type\n%6d switch_hdr\n\ -%6d case_entry\n%6d scope\n%6d scopelist\n%6d tmpvar\n", -cnt_def, cnt_node, cnt_paramlist, cnt_type, -cnt_switch_hdr, cnt_case_entry, -cnt_scope, cnt_scopelist, cnt_tmpvar); -print("\nNumber of lines read: %d\n", cntlines); -} -#endif diff --git a/lang/m2/comp/main.h b/lang/m2/comp/main.h deleted file mode 100644 index 906af4cbd..000000000 --- a/lang/m2/comp/main.h +++ /dev/null @@ -1,15 +0,0 @@ -/* S O M E G L O B A L V A R I A B L E S */ - -extern char options[]; /* indicating which options were given */ - -extern int DefinitionModule; - /* flag indicating that we are reading a definition - module - */ - -extern struct def *Defined; - /* definition structure of module defined in this - compilation - */ -extern char *DEFPATH[]; /* search path for DEFINITION MODULE's */ -extern int state; /* either IMPLEMENTATION or PROGRAM */ diff --git a/lang/m2/comp/make.allocd b/lang/m2/comp/make.allocd deleted file mode 100755 index ae2ae6f3c..000000000 --- a/lang/m2/comp/make.allocd +++ /dev/null @@ -1,26 +0,0 @@ -sed -e ' -s:^.*[ ]ALLOCDEF[ ].*"\(.*\)"[ ]*\([0-9][0-9]*\).*$:\ -/* allocation definitions of struct \1 */\ -extern char *st_alloc();\ -extern struct \1 *h_\1;\ -#ifdef DEBUG\ -extern int cnt_\1;\ -extern char *std_alloc();\ -#define new_\1() ((struct \1 *) std_alloc((char **)\&h_\1, sizeof(struct \1), \2, \&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))\ -:' -e ' -s:^.*[ ]STATICALLOCDEF[ ].*"\(.*\)"[ ]*\([0-9][0-9]*\).*$:\ -/* allocation definitions of struct \1 */\ -extern char *st_alloc();\ -struct \1 *h_\1;\ -#ifdef DEBUG\ -int cnt_\1;\ -#define new_\1() ((struct \1 *) std_alloc((char **)\&h_\1, sizeof(struct \1), \2, \&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))\ -:' diff --git a/lang/m2/comp/make.hfiles b/lang/m2/comp/make.hfiles deleted file mode 100755 index 2132dd618..000000000 --- a/lang/m2/comp/make.hfiles +++ /dev/null @@ -1,35 +0,0 @@ -: Update Files from database - -PATH=/bin:/usr/bin - -case $# in -1) ;; -*) echo use: $0 file >&2 - exit 1 -esac - -( -IFCOMMAND="if (<\$FN) 2>/dev/null;\ - then if cmp -s \$FN \$TMP;\ - then rm \$TMP;\ - else mv \$TMP \$FN;\ - echo update \$FN;\ - fi;\ - else mv \$TMP \$FN;\ - echo create \$FN;\ - fi" -echo 'TMP=.uf$$' -echo 'FN=$TMP' -echo 'cat >$TMP <<\!EOF!' -sed -n '/^!File:/,${ -/^$/d -/^!File:[ ]*\(.*\)$/s@@!EOF!\ -'"$IFCOMMAND"'\ -FN=\1\ -cat >$TMP <<\\!EOF!@ -p -}' $1 -echo '!EOF!' -echo $IFCOMMAND -) | -sh diff --git a/lang/m2/comp/make.next b/lang/m2/comp/make.next deleted file mode 100755 index 727867594..000000000 --- a/lang/m2/comp/make.next +++ /dev/null @@ -1,7 +0,0 @@ -echo '#include "debug.h"' -sed -n ' -s:^.*[ ]ALLOCDEF[ ].*"\(.*\)".*$:struct \1 *h_\1 = 0;\ -#ifdef DEBUG\ -int cnt_\1 = 0;\ -#endif:p -' $* diff --git a/lang/m2/comp/make.tokcase b/lang/m2/comp/make.tokcase deleted file mode 100755 index ef32292f9..000000000 --- a/lang/m2/comp/make.tokcase +++ /dev/null @@ -1,34 +0,0 @@ -cat <<'--EOT--' -#include "Lpars.h" - -char * -symbol2str(tok) - int tok; -{ - static char buf[2] = { '\0', '\0' }; - - if (040 <= tok && tok < 0177) { - buf[0] = tok; - buf[1] = '\0'; - return buf; - } - switch (tok) { ---EOT-- -sed ' -/{[A-Z]/!d -s/.*{\(.*\),.*\(".*"\).*$/ case \1 :\ - return \2;/ -' -cat <<'--EOT--' - case '\n': - case '\f': - case '\v': - case '\r': - case '\t': - buf[0] = tok; - return buf; - default: - return "bad token"; - } -} ---EOT-- diff --git a/lang/m2/comp/make.tokfile b/lang/m2/comp/make.tokfile deleted file mode 100755 index 494b7e3cc..000000000 --- a/lang/m2/comp/make.tokfile +++ /dev/null @@ -1,6 +0,0 @@ -sed ' -/{[A-Z]/!d -s/.*{// -s/,.*// -s/.*/%token &;/ -' diff --git a/lang/m2/comp/misc.H b/lang/m2/comp/misc.H deleted file mode 100644 index 4f2ae65e3..000000000 --- a/lang/m2/comp/misc.H +++ /dev/null @@ -1,10 +0,0 @@ -/* M I S C E L L A N E O U S */ - -/* $Header$ */ - -/* ALLOCDEF "id_list" */ - -#define is_anon_idf(x) ((x)->id_text[0] == '#') - -extern struct idf - *gen_anon_idf(); diff --git a/lang/m2/comp/misc.c b/lang/m2/comp/misc.c deleted file mode 100644 index dc589d6f7..000000000 --- a/lang/m2/comp/misc.c +++ /dev/null @@ -1,57 +0,0 @@ -/* M I S C E L L A N E O U S R O U T I N E S */ - -#include -#include -#include - -#include "f_info.h" -#include "misc.h" -#include "LLlex.h" -#include "idf.h" -#include "node.h" - -match_id(id1, id2) - register struct idf *id1, *id2; -{ - /* Check that identifiers id1 and id2 are equal. If they - are not, check that we did'nt generate them in the - first place, and if not, give an error message - */ - if (id1 != id2 && !is_anon_idf(id1) && !is_anon_idf(id2)) { - error("name \"%s\" does not match block name \"%s\"", - id1->id_text, - id2->id_text - ); - } -} - -struct idf * -gen_anon_idf() -{ - /* A new idf is created out of nowhere, to serve as an - anonymous name. - */ - static int name_cnt; - char buff[100]; - char *sprint(); - - sprint(buff, "#%d in %s, line %u", - ++name_cnt, FileName, LineNumber); - return str2idf(buff, 1); -} - -not_declared(what, id, where) - char *what, *where; - register struct node *id; -{ - /* The identifier "id" is not declared. If it is not generated, - give an error message - */ - if (!is_anon_idf(id->nd_IDF)) { - node_error(id, - "%s \"%s\" not declared%s", - what, - id->nd_IDF->id_text, - where); - } -} diff --git a/lang/m2/comp/misc.h b/lang/m2/comp/misc.h deleted file mode 100644 index 8d8b48ed4..000000000 --- a/lang/m2/comp/misc.h +++ /dev/null @@ -1,7 +0,0 @@ -/* M I S C E L L A N E O U S */ - -#define is_anon_idf(x) ((x)->id_text[0] == '#') -#define id_not_declared(x) (not_declared("identifier", (x), "")) - -extern struct idf - *gen_anon_idf(); diff --git a/lang/m2/comp/nmclash.c b/lang/m2/comp/nmclash.c deleted file mode 100644 index ca2567a80..000000000 --- a/lang/m2/comp/nmclash.c +++ /dev/null @@ -1,4 +0,0 @@ -/* Accepted if many characters of long names are significant */ -abcdefghijklmnopr() { } -abcdefghijklmnopq() { } -main() { } diff --git a/lang/m2/comp/node.H b/lang/m2/comp/node.H deleted file mode 100644 index 0bb5a28ba..000000000 --- a/lang/m2/comp/node.H +++ /dev/null @@ -1,47 +0,0 @@ -/* N O D E O F A N A B S T R A C T P A R S E T R E E */ - -struct node { - struct node *next; -#define nd_left next - struct node *nd_right; - int nd_class; /* kind of node */ -#define Value 0 /* constant */ -#define Arrsel 1 /* array selection */ -#define Oper 2 /* binary operator */ -#define Uoper 3 /* unary operator */ -#define Arrow 4 /* ^ construction */ -#define Call 5 /* cast or procedure - or function call */ -#define Name 6 /* an identifier */ -#define Set 7 /* a set constant */ -#define Xset 8 /* a set */ -#define Def 9 /* an identified name */ -#define Stat 10 /* a statement */ -#define Link 11 -#define LinkDef 12 - /* do NOT change the order or the numbers!!! */ - struct type *nd_type; /* type of this node */ - struct token nd_token; -#define nd_set nd_token.tk_data.tk_set -#define nd_def nd_token.tk_data.tk_def -#define nd_lab nd_token.tk_data.tk_lab -#define nd_symb nd_token.tk_symb -#define nd_lineno nd_token.tk_lineno -#define nd_IDF nd_token.TOK_IDF -#define nd_STR nd_token.TOK_STR -#define nd_SLE nd_token.TOK_SLE -#define nd_INT nd_token.TOK_INT -#define nd_REL nd_token.TOK_REL -}; - -/* ALLOCDEF "node" 50 */ - -extern struct node *MkNode(), *MkLeaf(); - -#define NULLNODE ((struct node *) 0) - -#define HASSELECTORS 002 -#define VARIABLE 004 -#define VALUE 010 - -#define IsCast(lnd) (((lnd)->nd_class == Def || (lnd)->nd_class == LinkDef) && is_type((lnd)->nd_def)) -#define IsProcCall(lnd) ((lnd)->nd_type->tp_fund == T_PROCEDURE) diff --git a/lang/m2/comp/node.c b/lang/m2/comp/node.c deleted file mode 100644 index 2ca29e60d..000000000 --- a/lang/m2/comp/node.c +++ /dev/null @@ -1,92 +0,0 @@ -/* N O D E O F A N A B S T R A C T P A R S E T R E E */ - -#include "debug.h" - -#include -#include -#include -#include - -#include "def.h" -#include "type.h" -#include "LLlex.h" -#include "node.h" - -struct node * -MkNode(class, left, right, token) - struct node *left, *right; - struct token *token; -{ - /* Create a node and initialize it with the given parameters - */ - register struct node *nd = new_node(); - - nd->nd_left = left; - nd->nd_right = right; - nd->nd_token = *token; - nd->nd_class = class; - nd->nd_type = error_type; - return nd; -} - -struct node * -MkLeaf(class, token) - struct token *token; -{ - register struct node *nd = new_node(); - - nd->nd_left = nd->nd_right = 0; - nd->nd_token = *token; - nd->nd_type = error_type; - nd->nd_class = class; - return nd; -} - -FreeNode(nd) - register struct node *nd; -{ - /* Put nodes that are no longer needed back onto the free - list - */ - if (!nd) return; - FreeNode(nd->nd_left); - FreeNode(nd->nd_right); - free_node(nd); -} - -NodeCrash(expp) - struct node *expp; -{ - crash("Illegal node %d", expp->nd_class); -} - -#ifdef DEBUG - -extern char *symbol2str(); - -indnt(lvl) -{ - while (lvl--) { - print(" "); - } -} - -printnode(nd, lvl) - register struct node *nd; -{ - indnt(lvl); - print("C: %d; T: %s\n", nd->nd_class, symbol2str(nd->nd_symb)); -} - -PrNode(nd, lvl) - register struct node *nd; -{ - if (! nd) { - indnt(lvl); print("\n"); - return; - } - PrNode(nd->nd_left, lvl + 1); - printnode(nd, lvl); - PrNode(nd->nd_right, lvl + 1); -} -#endif DEBUG diff --git a/lang/m2/comp/options.c b/lang/m2/comp/options.c deleted file mode 100644 index 4a7c86b17..000000000 --- a/lang/m2/comp/options.c +++ /dev/null @@ -1,185 +0,0 @@ -/* U S E R O P T I O N - H A N D L I N G */ - -#include "idfsize.h" -#include "ndir.h" - -#include -#include - -#include "type.h" -#include "main.h" -#include "warning.h" - -#define MINIDFSIZE 14 - -#if MINIDFSIZE < 14 -You fouled up! MINIDFSIZE has to be at least 14 or the compiler will not -recognize some keywords! -#endif - -extern int idfsize; -static int ndirs; -int warning_classes; - -DoOption(text) - register char *text; -{ - switch(*text++) { - - default: - options[text[-1]]++; /* flags, debug options etc. */ - break; - /* recognized flags: - -L: don't generate fil/lin - -p: generate procentry/procexit - -w: no warnings - -n: no register messages - and many more if DEBUG - */ - - - case 'w': - if (*text) { - while (*text) { - switch(*text++) { - case 'O': - warning_classes &= ~W_OLDFASHIONED; - break; - case 'R': - warning_classes &= ~W_STRICT; - break; - case 'W': - warning_classes &= ~W_ORDINARY; - break; - } - } - } - else warning_classes = 0; - break; - - case 'W': - while (*text) { - switch(*text++) { - case 'O': - warning_classes |= W_OLDFASHIONED; - break; - case 'R': - warning_classes |= W_STRICT; - break; - case 'W': - warning_classes |= W_ORDINARY; - break; - } - } - break; - - case 'M': { /* maximum identifier length */ - char *t = text; /* because &text is illegal */ - - idfsize = txt2int(&t); - if (*t || idfsize <= 0) - fatal("malformed -M option"); - if (idfsize > IDFSIZE) { - idfsize = IDFSIZE; - warning(W_ORDINARY,"maximum identifier length is %d", IDFSIZE); - } - if (idfsize < MINIDFSIZE) { - warning(W_ORDINARY, "minimum identifier length is %d", MINIDFSIZE); - idfsize = MINIDFSIZE; - } - } - break; - - case 'I' : - if (*text) { - register int i = ndirs++; - register char *new = text; - while (new) { - register char *tmp = DEFPATH[i]; - - if (i >= NDIRS) - fatal("too many -I options"); - DEFPATH[i++] = new; - new = tmp; - } - } - else DEFPATH[ndirs] = 0; - break; - - case 'V' : /* set object sizes and alignment requirements */ - { - arith size; - int align; - char c; - char *t; - - while (c = *text++) { - t = text; - size = txt2int(&t); - align = 0; - if (*(text = t) == '.') { - t = text + 1; - align = txt2int(&t); - text = t; - } - switch (c) { - - case 'w': /* word */ - if (size != (arith)0) { - word_size = size; - dword_size = 2 * size; - } - if (align != 0) word_align = align; - break; - case 'i': /* int */ - if (size != (arith)0) int_size = size; - if (align != 0) int_align = align; - break; - case 's': /* short (subranges) */ - if (size != 0) short_size = size; - if (align != 0) short_align = align; - break; - case 'l': /* longint */ - if (size != (arith)0) long_size = size; - if (align != 0) long_align = align; - break; - case 'f': /* real */ - if (size != (arith)0) float_size = size; - if (align != 0) float_align = align; - break; - case 'd': /* longreal */ - if (size != (arith)0) double_size = size; - if (align != 0) double_align = align; - break; - case 'p': /* pointer */ - if (size != (arith)0) pointer_size = size; - if (align != 0) pointer_align = align; - break; - case 'S': /* initial record alignment */ - if (align != (arith)0) struct_align = align; - break; - default: - error("-V: bad type indicator %c\n", c); - } - } - break; - } - } -} - -int -txt2int(tp) - register char **tp; -{ - /* the integer pointed to by *tp is read, while increasing - *tp; the resulting value is yielded. - */ - register int val = 0; - register int ch; - - while (ch = **tp, ch >= '0' && ch <= '9') { - val = val * 10 + ch - '0'; - (*tp)++; - } - return val; -} diff --git a/lang/m2/comp/param.h b/lang/m2/comp/param.h deleted file mode 100644 index cd4d2cba4..000000000 --- a/lang/m2/comp/param.h +++ /dev/null @@ -1,4 +0,0 @@ -/* $Header$ */ - -#define IDFSIZE 256 -#define NUMSIZE 256 diff --git a/lang/m2/comp/print.c b/lang/m2/comp/print.c deleted file mode 100644 index ffb1a725d..000000000 --- a/lang/m2/comp/print.c +++ /dev/null @@ -1,144 +0,0 @@ -/* P R I N T R O U T I N E S */ - -#include -#include - -#define SSIZE 1024 /* string-buffer size for print routines */ - -char *long2str(); - -doprnt(fp, fmt, argp) - File *fp; - char *fmt; - int argp[]; -{ - char buf[SSIZE]; - - sys_write(fp, buf, format(buf, fmt, (char *)argp)); -} - -/*VARARGS1*/ -printf(fmt, args) - char *fmt; - char args; -{ - char buf[SSIZE]; - - sys_write(STDOUT, buf, format(buf, fmt, &args)); -} - -/*VARARGS1*/ -fprintf(fp, fmt, args) - File *fp; - char *fmt; - char args; -{ - char buf[SSIZE]; - - sys_write(fp, buf, format(buf, fmt, &args)); -} - -/*VARARGS1*/ -char * -sprintf(buf, fmt, args) - char *buf, *fmt; - char args; -{ - buf[format(buf, fmt, &args)] = '\0'; - return buf; -} - -int -format(buf, fmt, argp) - char *buf, *fmt; - char *argp; -{ - register char *pf = fmt, *pa = argp; - register char *pb = buf; - - while (*pf) { - if (*pf == '%') { - register int width, base, pad, npad; - char *arg; - char cbuf[2]; - char *badformat = ""; - - /* get padder */ - if (*++pf == '0') { - pad = '0'; - ++pf; - } - else - pad = ' '; - - /* get width */ - width = 0; - while (*pf >= '0' && *pf <= '9') - width = 10 * width + *pf++ - '0'; - - /* get text and move pa */ - if (*pf == 's') { - arg = *(char **)pa; - pa += sizeof(char *); - } - else - if (*pf == 'c') { - cbuf[0] = * (char *) pa; - cbuf[1] = '\0'; - pa += sizeof(int); - arg = &cbuf[0]; - } - else - if (*pf == 'l') { - /* alignment ??? */ - if (base = integral(*++pf)) { - arg = long2str(*(long *)pa, base); - pa += sizeof(long); - } - else { - pf--; - arg = badformat; - } - } - else - if (base = integral(*pf)) { - arg = long2str((long)*(int *)pa, base); - pa += sizeof(int); - } - else - if (*pf == '%') - arg = "%"; - else - arg = badformat; - - npad = width - strlen(arg); - - while (npad-- > 0) - *pb++ = pad; - - while (*pb++ = *arg++); - pb--; - pf++; - } - else - *pb++ = *pf++; - } - return pb - buf; -} - -integral(c) -{ - switch (c) { - case 'b': - return -2; - case 'd': - return 10; - case 'o': - return -8; - case 'u': - return -10; - case 'x': - return -16; - } - return 0; -} diff --git a/lang/m2/comp/program.g b/lang/m2/comp/program.g deleted file mode 100644 index 40d8113a2..000000000 --- a/lang/m2/comp/program.g +++ /dev/null @@ -1,236 +0,0 @@ -/* O V E R A L L S T R U C T U R E */ - -{ -#include "debug.h" - -#include -#include -#include - -#include "main.h" -#include "idf.h" -#include "LLlex.h" -#include "scope.h" -#include "def.h" -#include "type.h" -#include "node.h" -#include "f_info.h" -#include "warning.h" - -} -/* - The grammar as given by Wirth is already almost LL(1); the - main problem is that the full form of a qualified designator - may be: - [ module_ident '.' ]* IDENT [ '.' field_ident ]* - which is quite confusing to an LL(1) parser. Rather than - resorting to context-sensitive techniques, I have decided - to render this as: - IDENT [ '.' IDENT ]* - on the grounds that it is quite natural to consider the first - IDENT to be the name of the object and regard the others as - field identifiers. -*/ - -%lexical LLlex; - -%start CompUnit, CompilationUnit; -%start DefModule, DefinitionModule; - -ModuleDeclaration -{ - register struct def *df; - struct node *exportlist = 0; - int qualified; -} : - MODULE IDENT { df = DefineLocalModule(dot.TOK_IDF); } - priority(df) - ';' - import(1)* - export(&qualified, &exportlist)? - block(&(df->mod_body)) - IDENT { if (exportlist) { - EnterExportList(exportlist, qualified); - } - close_scope(SC_CHKFORW|SC_CHKPROC|SC_REVERSE); - match_id(df->df_idf, dot.TOK_IDF); - } -; - -priority(register struct def *df;) -{ - register struct node *nd; -} : - [ - '[' ConstExpression(&(df->mod_priority)) ']' - { if (!(df->mod_priority->nd_type->tp_fund & - T_CARDINAL)) { - node_error(df->mod_priority, - "illegal priority"); - } - } - | - { df->mod_priority = 0; } - ] -; - -export(int *QUALflag; struct node **ExportList;): - EXPORT - [ - QUALIFIED - { *QUALflag = D_QEXPORTED; } - | - { *QUALflag = D_EXPORTED; } - ] - IdentList(ExportList) ';' -; - -import(int local;) -{ - struct node *ImportList; - register struct node *FromId = 0; - register struct def *df; - extern struct def *GetDefinitionModule(); -} : - [ FROM - IDENT { FromId = MkLeaf(Name, &dot); - if (local) df = lookfor(FromId,enclosing(CurrVis),0); - else df = GetDefinitionModule(dot.TOK_IDF, 1); - } - ]? - IMPORT IdentList(&ImportList) ';' - /* - When parsing a global module, this is the place where we must - read already compiled definition modules. - If the FROM clause is present, the identifier in it is a module - name, otherwise the names in the import list are module names. - */ - { if (FromId) { - EnterFromImportList(ImportList, df, FromId); - } - else EnterImportList(ImportList, local); - } -; - -DefinitionModule -{ - register struct def *df; - struct node *exportlist; - int dummy; - extern struct idf *DefId; -} : - DEFINITION - MODULE IDENT { df = define(dot.TOK_IDF, GlobalScope, D_MODULE); - df->df_flags |= D_BUSY; - if (!Defined) Defined = df; - if (df->df_idf != DefId) { - error("DEFINITION MODULE name is not \"%s\"", - DefId->id_text); - } - CurrentScope->sc_name = df->df_idf->id_text; - df->mod_vis = CurrVis; - df->df_type = standard_type(T_RECORD, 1, (arith) 1); - df->df_type->rec_scope = df->mod_vis->sc_scope; - DefinitionModule++; - } - ';' - import(0)* - [ - export(&dummy, &exportlist) - /* New Modula-2 does not have export lists in definition - modules. Issue a warning. - */ - { -node_warning(exportlist, W_OLDFASHIONED, "export list in definition module ignored"); - FreeNode(exportlist); - } - | - /* empty */ - ] - definition* END IDENT - { register struct def *df1 = CurrentScope->sc_def; - while (df1) { - /* Make all definitions "QUALIFIED EXPORT" */ - df1->df_flags |= D_QEXPORTED; - df1 = df1->df_nextinscope; - } - DefinitionModule--; - match_id(df->df_idf, dot.TOK_IDF); - df->df_flags &= ~D_BUSY; - } - '.' -; - -definition -{ - register struct def *df; - struct def *dummy; -} : - CONST [ %persistent ConstantDeclaration ';' ]* -| - TYPE - [ %persistent - IDENT { df = define(dot.TOK_IDF, CurrentScope, D_TYPE); } - [ '=' type(&(df->df_type)) - | /* empty */ - /* - Here, the exported type has a hidden implementation. - The export is said to be opaque. - It is restricted to pointer types. - */ - { df->df_kind = D_HIDDEN; - df->df_type = construct_type(T_HIDDEN, NULLTYPE); - } - ] - ';' - ]* -| - VAR [ %persistent VariableDeclaration ';' ]* -| - ProcedureHeading(&dummy, D_PROCHEAD) - ';' -; - -ProgramModule -{ - extern struct def *GetDefinitionModule(); - register struct def *df; -} : - MODULE - IDENT { if (state == IMPLEMENTATION) { - df = GetDefinitionModule(dot.TOK_IDF, 0); - CurrVis = df->mod_vis; - RemoveImports(&(CurrentScope->sc_def)); - } - else { - Defined = df = define(dot.TOK_IDF, GlobalScope, D_MODULE); - open_scope(CLOSEDSCOPE); - df->mod_vis = CurrVis; - CurrentScope->sc_name = "_M2M"; - } - CurrentScope->sc_definedby = df; - } - priority(df) - ';' import(0)* - block(&(df->mod_body)) IDENT - { close_scope(SC_CHKFORW|SC_CHKPROC|SC_REVERSE); - match_id(df->df_idf, dot.TOK_IDF); - } - '.' -; - -Module: - DEFINITION - { fatal("Compiling a definition module"); } -| %default - [ - IMPLEMENTATION { state = IMPLEMENTATION; } - | - /* empty */ { state = PROGRAM; } - ] - ProgramModule -; - -CompilationUnit: - Module -; diff --git a/lang/m2/comp/scope.C b/lang/m2/comp/scope.C deleted file mode 100644 index 790e0ad24..000000000 --- a/lang/m2/comp/scope.C +++ /dev/null @@ -1,227 +0,0 @@ -/* S C O P E M E C H A N I S M */ - -#include "debug.h" - -#include -#include -#include -#include - -#include "LLlex.h" -#include "idf.h" -#include "scope.h" -#include "type.h" -#include "def.h" -#include "node.h" - -struct scope *PervasiveScope; -struct scopelist *CurrVis, *GlobalVis; -extern int proclevel; -static struct scopelist *PervVis; -extern char options[]; - -/* STATICALLOCDEF "scope" 10 */ - -/* STATICALLOCDEF "scopelist" 10 */ - -open_scope(scopetype) -{ - /* Open a scope that is either open (automatic imports) or closed. - */ - register struct scope *sc = new_scope(); - register struct scopelist *ls = new_scopelist(); - - assert(scopetype == OPENSCOPE || scopetype == CLOSEDSCOPE); - - sc->sc_scopeclosed = scopetype == CLOSEDSCOPE; - sc->sc_level = proclevel; - ls->sc_scope = sc; - ls->sc_encl = CurrVis; - if (scopetype == OPENSCOPE) { - ls->next = ls->sc_encl; - } - else ls->next = PervVis; - CurrVis = ls; -} - -InitScope() -{ - register struct scope *sc = new_scope(); - register struct scopelist *ls = new_scopelist(); - - sc->sc_scopeclosed = 0; - sc->sc_def = 0; - sc->sc_level = proclevel; - PervasiveScope = sc; - ls->next = 0; - ls->sc_encl = 0; - ls->sc_scope = PervasiveScope; - PervVis = ls; - CurrVis = ls; -} - -Forward(tk, ptp) - struct node *tk; - struct type *ptp; -{ - /* Enter a forward reference into a list belonging to the - current scope. This is used for POINTER declarations, which - may have forward references that must howewer be declared in the - same scope. - */ - register struct def *df = define(tk->nd_IDF, CurrentScope, D_FORWTYPE); - - if (df->df_kind == D_TYPE) { - ptp->next = df->df_type; - return; - } - df->df_forw_type = ptp; - df->df_forw_node = tk; -} - -STATIC -chk_proc(df) - register struct def *df; -{ - /* Called at scope closing. Check all definitions, and if one - is a D_PROCHEAD, the procedure was not defined. - Also check that hidden types are defined. - */ - while (df) { - if (df->df_kind == D_HIDDEN) { - error("hidden type \"%s\" not declared", - df->df_idf->id_text); - } - else if (df->df_kind == D_PROCHEAD) { - /* A not defined procedure - */ - error("procedure \"%s\" not defined", - df->df_idf->id_text); - FreeNode(df->for_node); - } - df = df->df_nextinscope; - } -} - -STATIC -chk_forw(pdf) - register struct def **pdf; -{ - /* Called at scope close. Look for all forward definitions and - if the scope was a closed scope, give an error message for - them, and otherwise move them to the enclosing scope. - */ - register struct def *df; - - while (df = *pdf) { - if (df->df_kind == D_FORWTYPE) { - register struct def *df1 = df; - - *pdf = df->df_nextinscope; - RemoveFromIdList(df); - df = lookfor(df->df_forw_node, CurrVis, 1); - if (! df->df_kind & (D_ERROR|D_FTYPE|D_TYPE)) { -node_error(df1->df_forw_node, "\"%s\" is not a type", df1->df_idf->id_text); - } - df1->df_forw_type->next = df->df_type; - FreeNode(df1->df_forw_node); - free_def(df1); - continue; - } - else if (df->df_kind == D_FTYPE) { - df->df_kind = D_TYPE; - df->df_forw_type->next = df->df_type; - } - else if (df->df_kind & (D_FORWARD|D_FORWMODULE)) { - /* These definitions must be found in - the enclosing closed scope, which of course - may be the scope that is now closed! - */ - if (scopeclosed(CurrentScope)) { - /* Indeed, the scope was a closed - scope, so give error message - */ -node_error(df->for_node, "identifier \"%s\" not declared", -df->df_idf->id_text); - FreeNode(df->for_node); - } - else { - /* This scope was an open scope. - Maybe the definitions are in the - enclosing scope? - */ - register struct scopelist *ls = - nextvisible(CurrVis); - struct def *df1 = df->df_nextinscope; - - if (df->df_kind == D_FORWMODULE) { - df->for_vis->next = ls; - } - df->df_nextinscope = ls->sc_scope->sc_def; - ls->sc_scope->sc_def = df; - df->df_scope = ls->sc_scope; - *pdf = df1; - continue; - } - } - pdf = &df->df_nextinscope; - } -} - -Reverse(pdf) - struct def **pdf; -{ - /* Reverse the order in the list of definitions in a scope. - This is neccesary because this list is built in reverse. - Also, while we're at it, remove uninteresting definitions - from this list. - */ - register struct def *df, *df1; -#define INTERESTING D_MODULE|D_PROCEDURE|D_PROCHEAD|D_VARIABLE - - df = 0; - df1 = *pdf; - - while (df1) { - if (df1->df_kind & INTERESTING) { - struct def *prev = df; - - df = df1; - df1 = df1->df_nextinscope; - df->df_nextinscope = prev; - } - else df1 = df1->df_nextinscope; - } - *pdf = df; -} - -close_scope(flag) -{ - /* Close a scope. If "flag" is set, check for forward declarations, - either POINTER declarations, or EXPORTs, or forward references - to MODULES - */ - register struct scope *sc = CurrentScope; - - assert(sc != 0); - - if (flag) { - DO_DEBUG(options['S'], PrScopeDef(sc->sc_def)); - if (flag & SC_CHKPROC) chk_proc(sc->sc_def); - if (flag & SC_CHKFORW) chk_forw(&(sc->sc_def)); - if (flag & SC_REVERSE) Reverse(&(sc->sc_def)); - } - CurrVis = enclosing(CurrVis); -} - -#ifdef DEBUG -PrScopeDef(df) - register struct def *df; -{ - print("List of definitions in currently ended scope:\n"); - while (df) { - PrDef(df); - df = df->df_nextinscope; - } -} -#endif diff --git a/lang/m2/comp/scope.h b/lang/m2/comp/scope.h deleted file mode 100644 index 2fd385b30..000000000 --- a/lang/m2/comp/scope.h +++ /dev/null @@ -1,42 +0,0 @@ -/* S C O P E M E C H A N I S M */ - -#define OPENSCOPE 0 /* Indicating an open scope */ -#define CLOSEDSCOPE 1 /* Indicating a closed scope (module) */ - -#define SC_CHKFORW 1 /* Check for forward definitions when closing - a scope - */ -#define SC_CHKPROC 2 /* Check for forward procedure definitions - when closing a scope - */ -#define SC_REVERSE 4 /* Reverse list of definitions, to get it - back into original order - */ - -struct scope { - struct scope *next; - char *sc_name; /* name of this scope */ - struct def *sc_def; /* list of definitions in this scope */ - arith sc_off; /* offsets of variables in this scope */ - char sc_scopeclosed; /* flag indicating closed or open scope */ - int sc_level; /* level of this scope */ - struct def *sc_definedby; /* The def structure defining this scope */ -}; - -struct scopelist { - struct scopelist *next; - struct scope *sc_scope; - struct scopelist *sc_encl; -}; - -extern struct scope - *PervasiveScope; - -extern struct scopelist - *CurrVis, *GlobalVis; - -#define CurrentScope (CurrVis->sc_scope) -#define GlobalScope (GlobalVis->sc_scope) -#define enclosing(x) ((x)->sc_encl) -#define scopeclosed(x) ((x)->sc_scopeclosed) -#define nextvisible(x) ((x)->next) /* use with scopelists */ diff --git a/lang/m2/comp/standards.h b/lang/m2/comp/standards.h deleted file mode 100644 index 3f1bd60af..000000000 --- a/lang/m2/comp/standards.h +++ /dev/null @@ -1,28 +0,0 @@ -/* S T A N D A R D P R O C E D U R E S A N D F U N C T I O N S */ - -#define S_ABS 1 -#define S_CAP 2 -#define S_CHR 3 -#define S_DEC 4 -#define S_EXCL 5 -#define S_FLOAT 6 -#define S_HALT 7 -#define S_HIGH 8 -#define S_INC 9 -#define S_INCL 10 -#define S_MAX 11 -#define S_MIN 12 -#define S_ODD 13 -#define S_ORD 14 -#define S_SIZE 15 -#define S_TRUNC 16 -#define S_VAL 17 -#define S_NEW 18 -#define S_DISPOSE 19 - -/* Standard procedures and functions defined in the SYSTEM module ... */ - -#define S_ADR 50 -#define S_TSIZE 51 -#define S_NEWPROCESS 52 -#define S_TRANSFER 53 diff --git a/lang/m2/comp/statement.g b/lang/m2/comp/statement.g deleted file mode 100644 index 875ea1ea2..000000000 --- a/lang/m2/comp/statement.g +++ /dev/null @@ -1,252 +0,0 @@ -/* S T A T E M E N T S */ - -{ -#include -#include -#include - -#include "idf.h" -#include "LLlex.h" -#include "scope.h" -#include "def.h" -#include "type.h" -#include "node.h" - -static int loopcount = 0; /* Count nested loops */ -} - -statement(register struct node **pnd;) -{ - register struct node *nd; - extern int return_occurred; -} : - /* - * This part is not in the reference grammar. The reference grammar - * states : assignment | ProcedureCall | ... - * but this gives LL(1) conflicts - */ - designator(pnd) - [ { nd = MkNode(Call, *pnd, NULLNODE, &dot); - nd->nd_symb = '('; - } - ActualParameters(&(nd->nd_right))? - | - [ BECOMES - | '=' { error("':=' expected instead of '='"); - DOT = BECOMES; - } - ] - { nd = MkNode(Stat, *pnd, NULLNODE, &dot); } - expression(&(nd->nd_right)) - ] - { *pnd = nd; } - /* - * end of changed part - */ -| - IfStatement(pnd) -| - CaseStatement(pnd) -| - WhileStatement(pnd) -| - RepeatStatement(pnd) -| - { loopcount++; } - LoopStatement(pnd) - { loopcount--; } -| - ForStatement(pnd) -| - WithStatement(pnd) -| - EXIT - { if (!loopcount) error("EXIT not in a LOOP"); - *pnd = MkLeaf(Stat, &dot); - } -| - ReturnStatement(pnd) - { return_occurred = 1; } -| - /* empty */ { *pnd = 0; } -; - -/* - * The next two rules in-line in "Statement", because of an LL(1) conflict - -assignment: - designator BECOMES expression -; - -ProcedureCall: - designator ActualParameters? -; -*/ - -StatementSequence(register struct node **pnd;) -{ - struct node *nd; -} : - statement(pnd) - [ %persistent - ';' statement(&nd) - { if (nd) { - register struct node *nd1 = - MkNode(Link, *pnd, nd, &dot); - - *pnd = nd1; - nd1->nd_symb = ';'; - pnd = &(nd1->nd_right); - } - } - ]* -; - -IfStatement(struct node **pnd;) -{ - register struct node *nd; -} : - IF { nd = MkLeaf(Stat, &dot); - *pnd = nd; - } - expression(&(nd->nd_left)) - THEN { nd->nd_right = MkLeaf(Link, &dot); - nd = nd->nd_right; - } - StatementSequence(&(nd->nd_left)) - [ - ELSIF { nd->nd_right = MkLeaf(Stat, &dot); - nd = nd->nd_right; - nd->nd_symb = IF; - } - expression(&(nd->nd_left)) - THEN { nd->nd_right = MkLeaf(Link, &dot); - nd = nd->nd_right; - } - StatementSequence(&(nd->nd_left)) - ]* - [ - ELSE - StatementSequence(&(nd->nd_right)) - ]? - END -; - -CaseStatement(struct node **pnd;) -{ - register struct node *nd; - struct type *tp = 0; -} : - CASE { *pnd = nd = MkLeaf(Stat, &dot); } - expression(&(nd->nd_left)) - OF - case(&(nd->nd_right), &tp) - { nd = nd->nd_right; } - [ - '|' - case(&(nd->nd_right), &tp) - { nd = nd->nd_right; } - ]* - [ ELSE StatementSequence(&(nd->nd_right)) ]? - END -; - -case(struct node **pnd; struct type **ptp;) : - [ CaseLabelList(ptp, pnd) - ':' { *pnd = MkNode(Link, *pnd, NULLNODE, &dot); } - StatementSequence(&((*pnd)->nd_right)) - ]? - { *pnd = MkNode(Link, *pnd, NULLNODE, &dot); - (*pnd)->nd_symb = '|'; - } -; - -WhileStatement(struct node **pnd;) -{ - register struct node *nd; -}: - WHILE { *pnd = nd = MkLeaf(Stat, &dot); } - expression(&(nd->nd_left)) - DO - StatementSequence(&(nd->nd_right)) - END -; - -RepeatStatement(struct node **pnd;) -{ - register struct node *nd; -}: - REPEAT { *pnd = nd = MkLeaf(Stat, &dot); } - StatementSequence(&(nd->nd_left)) - UNTIL - expression(&(nd->nd_right)) -; - -ForStatement(struct node **pnd;) -{ - register struct node *nd, *nd1; - struct node *dummy; -}: - FOR { *pnd = nd = MkLeaf(Stat, &dot); } - IDENT { nd->nd_IDF = dot.TOK_IDF; } - BECOMES { nd->nd_left = nd1 = MkLeaf(Stat, &dot); } - expression(&(nd1->nd_left)) - TO - expression(&(nd1->nd_right)) - [ - BY - ConstExpression(&dummy) - { if (!(dummy->nd_type->tp_fund & T_INTORCARD)) { - error("illegal type in BY clause"); - } - nd1->nd_INT = dummy->nd_INT; - FreeNode(dummy); - } - | - { nd1->nd_INT = 1; } - ] - DO - StatementSequence(&(nd->nd_right)) - END -; - -LoopStatement(struct node **pnd;): - LOOP { *pnd = MkLeaf(Stat, &dot); } - StatementSequence(&((*pnd)->nd_right)) - END -; - -WithStatement(struct node **pnd;) -{ - register struct node *nd; -}: - WITH { *pnd = nd = MkLeaf(Stat, &dot); } - designator(&(nd->nd_left)) - DO - StatementSequence(&(nd->nd_right)) - END -; - -ReturnStatement(struct node **pnd;) -{ - register struct def *df = CurrentScope->sc_definedby; - register struct node *nd; -} : - - RETURN { *pnd = nd = MkLeaf(Stat, &dot); } - [ - expression(&(nd->nd_right)) - { if (scopeclosed(CurrentScope)) { -error("a module body has no result value"); - } - else if (! ResultType(df->df_type)) { -error("procedure \"%s\" has no result value", df->df_idf->id_text); - } - } - | - { if (ResultType(df->df_type)) { -error("procedure \"%s\" must return a value", df->df_idf->id_text); - } - } - ] -; diff --git a/lang/m2/comp/tab.c b/lang/m2/comp/tab.c deleted file mode 100644 index 17065cf9b..000000000 --- a/lang/m2/comp/tab.c +++ /dev/null @@ -1,295 +0,0 @@ -/* @cc tab.c -o $INSTALLDIR/tab@ - tab - table generator - - Author: Erik Baalbergen (..tjalk!erikb) -*/ - -#include - -static char *RcsId = "$Header$"; - -#define MAXTAB 10000 -#define MAXBUF 10000 -#define COMCOM '-' -#define FILECOM '%' - -int InputForm = 'c'; -char OutputForm[MAXBUF] = "%s,\n"; -int TabSize = 257; -char *Table[MAXTAB]; -char *Name; -char *ProgCall; - -main(argc, argv) - char *argv[]; -{ - ProgCall = *argv++; - argc--; - while (argc-- > 0) { - if (**argv == COMCOM) { - option(*argv++); - } - else { - process(*argv++, InputForm); - } - } -} - -char * -Salloc(s) - char *s; -{ - char *malloc(); - char *ns = malloc(strlen(s) + 1); - - if (ns) { - strcpy(ns, s); - } - return ns; -} - -option(str) - char *str; -{ - /* note that *str indicates the source of the option: - either COMCOM (from command line) or FILECOM (from a file). - */ - switch (*++str) { - - case ' ': /* command */ - case '\t': - case '\0': - break; - case 'I': - InputForm = *++str; - break; - case 'f': - if (*++str == '\0') { - fprintf(stderr, "%s: -f: name expected\n", ProgCall); - exit(1); - } - DoFile(str); - break; - case 'F': - sprintf(OutputForm, "%s\n", ++str); - break; - case 'T': - printf("%s\n", ++str); - break; - case 'p': - PrintTable(); - break; - case 'C': - ClearTable(); - break; - case 'S': - { - register i = stoi(++str); - - if (i <= 0 || i > MAXTAB) { - fprintf(stderr, "%s: size would exceed maximum\n", - ProgCall); - } - else { - TabSize = i; - } - break; - } - default: - fprintf(stderr, "%s: bad option -%s\n", ProgCall, str); - } -} - -ClearTable() -{ - register i; - - for (i = 0; i < MAXTAB; i++) { - Table[i] = 0; - } -} - -PrintTable() -{ - register i; - - for (i = 0; i < TabSize; i++) { - if (Table[i]) { - printf(OutputForm, Table[i]); - } - else { - printf(OutputForm, "0"); - } - } -} - -process(str, format) - char *str; -{ - char *cstr = str; - char *Name = cstr; /* overwrite original string! */ - - /* strip of the entry name - */ - while (*str && *str != ':') { - if (*str == '\\') { - ++str; - } - *cstr++ = *str++; - } - - if (*str != ':') { - fprintf(stderr, "%s: bad specification: \"%s\", ignored\n", - ProgCall, Name); - return 0; - } - *cstr = '\0'; - str++; - - switch (format) { - - case 'c': - return c_proc(str, Name); - default: - fprintf(stderr, "%s: bad input format\n", ProgCall); - } - return 0; -} - -c_proc(str, Name) - char *str; - char *Name; -{ - int ch, ch2; - int quoted(); - - while (*str) { - if (*str == '\\') { - ch = quoted(&str); - } - else { - ch = *str++; - } - if (*str == '-') { - if (*++str == '\\') { - ch2 = quoted(&str); - } - else { - if (ch2 = *str++); - else str--; - } - if (ch > ch2) { - fprintf(stderr, "%s: bad range\n", ProgCall); - return 0; - } - if (ch >= 0 && ch2 <= 255) - while (ch <= ch2) - Table[ch++] = Salloc(Name); - } - else { - if (ch >= 0 && ch <= 255) - Table[ch] = Salloc(Name); - } - } - return 1; -} - -int -quoted(pstr) - char **pstr; -{ - register int ch; - register int i; - register char *str = *pstr; - - if ((*++str >= '0') && (*str <= '9')) { - ch = 0; - for (i = 0; i < 3; i++) { - ch = 8 * ch + *str - '0'; - if (*++str < '0' || *str > '9') - break; - } - } - else { - switch (*str++) { - - case 'n': - ch = '\n'; - break; - case 't': - ch = '\t'; - break; - case 'b': - ch = '\b'; - break; - case 'r': - ch = '\r'; - break; - case 'f': - ch = '\f'; - break; - default : - ch = *str; - } - } - *pstr = str; - return ch & 0377; -} - -int -stoi(str) - char *str; -{ - register i = 0; - - while (*str >= '0' && *str <= '9') { - i = i * 10 + *str++ - '0'; - } - return i; -} - -char * -getline(s, n, fp) - char *s; - FILE *fp; -{ - register c = getc(fp); - char *str = s; - - while (n--) { - if (c == EOF) { - return NULL; - } - else - if (c == '\n') { - *str++ = '\0'; - return s; - } - *str++ = c; - c = getc(fp); - } - s[n - 1] = '\0'; - return s; -} - -#define BUFSIZE 1024 - -DoFile(name) - char *name; -{ - char text[BUFSIZE]; - FILE *fp; - - if ((fp = fopen(name, "r")) == NULL) { - fprintf(stderr, "%s: cannot read file %s\n", ProgCall, name); - exit(1); - } - while (getline(text, BUFSIZE, fp) != NULL) { - if (text[0] == FILECOM) { - option(text); - } - else { - process(text, InputForm); - } - } -} diff --git a/lang/m2/comp/tmpvar.C b/lang/m2/comp/tmpvar.C deleted file mode 100644 index 294ef0775..000000000 --- a/lang/m2/comp/tmpvar.C +++ /dev/null @@ -1,130 +0,0 @@ -/* T E M P O R A R Y V A R I A B L E S */ - -/* Code for the allocation and de-allocation of temporary variables, - allowing re-use. - The routines use "ProcScope" instead of "CurrentScope", because - "CurrentScope" also reflects WITH statements, and these scopes do not - have local variabes. -*/ - -#include "debug.h" - -#include -#include -#include -#include -#include - -#include "def.h" -#include "type.h" -#include "scope.h" -#include "main.h" - -struct tmpvar { - struct tmpvar *next; - arith t_offset; /* offset from LocalBase */ -}; - -/* STATICALLOCDEF "tmpvar" 10 */ - -static struct tmpvar *TmpInts, /* for integer temporaries */ - *TmpPtrs; /* for pointer temporaries */ -static struct scope *ProcScope; /* scope of procedure in which the - temporaries are allocated - */ - -TmpOpen(sc) struct scope *sc; -{ - /* Initialize for temporaries in scope "sc". - */ - ProcScope = sc; -} - -arith -TmpSpace(sz, al) - arith sz; -{ - register struct scope *sc = ProcScope; - - sc->sc_off = - WA(align(sz - sc->sc_off, al)); - return sc->sc_off; -} - -arith -NewInt() -{ - register arith offset; - register struct tmpvar *tmp; - - if (!TmpInts) { - offset = TmpSpace(int_size, int_align); - if (! options['n']) C_ms_reg(offset, int_size, reg_any, 0); - } - else { - tmp = TmpInts; - offset = tmp->t_offset; - TmpInts = tmp->next; - free_tmpvar(tmp); - } - return offset; -} - -arith -NewPtr() -{ - register arith offset; - register struct tmpvar *tmp; - - if (!TmpPtrs) { - offset = TmpSpace(pointer_size, pointer_align); - if (! options['n']) C_ms_reg(offset, pointer_size, reg_pointer, 0); - } - else { - tmp = TmpPtrs; - offset = tmp->t_offset; - TmpPtrs = tmp->next; - free_tmpvar(tmp); - } - return offset; -} - -FreeInt(off) - arith off; -{ - register struct tmpvar *tmp; - - tmp = new_tmpvar(); - tmp->next = TmpInts; - tmp->t_offset = off; - TmpInts = tmp; -} - -FreePtr(off) - arith off; -{ - register struct tmpvar *tmp; - - tmp = new_tmpvar(); - tmp->next = TmpPtrs; - tmp->t_offset = off; - TmpPtrs = tmp; -} - -TmpClose() -{ - register struct tmpvar *tmp, *tmp1; - - tmp = TmpInts; - while (tmp) { - tmp1 = tmp; - tmp = tmp->next; - free_tmpvar(tmp1); - } - tmp = TmpPtrs; - while (tmp) { - tmp1 = tmp; - tmp = tmp->next; - free_tmpvar(tmp1); - } - TmpInts = TmpPtrs = 0; -} diff --git a/lang/m2/comp/tokenname.c b/lang/m2/comp/tokenname.c deleted file mode 100644 index 223c2a66d..000000000 --- a/lang/m2/comp/tokenname.c +++ /dev/null @@ -1,99 +0,0 @@ -/* T O K E N D E F I N I T I O N S */ - -#include "tokenname.h" -#include "Lpars.h" -#include "idf.h" - -/* To centralize the declaration of %tokens, their presence in this - file is taken as their declaration. The Makefile will produce - a grammar file (tokenfile.g) from this file. This scheme ensures - that all tokens have a printable name. - Also, the "token2str.c" file is produced from this file. -*/ - -struct tokenname tkspec[] = { /* the names of the special tokens */ - {IDENT, "identifier"}, - {STRING, "string"}, - {INTEGER, "number"}, - {REAL, "real"}, - {0, ""} -}; - -struct tokenname tkcomp[] = { /* names of the composite tokens */ - {LESSEQUAL, "<="}, - {GREATEREQUAL, ">="}, - {UPTO, ".."}, - {BECOMES, ":="}, - {0, ""} -}; - -struct tokenname tkidf[] = { /* names of the identifier tokens */ - {AND, "AND"}, - {ARRAY, "ARRAY"}, - {BEGIN, "BEGIN"}, - {BY, "BY"}, - {CASE, "CASE"}, - {CONST, "CONST"}, - {DEFINITION, "DEFINITION"}, - {DIV, "DIV"}, - {DO, "DO"}, - {ELSE, "ELSE"}, - {ELSIF, "ELSIF"}, - {END, "END"}, - {EXIT, "EXIT"}, - {EXPORT, "EXPORT"}, - {FOR, "FOR"}, - {FROM, "FROM"}, - {IF, "IF"}, - {IMPLEMENTATION, "IMPLEMENTATION"}, - {IMPORT, "IMPORT"}, - {IN, "IN"}, - {LOOP, "LOOP"}, - {MOD, "MOD"}, - {MODULE, "MODULE"}, - {NOT, "NOT"}, - {OF, "OF"}, - {OR, "OR"}, - {POINTER, "POINTER"}, - {PROCEDURE, "PROCEDURE"}, - {QUALIFIED, "QUALIFIED"}, - {RECORD, "RECORD"}, - {REPEAT, "REPEAT"}, - {RETURN, "RETURN"}, - {SET, "SET"}, - {THEN, "THEN"}, - {TO, "TO"}, - {TYPE, "TYPE"}, - {UNTIL, "UNTIL"}, - {VAR, "VAR"}, - {WHILE, "WHILE"}, - {WITH, "WITH"}, - {0, ""} -}; - -struct tokenname tkinternal[] = { /* internal keywords */ - {PROGRAM, ""}, - {0, "0"} -}; - -struct tokenname tkstandard[] = { /* standard identifiers */ - {0, ""} -}; - -/* Some routines to handle tokennames */ - -reserve(resv) - register struct tokenname *resv; -{ - /* The names of the tokens described in resv are entered - as reserved words. - */ - register struct idf *p; - - while (resv->tn_symbol) { - p = str2idf(resv->tn_name, 0); - if (!p) fatal("out of Memory"); - p->id_reserved = resv->tn_symbol; - resv++; - } -} diff --git a/lang/m2/comp/tokenname.h b/lang/m2/comp/tokenname.h deleted file mode 100644 index 79ccdc4cd..000000000 --- a/lang/m2/comp/tokenname.h +++ /dev/null @@ -1,8 +0,0 @@ -/* T O K E N N A M E S T R U C T U R E */ - -struct tokenname { /* Used for defining the name of a - token as identified by its symbol - */ - int tn_symbol; - char *tn_name; -}; diff --git a/lang/m2/comp/type.H b/lang/m2/comp/type.H deleted file mode 100644 index b22559c3c..000000000 --- a/lang/m2/comp/type.H +++ /dev/null @@ -1,159 +0,0 @@ -/* T Y P E D E S C R I P T O R S T R U C T U R E */ - -struct paramlist { /* structure for parameterlist of a PROCEDURE */ - struct paramlist *next; - struct def *par_def; /* "df" of parameter */ -#define IsVarParam(xpar) ((xpar)->par_def->df_flags & D_VARPAR) -#define TypeOfParam(xpar) ((xpar)->par_def->df_type) -}; - -/* ALLOCDEF "paramlist" 20 */ - -struct enume { - struct def *en_enums; /* Definitions of enumeration literals */ - unsigned int en_ncst; /* Number of constants */ - label en_rck; /* Label of range check descriptor */ -#define enm_enums tp_value.tp_enum.en_enums -#define enm_ncst tp_value.tp_enum.en_ncst -#define enm_rck tp_value.tp_enum.en_rck -}; - -struct subrange { - arith su_lb, su_ub; /* lower bound and upper bound */ - label su_rck; /* label of range check descriptor */ -#define sub_lb tp_value.tp_subrange.su_lb -#define sub_ub tp_value.tp_subrange.su_ub -#define sub_rck tp_value.tp_subrange.su_rck -}; - -struct array { - struct type *ar_elem; /* type of elements */ - label ar_descr; /* label of array descriptor */ - arith ar_elsize; /* size of elements */ -#define arr_elem tp_value.tp_arr.ar_elem -#define arr_descr tp_value.tp_arr.ar_descr -#define arr_elsize tp_value.tp_arr.ar_elsize -}; - -struct record { - struct scope *rc_scope; /* scope of this record */ - /* members are in the symbol table */ -#define rec_scope tp_value.tp_record.rc_scope -}; - -struct proc { - struct paramlist *pr_params; - arith pr_nbpar; -#define prc_params tp_value.tp_proc.pr_params -#define prc_nbpar tp_value.tp_proc.pr_nbpar -}; - -struct type { - struct type *next; /* used with ARRAY, PROCEDURE, POINTER, SET, - SUBRANGE, EQUAL - */ - int tp_fund; /* fundamental type or constructor */ -#define T_RECORD 0x0001 -#define T_ENUMERATION 0x0002 -#define T_INTEGER 0x0004 -#define T_CARDINAL 0x0008 -#define T_EQUAL 0x0010 -#define T_REAL 0x0020 -#define T_HIDDEN 0x0040 -#define T_POINTER 0x0080 -#define T_CHAR 0x0100 -#define T_WORD 0x0200 -#define T_SET 0x0400 -#define T_SUBRANGE 0x0800 -#define T_PROCEDURE 0x1000 -#define T_ARRAY 0x2000 -#define T_STRING 0x4000 -#define T_INTORCARD (T_INTEGER|T_CARDINAL) -#define T_NUMERIC (T_INTORCARD|T_REAL) -#define T_INDEX (T_ENUMERATION|T_CHAR|T_SUBRANGE) -#define T_DISCRETE (T_INDEX|T_INTORCARD) -#define T_CONSTRUCTED (T_ARRAY|T_SET|T_RECORD) - int tp_align; /* alignment requirement of this type */ - arith tp_size; /* size of this type */ - union { - struct enume tp_enum; - struct subrange tp_subrange; - struct array tp_arr; - struct record tp_record; - struct proc tp_proc; - } tp_value; -}; - -/* ALLOCDEF "type" 50 */ - -extern struct type - *bool_type, - *char_type, - *int_type, - *card_type, - *longint_type, - *real_type, - *longreal_type, - *word_type, - *byte_type, - *address_type, - *intorcard_type, - *bitset_type, - *std_type, - *error_type; /* All from type.c */ - -extern int - word_align, - short_align, - int_align, - long_align, - float_align, - double_align, - pointer_align, - struct_align; /* All from type.c */ - -extern arith - word_size, - dword_size, - short_size, - int_size, - long_size, - float_size, - double_size, - pointer_size; /* All from type.c */ - -extern arith - align(); /* type.c */ - -struct type - *construct_type(), - *standard_type(), - *set_type(), - *subr_type(), - *proc_type(), - *RemoveEqual(); /* All from type.c */ - -#define NULLTYPE ((struct type *) 0) - -#define IsConformantArray(tpx) ((tpx)->tp_fund==T_ARRAY && (tpx)->next==0) -#define bounded(tpx) ((tpx)->tp_fund & T_INDEX) -#define complex(tpx) ((tpx)->tp_fund & (T_RECORD|T_ARRAY)) -#define WA(sz) (align(sz, (int) word_size)) -#define ResultType(tpx) (assert((tpx)->tp_fund == T_PROCEDURE),\ - (tpx)->next) -#define ParamList(tpx) (assert((tpx)->tp_fund == T_PROCEDURE),\ - (tpx)->prc_params) -#define IndexType(tpx) (assert((tpx)->tp_fund == T_ARRAY),\ - (tpx)->next) -#define ElementType(tpx) (assert((tpx)->tp_fund == T_SET),\ - (tpx)->next) -#define PointedtoType(tpx) (assert((tpx)->tp_fund == T_POINTER),\ - (tpx)->next) -#define BaseType(tpx) ((tpx)->tp_fund == T_SUBRANGE ? (tpx)->next : \ - (tpx)) -#define IsConstructed(tpx) ((tpx)->tp_fund & T_CONSTRUCTED) - -extern long full_mask[]; - -#define fit(n, i) (((n) + (0x80<<(((i)-1)*8)) & ~full_mask[(i)]) == 0) -#define ufit(n, i) (((n) & ~full_mask[(i)]) == 0) diff --git a/lang/m2/comp/type.c b/lang/m2/comp/type.c deleted file mode 100644 index cea61145a..000000000 --- a/lang/m2/comp/type.c +++ /dev/null @@ -1,607 +0,0 @@ -/* T Y P E D E F I N I T I O N M E C H A N I S M */ - -#include "target_sizes.h" -#include "debug.h" -#include "maxset.h" - -#include -#include -#include -#include -#include - -#include "def.h" -#include "type.h" -#include "idf.h" -#include "LLlex.h" -#include "node.h" -#include "const.h" -#include "scope.h" -#include "walk.h" - -int - word_align = AL_WORD, - short_align = AL_SHORT, - int_align = AL_INT, - long_align = AL_LONG, - float_align = AL_FLOAT, - double_align = AL_DOUBLE, - pointer_align = AL_POINTER, - struct_align = AL_STRUCT; - -arith - word_size = SZ_WORD, - dword_size = 2 * SZ_WORD, - int_size = SZ_INT, - short_size = SZ_SHORT, - long_size = SZ_LONG, - float_size = SZ_FLOAT, - double_size = SZ_DOUBLE, - pointer_size = SZ_POINTER; - -struct type - *bool_type, - *char_type, - *int_type, - *card_type, - *longint_type, - *real_type, - *longreal_type, - *word_type, - *byte_type, - *address_type, - *intorcard_type, - *bitset_type, - *std_type, - *error_type; - -struct type * -construct_type(fund, tp) - int fund; - register struct type *tp; -{ - /* fund must be a type constructor. - The pointer to the constructed type is returned. - */ - register struct type *dtp = new_type(); - - switch (dtp->tp_fund = fund) { - case T_PROCEDURE: - case T_POINTER: - case T_HIDDEN: - dtp->tp_align = pointer_align; - dtp->tp_size = pointer_size; - break; - - case T_SET: - dtp->tp_align = word_align; - break; - - case T_ARRAY: - if (tp) dtp->tp_align = tp->tp_align; - break; - - case T_SUBRANGE: - assert(tp != 0); - dtp->tp_align = tp->tp_align; - dtp->tp_size = tp->tp_size; - break; - - default: - crash("funny type constructor"); - } - - dtp->next = tp; - return dtp; -} - -arith -align(pos, al) - arith pos; - int al; -{ - arith i; - - return pos + ((i = pos % al) ? al - i : 0); -} - -struct type * -standard_type(fund, align, size) - int fund; - int align; - arith size; -{ - register struct type *tp = new_type(); - - tp->tp_fund = fund; - tp->tp_align = align ? align : 1; - tp->tp_size = size; - - return tp; -} - -InitTypes() -{ - /* Initialize the predefined types - */ - register struct type *tp; - - /* first, do some checking - */ - if (int_size != word_size) { - fatal("integer size not equal to word size"); - } - - if (int_size != pointer_size) { - fatal("cardinal size not equal to pointer size"); - } - - if (long_size < int_size || long_size % word_size != 0) { - fatal("illegal long integer size"); - } - - if (double_size < float_size) { - fatal("long real size smaller than real size"); - } - - /* character type - */ - char_type = standard_type(T_CHAR, 1, (arith) 1); - char_type->enm_ncst = 256; - - /* boolean type - */ - bool_type = standard_type(T_ENUMERATION, 1, (arith) 1); - bool_type->enm_ncst = 2; - - /* integer types, also a "intorcard", for integer constants between - 0 and MAX(INTEGER) - */ - int_type = standard_type(T_INTEGER, int_align, int_size); - longint_type = standard_type(T_INTEGER, long_align, long_size); - card_type = standard_type(T_CARDINAL, int_align, int_size); - intorcard_type = standard_type(T_INTORCARD, int_align, int_size); - - /* floating types - */ - real_type = standard_type(T_REAL, float_align, float_size); - longreal_type = standard_type(T_REAL, double_align, double_size); - - /* SYSTEM types - */ - word_type = standard_type(T_WORD, word_align, word_size); - byte_type = standard_type(T_WORD, 1, (arith) 1); - address_type = construct_type(T_POINTER, word_type); - - /* create BITSET type - TYPE BITSET = SET OF [0..W-1]; - The subrange is a subrange of type cardinal, because the lower bound - is a non-negative integer (See Rep. 6.3) - */ - tp = construct_type(T_SUBRANGE, card_type); - tp->sub_lb = 0; - tp->sub_ub = word_size * 8 - 1; - bitset_type = set_type(tp); - - /* a unique type for standard procedures and functions - */ - std_type = construct_type(T_PROCEDURE, NULLTYPE); - - /* a unique type indicating an error - */ - error_type = standard_type(T_CHAR, 1, (arith) 1); -} - -chk_basesubrange(tp, base) - register struct type *tp, *base; -{ - /* A subrange had a specified base. Check that the bases conform. - */ - - assert(tp->tp_fund == T_SUBRANGE); - - if (base->tp_fund == T_SUBRANGE) { - /* Check that the bounds of "tp" fall within the range - of "base". - */ - if (base->sub_lb > tp->sub_lb || base->sub_ub < tp->sub_ub) { - error("base type has insufficient range"); - } - base = base->next; - } - - if (base->tp_fund & (T_ENUMERATION|T_CHAR)) { - if (tp->next != base) { - error("specified base does not conform"); - } - } - else if (base != card_type && base != int_type) { - error("illegal base for a subrange"); - } - else if (base == int_type && tp->next == card_type && - (tp->sub_ub > max_int || tp->sub_ub < 0)) { - error("upperbound to large for type INTEGER"); - } - else if (base != tp->next && base != int_type) { - error("specified base does not conform"); - } - - tp->next = base; - tp->tp_size = base->tp_size; - tp->tp_align = base->tp_align; -} - -struct type * -subr_type(lb, ub) - struct node *lb, *ub; -{ - /* Construct a subrange type from the constant expressions - indicated by "lb" and "ub", but first perform some - checks - */ - register struct type *tp = BaseType(lb->nd_type), *res; - - if (!TstCompat(lb->nd_type, ub->nd_type)) { - node_error(ub, "types of subrange bounds not equal"); - return error_type; - } - - if (tp == intorcard_type) { - /* Lower bound >= 0; in this case, the base type is CARDINAL, - according to the language definition, par. 6.3 - */ - assert(lb->nd_INT >= 0); - tp = card_type; - } - - /* Check base type - */ - if (! (tp->tp_fund & T_DISCRETE)) { - node_error(ub, "illegal base type for subrange"); - return error_type; - } - - /* Check bounds - */ - if (lb->nd_INT > ub->nd_INT) { - node_error(ub, "lower bound exceeds upper bound"); - } - - /* Now construct resulting type - */ - res = construct_type(T_SUBRANGE, tp); - res->sub_lb = lb->nd_INT; - res->sub_ub = ub->nd_INT; - res->tp_size = tp->tp_size; - res->tp_align = tp->tp_align; - if (tp == card_type) { - if (ufit(res->sub_ub, 1)) { - res->tp_size = 1; - res->tp_align = 1; - } - else if (ufit(res->sub_ub, 2)) { - res->tp_size = short_size; - res->tp_align = short_align; - } - } - else if (tp == int_type) { - if (fit(res->sub_lb, 1) && fit(res->sub_ub, 1)) { - res->tp_size = 1; - res->tp_align = 1; - } - else if (fit(res->sub_lb, short_size) && - fit(res->sub_ub, short_size)) { - res->tp_size = short_size; - res->tp_align = short_align; - } - } - return res; -} - -struct type * -proc_type(result_type, parameters, n_bytes_params) - struct type *result_type; - struct paramlist *parameters; - arith n_bytes_params; -{ - register struct type *tp = construct_type(T_PROCEDURE, result_type); - - tp->prc_params = parameters; - tp->prc_nbpar = n_bytes_params; - return tp; -} - -genrck(tp) - register struct type *tp; -{ - /* generate a range check descriptor for type "tp" when - neccessary. Return its label. - */ - arith lb, ub; - register label ol; - int newlabel = 0; - - getbounds(tp, &lb, &ub); - - if (tp->tp_fund == T_SUBRANGE) { - if (!(ol = tp->sub_rck)) { - tp->sub_rck = ol = ++data_label; - newlabel = 1; - } - } - else if (!(ol = tp->enm_rck)) { - tp->enm_rck = ol = ++data_label; - newlabel = 1; - } - if (newlabel) { - C_df_dlb(ol); - C_rom_cst(lb); - C_rom_cst(ub); - } - C_lae_dlb(ol, (arith) 0); - C_rck(word_size); -} - -getbounds(tp, plo, phi) - register struct type *tp; - arith *plo, *phi; -{ - /* Get the bounds of a bounded type - */ - - assert(bounded(tp)); - - if (tp->tp_fund == T_SUBRANGE) { - *plo = tp->sub_lb; - *phi = tp->sub_ub; - } - else { - *plo = 0; - *phi = tp->enm_ncst - 1; - } -} - -struct type * -set_type(tp) - register struct type *tp; -{ - /* Construct a set type with base type "tp", but first - perform some checks - */ - arith lb, ub; - - if (! bounded(tp)) { - error("illegal base type for set"); - return error_type; - } - - getbounds(tp, &lb, &ub); - - if (lb < 0 || ub > MAXSET-1) { - error("set type limits exceeded"); - return error_type; - } - - tp = construct_type(T_SET, tp); - tp->tp_size = WA((ub - lb + 8) >> 3); - return tp; -} - -arith -ArrayElSize(tp) - register struct type *tp; -{ - /* Align element size to alignment requirement of element type. - Also make sure that its size is either a dividor of the word_size, - or a multiple of it. - */ - register arith algn; - - if (tp->tp_fund == T_ARRAY) ArraySizes(tp); - algn = align(tp->tp_size, tp->tp_align); - if (word_size % algn != 0) { - /* algn is not a dividor of the word size, so make sure it - is a multiple - */ - return WA(algn); - } - return algn; -} - -ArraySizes(tp) - register struct type *tp; -{ - /* Assign sizes to an array type, and check index type - */ - register struct type *index_type = IndexType(tp); - register struct type *elem_type = tp->arr_elem; - arith lo, hi; - - tp->arr_elsize = ArrayElSize(elem_type); - tp->tp_align = elem_type->tp_align; - - /* check index type - */ - if (! bounded(index_type)) { - error("illegal index type"); - tp->tp_size = tp->arr_elsize; - return; - } - - getbounds(index_type, &lo, &hi); - - tp->tp_size = (hi - lo + 1) * tp->arr_elsize; - - /* generate descriptor and remember label. - */ - tp->arr_descr = ++data_label; - C_df_dlb(tp->arr_descr); - C_rom_cst(lo); - C_rom_cst(hi - lo); - C_rom_cst(tp->arr_elsize); -} - -FreeType(tp) - struct type *tp; -{ - /* Release type structures indicated by "tp". - This procedure is only called for types, constructed with - T_PROCEDURE. - */ - register struct paramlist *pr, *pr1; - - assert(tp->tp_fund == T_PROCEDURE); - - pr = ParamList(tp); - while (pr) { - pr1 = pr; - pr = pr->next; - free_def(pr1->par_def); - free_paramlist(pr1); - } - - free_type(tp); -} - -DeclareType(nd, df, tp) - register struct def *df; - register struct type *tp; - struct node *nd; -{ - /* A type with type-description "tp" is declared and must - be bound to definition "df". - This routine also handles the case that the type-field of - "df" is already bound. In that case, it is either an opaque - type, or an error message was given when "df" was created. - */ - - if (df->df_type && df->df_type->tp_fund == T_HIDDEN) { - if (! (tp->tp_fund & (T_POINTER|T_HIDDEN|T_EQUAL))) { - node_error(nd, - "opaque type \"%s\" is not a pointer type", - df->df_idf->id_text); - } - df->df_type->next = tp; - df->df_type->tp_fund = T_EQUAL; - while (tp != df->df_type && tp->tp_fund == T_EQUAL) { - tp = tp->next; - } - if (tp == df->df_type) { - /* Circular definition! */ - node_error(nd, - "opaque type \"%s\" has a circular definition", - df->df_idf->id_text); - } - } - else df->df_type = tp; -} - -struct type * -RemoveEqual(tpx) - register struct type *tpx; -{ - - if (tpx) while (tpx->tp_fund == T_EQUAL) tpx = tpx->next; - return tpx; -} - -int -gcd(m, n) - register int m, n; -{ - /* Greatest Common Divisor - */ - register int r; - - while (n) { - r = m % n; - m = n; - n = r; - } - return m; -} - -int -lcm(m, n) - int m, n; -{ - /* Least Common Multiple - */ - return m * (n / gcd(m, n)); -} - -#ifdef DEBUG -DumpType(tp) - register struct type *tp; -{ - if (!tp) return; - - print("align:%d; size:%ld;", tp->tp_align, (long) tp->tp_size); - - print(" fund:"); - switch(tp->tp_fund) { - case T_RECORD: - print("RECORD"); break; - case T_ENUMERATION: - print("ENUMERATION; ncst:%d", tp->enm_ncst); break; - case T_INTEGER: - print("INTEGER"); break; - case T_CARDINAL: - print("CARDINAL"); break; - case T_REAL: - print("REAL"); break; - case T_HIDDEN: - print("HIDDEN"); break; - case T_EQUAL: - print("EQUAL"); break; - case T_POINTER: - print("POINTER"); break; - case T_CHAR: - print("CHAR"); break; - case T_WORD: - print("WORD"); break; - case T_SET: - print("SET"); break; - case T_SUBRANGE: - print("SUBRANGE %ld-%ld", (long) tp->sub_lb, (long) tp->sub_ub); - break; - case T_PROCEDURE: - { - register struct paramlist *par = ParamList(tp); - - print("PROCEDURE"); - if (par) { - print("("); - while(par) { - if (IsVarParam(par)) print("VAR "); - DumpType(TypeOfParam(par)); - par = par->next; - } - } - break; - } - case T_ARRAY: - print("ARRAY"); - print("; element:"); - DumpType(tp->arr_elem); - print("; index:"); - DumpType(tp->next); - print(";"); - return; - case T_STRING: - print("STRING"); break; - case T_INTORCARD: - print("INTORCARD"); break; - default: - crash("DumpType"); - } - if (tp->next && tp->tp_fund != T_POINTER) { - /* Avoid printing recursive types! - */ - print(" next:("); - DumpType(tp->next); - print(")"); - } - print(";"); -} -#endif diff --git a/lang/m2/comp/typequiv.c b/lang/m2/comp/typequiv.c deleted file mode 100644 index ffd5aa42b..000000000 --- a/lang/m2/comp/typequiv.c +++ /dev/null @@ -1,232 +0,0 @@ -/* T Y P E E Q U I V A L E N C E */ - -/* Routines for testing type equivalence, type compatibility, and - assignment compatibility -*/ -#include "debug.h" - -#include -#include -#include - -#include "type.h" -#include "def.h" -#include "LLlex.h" -#include "node.h" -#include "warning.h" - -int -TstTypeEquiv(tp1, tp2) - struct type *tp1, *tp2; -{ - /* test if two types are equivalent. - */ - - return tp1 == tp2 - || - tp1 == error_type - || - tp2 == error_type; -} - -int -TstParEquiv(tp1, tp2) - register struct type *tp1, *tp2; -{ - /* test if two parameter types are equivalent. This routine - is used to check if two different procedure declarations - (one in the definition module, one in the implementation - module) are equivalent. A complication comes from dynamic - arrays. - */ - - return - TstTypeEquiv(tp1, tp2) - || - ( - IsConformantArray(tp1) - && - IsConformantArray(tp2) - && - TstTypeEquiv(tp1->arr_elem, tp2->arr_elem) - ); -} - -int -TstProcEquiv(tp1, tp2) - register struct type *tp1, *tp2; -{ - /* Test if two procedure types are equivalent. This routine - may also be used for the testing of assignment compatibility - between procedure variables and procedures. - */ - register struct paramlist *p1, *p2; - - /* First check if the result types are equivalent - */ - if (! TstTypeEquiv(ResultType(tp1), ResultType(tp2))) return 0; - - p1 = ParamList(tp1); - p2 = ParamList(tp2); - - /* Now check the parameters - */ - while (p1 && p2) { - if (IsVarParam(p1) != IsVarParam(p2) || - !TstParEquiv(TypeOfParam(p1), TypeOfParam(p2))) return 0; - p1 = p1->next; - p2 = p2->next; - } - - /* Here, at least one of the parameterlists is exhausted. - Check that they are both. - */ - return p1 == p2; -} - -int -TstCompat(tp1, tp2) - register struct type *tp1, *tp2; -{ - /* test if two types are compatible. See section 6.3 of the - Modula-2 Report for a definition of "compatible". - */ - - if (TstTypeEquiv(tp1, tp2)) return 1; - - tp1 = BaseType(tp1); - tp2 = BaseType(tp2); - - return tp1 == tp2 - || - ( tp1 == intorcard_type - && - (tp2 == int_type || tp2 == card_type || tp2 == address_type) - ) - || - ( tp2 == intorcard_type - && - (tp1 == int_type || tp1 == card_type || tp1 == address_type) - ) - || - ( tp1 == address_type - && - ( tp2 == card_type - || tp2->tp_fund == T_POINTER - ) - ) - || - ( tp2 == address_type - && - ( tp1 == card_type - || tp1->tp_fund == T_POINTER - ) - ) - ; -} - -int -TstAssCompat(tp1, tp2) - register struct type *tp1, *tp2; -{ - /* Test if two types are assignment compatible. - See Def 9.1. - */ - register struct type *tp; - - if (TstCompat(tp1, tp2)) return 1; - - tp1 = BaseType(tp1); - tp2 = BaseType(tp2); - - if ((tp1->tp_fund & T_INTORCARD) && - (tp2->tp_fund & T_INTORCARD)) return 1; - - if (tp1->tp_fund == T_PROCEDURE && - tp2->tp_fund == T_PROCEDURE) { - return TstProcEquiv(tp1, tp2); - } - - if (tp1->tp_fund == T_ARRAY) { - /* check for string - */ - arith size; - - if (IsConformantArray(tp1)) return 0; - - tp = IndexType(tp1); - if (tp->tp_fund == T_SUBRANGE) { - size = tp->sub_ub - tp->sub_lb + 1; - } - else size = tp->enm_ncst; - tp1 = BaseType(tp1->arr_elem); - return - tp1 == char_type - && (tp2->tp_fund == T_STRING && size >= tp2->tp_size) - ; - } - - return 0; -} - -int -TstParCompat(formaltype, actualtype, VARflag, nd) - register struct type *formaltype, *actualtype; - struct node *nd; -{ - /* Check type compatibility for a parameter in a procedure call. - Assignment compatibility may do if the parameter is - a value parameter. - Otherwise, a conformant array may do, or an ARRAY OF (WORD|BYTE) - may do too. - Or: a WORD may do. - */ - - return - TstTypeEquiv(formaltype, actualtype) - || - ( !VARflag && TstAssCompat(formaltype, actualtype)) - || - ( formaltype == address_type - && actualtype->tp_fund == T_POINTER - ) - || - ( formaltype == word_type - && - ( actualtype->tp_size == word_size - || - ( !VARflag - && - actualtype->tp_size <= word_size - ) - ) - ) - || - ( formaltype == byte_type - && actualtype->tp_size == (arith) 1 - ) - || - ( IsConformantArray(formaltype) - && - ( formaltype->arr_elem == word_type - || formaltype->arr_elem == byte_type - || - ( actualtype->tp_fund == T_ARRAY - && TstTypeEquiv(formaltype->arr_elem,actualtype->arr_elem) - ) - || - ( actualtype->tp_fund == T_STRING - && TstTypeEquiv(formaltype->arr_elem, char_type) - ) - ) - ) - || - ( VARflag - && ( TstCompat(formaltype, actualtype) - && -(node_warning(nd, W_OLDFASHIONED, "types of formal and actual must be identical"), - 1) - ) - ) - ; -} diff --git a/lang/m2/comp/walk.c b/lang/m2/comp/walk.c deleted file mode 100644 index 4fce40119..000000000 --- a/lang/m2/comp/walk.c +++ /dev/null @@ -1,780 +0,0 @@ -/* P A R S E T R E E W A L K E R */ - -/* Routines to walk through parts of the parse tree, and generate - code for these parts. -*/ - -#include "debug.h" - -#include -#include -#include -#include -#include - -#include "def.h" -#include "type.h" -#include "scope.h" -#include "main.h" -#include "LLlex.h" -#include "node.h" -#include "Lpars.h" -#include "desig.h" -#include "f_info.h" -#include "idf.h" -#include "chk_expr.h" -#include "walk.h" -#include "warning.h" - -extern arith NewPtr(); -extern arith NewInt(); -extern int proclevel; -label text_label; -label data_label; -static struct type *func_type; -struct withdesig *WithDesigs; -struct node *Modules; -static struct node *priority; - -#define NO_EXIT_LABEL ((label) 0) -#define RETURN_LABEL ((label) 1) - -STATIC -DoPriority() -{ - if (priority) { - C_loc(priority->nd_INT); - C_cal("_stackprio"); - C_asp(word_size); - } -} - -STATIC -EndPriority() -{ - if (priority) { - C_cal("_unstackprio"); - } -} - -STATIC -DoProfil() -{ - static label filename_label = 0; - - if (! options['L']) { - register label fn_label = filename_label; - - if (!fn_label) { - filename_label = fn_label = ++data_label; - C_df_dlb(fn_label); - C_rom_scon(FileName, (arith) (strlen(FileName) + 1)); - } - - C_fil_dlb(fn_label, (arith) 0); - } -} - -WalkModule(module) - register struct def *module; -{ - /* Walk through a module, and all its local definitions. - Also generate code for its body. - This code is collected in an initialization routine. - */ - register struct scope *sc; - struct scopelist *savevis = CurrVis; - - CurrVis = module->mod_vis; - priority = module->mod_priority; - sc = CurrentScope; - - /* Walk through it's local definitions - */ - WalkDef(sc->sc_def); - - /* Now, generate initialization code for this module. - First call initialization routines for modules defined within - this module. - */ - sc->sc_off = 0; /* no locals (yet) */ - text_label = 1; /* label at end of initialization routine */ - TmpOpen(sc); /* Initialize for temporaries */ - C_pro_narg(sc->sc_name); - DoPriority(); - DoProfil(); - if (module == Defined) { - /* Body of implementation or program module. - Call initialization routines of imported modules. - Also prevent recursive calls of this one. - */ - register struct node *nd = Modules; - - if (state == IMPLEMENTATION) { - label l1 = ++data_label; - /* we don't actually prevent recursive calls, - but do nothing if called recursively - */ - C_df_dlb(l1); - C_bss_cst(word_size, (arith) 0, 1); - /* if this one is set to non-zero, the initialization - was already done. - */ - C_loe_dlb(l1, (arith) 0); - C_zne(RETURN_LABEL); - C_ine_dlb(l1, (arith) 0); - } - - for (; nd; nd = nd->next) { - C_cal(nd->nd_IDF->id_text); - } - } - MkCalls(sc->sc_def); - proclevel++; - DO_DEBUG(options['X'], PrNode(module->mod_body, 0)); - WalkNode(module->mod_body, NO_EXIT_LABEL); - C_df_ilb(RETURN_LABEL); - EndPriority(); - C_ret((arith) 0); - C_end(-sc->sc_off); - proclevel--; - TmpClose(); - - CurrVis = savevis; -} - -WalkProcedure(procedure) - register struct def *procedure; -{ - /* Walk through the definition of a procedure and all its - local definitions, checking and generating code. - */ - struct scopelist *savevis = CurrVis; - register struct scope *sc = procedure->prc_vis->sc_scope; - register struct type *tp; - register struct paramlist *param; - label func_res_label = 0; - arith StackAdjustment = 0; - arith retsav = 0; - arith func_res_size = 0; - - proclevel++; - CurrVis = procedure->prc_vis; - - /* Generate code for all local modules and procedures - */ - WalkDef(sc->sc_def); - - /* Generate code for this procedure - */ - C_pro_narg(sc->sc_name); - DoPriority(); - DoProfil(); - TmpOpen(sc); - - func_type = tp = RemoveEqual(ResultType(procedure->df_type)); - - if (tp && IsConstructed(tp)) { - /* The result type of this procedure is constructed. - The actual procedure will return a pointer to a global - data area in which the function result is stored. - Notice that this does make the code non-reentrant. - Here, we create the data area for the function result. - */ - func_res_label = ++data_label; - C_df_dlb(func_res_label); - C_bss_cst(tp->tp_size, (arith) 0, 0); - } - - if (tp) func_res_size = WA(tp->tp_size); - - /* Generate calls to initialization routines of modules defined within - this procedure - */ - MkCalls(sc->sc_def); - - /* Make sure that arguments of size < word_size are on a - fixed place. - Also make copies of conformant arrays when neccessary. - */ - for (param = ParamList(procedure->df_type); - param; - param = param->next) { - if (! IsVarParam(param)) { - tp = TypeOfParam(param); - - if (! IsConformantArray(tp)) { - if (tp->tp_size < word_size) { - C_lol(param->par_def->var_off); - C_lal(param->par_def->var_off); - C_sti(tp->tp_size); - } - } - else { - /* Here, we have to make a copy of the - array. We must also remember how much - room is reserved for copies, because - we have to adjust the stack pointer before - a RET is done. This is even more complicated - when the procedure returns a value. - Then, the value must be saved (in retval), - the stack adjusted, the return value pushed - again, and then RET - */ - arith tmpvar = NewInt(); - - if (! StackAdjustment) { - /* First time we get here - */ - if (tp && !func_res_label) { - /* Some local space, only - needed if the value itself - is returned - */ - sc->sc_off -= func_res_size; - retsav = sc->sc_off; - } - StackAdjustment = NewInt(); - C_loc((arith) 0); - C_stl(StackAdjustment); - } - /* First compute the size of the array */ - C_lol(param->par_def->var_off + - pointer_size + word_size); - /* upper - lower */ - C_inc(); /* gives number of elements */ - C_loc(tp->arr_elem->tp_size); - C_mli(word_size); - C_loc(word_size - 1); - C_adi(word_size); - C_loc(word_size); - C_dvi(word_size); - /* size in words */ - C_loc(word_size); - C_mli(word_size); - /* size in bytes */ - C_stl(tmpvar); - C_lol(tmpvar); - C_lol(tmpvar); - C_lol(StackAdjustment); - C_adi(word_size); - C_stl(StackAdjustment); - /* remember stack adjustments */ - C_ngi(word_size); - /* Assumption: stack grows - downwards!! ??? - */ - C_ass(word_size); - /* adjusted stack pointer */ - C_lol(param->par_def->var_off); - /* push source address */ - C_lol(tmpvar); /* push size */ - C_cal("_load"); /* copy */ - C_asp(2 * word_size); - C_lor((arith) 1); - /* push new address of array - ... downwards ... ??? - */ - C_stl(param->par_def->var_off); - FreeInt(tmpvar); - } - } - } - - text_label = 1; /* label at end of procedure */ - - DO_DEBUG(options['X'], PrNode(procedure->prc_body, 0)); - WalkNode(procedure->prc_body, NO_EXIT_LABEL); - C_df_ilb(RETURN_LABEL); /* label at end */ - tp = func_type; - if (func_res_label) { - /* Fill the data area reserved for the function result - with the result - */ - C_lae_dlb(func_res_label, (arith) 0); - C_sti(tp->tp_size); - if (StackAdjustment) { - /* Remove copies of conformant arrays - */ - C_lol(StackAdjustment); - C_ass(word_size); - } - C_lae_dlb(func_res_label, (arith) 0); - EndPriority(); - C_ret(pointer_size); - } - else if (tp) { - if (StackAdjustment) { - /* First save the function result in a safe place. - Then remove copies of conformant arrays, - and put function result back on the stack - */ - C_lal(retsav); - C_sti(func_res_size); - C_lol(StackAdjustment); - C_ass(word_size); - C_lal(retsav); - C_loi(func_res_size); - } - EndPriority(); - C_ret(func_res_size); - } - else { - if (StackAdjustment) { - C_lol(StackAdjustment); - C_ass(word_size); - } - EndPriority(); - C_ret((arith) 0); - } - if (StackAdjustment) FreeInt(StackAdjustment); - if (! options['n']) RegisterMessages(sc->sc_def); - C_end(-sc->sc_off); - TmpClose(); - CurrVis = savevis; - proclevel--; -} - -WalkDef(df) - register struct def *df; -{ - /* Walk through a list of definitions - */ - - for ( ; df; df = df->df_nextinscope) { - switch(df->df_kind) { - case D_MODULE: - WalkModule(df); - break; - case D_PROCEDURE: - WalkProcedure(df); - break; - case D_VARIABLE: - if (!proclevel && !df->var_addrgiven) { - C_df_dnam(df->var_name); - C_bss_cst( - WA(df->df_type->tp_size), - (arith) 0, 0); - } - break; - default: - /* nothing */ - ; - } - } -} - -MkCalls(df) - register struct def *df; -{ - /* Generate calls to initialization routines of modules - */ - - for ( ; df; df = df->df_nextinscope) { - if (df->df_kind == D_MODULE) { - C_lxl((arith) 0); - C_cal(df->mod_vis->sc_scope->sc_name); - C_asp(pointer_size); - } - } -} - -WalkLink(nd, exit_label) - register struct node *nd; - label exit_label; -{ - /* Walk node "nd", which is a link. - */ - - while (nd && nd->nd_class == Link) { /* statement list */ - WalkNode(nd->nd_left, exit_label); - nd = nd->nd_right; - } - - WalkNode(nd, exit_label); -} - -WalkCall(nd) - register struct node *nd; -{ - assert(nd->nd_class == Call); - - if (! options['L']) C_lin((arith) nd->nd_lineno); - if (ChkCall(nd)) { - if (nd->nd_type != 0) { - node_error(nd, "procedure call expected"); - return; - } - CodeCall(nd); - } -} - -WalkStat(nd, exit_label) - register struct node *nd; - label exit_label; -{ - /* Walk through a statement, generating code for it. - */ - register struct node *left = nd->nd_left; - register struct node *right = nd->nd_right; - - assert(nd->nd_class == Stat); - - if (! options['L']) C_lin((arith) nd->nd_lineno); - switch(nd->nd_symb) { - case BECOMES: - DoAssign(nd, left, right); - break; - - case IF: - { label l1 = ++text_label, l3 = ++text_label; - - ExpectBool(left, l3, l1); - assert(right->nd_symb == THEN); - C_df_ilb(l3); - WalkNode(right->nd_left, exit_label); - - if (right->nd_right) { /* ELSE part */ - label l2 = ++text_label; - - C_bra(l2); - C_df_ilb(l1); - WalkNode(right->nd_right, exit_label); - C_df_ilb(l2); - } - else C_df_ilb(l1); - break; - } - - case CASE: - CaseCode(nd, exit_label); - break; - - case WHILE: - { label loop = ++text_label, - exit = ++text_label, - dummy = ++text_label; - - C_df_ilb(loop); - ExpectBool(left, dummy, exit); - C_df_ilb(dummy); - WalkNode(right, exit_label); - C_bra(loop); - C_df_ilb(exit); - break; - } - - case REPEAT: - { label loop = ++text_label, exit = ++text_label; - - C_df_ilb(loop); - WalkNode(left, exit_label); - ExpectBool(right, exit, loop); - C_df_ilb(exit); - break; - } - - case LOOP: - { label loop = ++text_label, exit = ++text_label; - - C_df_ilb(loop); - WalkNode(right, exit); - C_bra(loop); - C_df_ilb(exit); - break; - } - - case FOR: - { - arith tmp = 0; - register struct node *fnd; - int good_forvar; - label l1 = ++text_label; - label l2 = ++text_label; - - good_forvar = DoForInit(nd, left); - fnd = left->nd_right; - if (fnd->nd_class != Value) { - /* Upperbound not constant. - The expression may only be evaluated once, - so generate a temporary for it - */ - CodePExpr(fnd); - tmp = NewInt(); - C_stl(tmp); - } - C_df_ilb(l1); - C_dup(int_size); - if (tmp) C_lol(tmp); else C_loc(fnd->nd_INT); - if (left->nd_INT > 0) { - C_bgt(l2); - } - else C_blt(l2); - if (good_forvar) { - RangeCheck(nd->nd_type, int_type); - CodeDStore(nd); - } - WalkNode(right, exit_label); - if (good_forvar) { - CodePExpr(nd); - C_loc(left->nd_INT); - C_adi(int_size); - C_bra(l1); - C_df_ilb(l2); - C_asp(int_size); - } - if (tmp) FreeInt(tmp); - } - break; - - case WITH: - { - struct scopelist link; - struct withdesig wds; - struct desig ds; - - if (! WalkDesignator(left, &ds)) break; - if (left->nd_type->tp_fund != T_RECORD) { - node_error(left, "record variable expected"); - break; - } - - wds.w_next = WithDesigs; - WithDesigs = &wds; - wds.w_scope = left->nd_type->rec_scope; - CodeAddress(&ds); - ds.dsg_kind = DSG_FIXED; - /* Create a designator structure for the temporary. - */ - ds.dsg_offset = NewPtr(); - ds.dsg_name = 0; - CodeStore(&ds, pointer_size, pointer_align); - ds.dsg_kind = DSG_PFIXED; - /* the record is indirectly available */ - wds.w_desig = ds; - link.sc_scope = wds.w_scope; - link.next = CurrVis; - CurrVis = &link; - WalkNode(right, exit_label); - CurrVis = link.next; - WithDesigs = wds.w_next; - FreePtr(ds.dsg_offset); - break; - } - - case EXIT: - assert(exit_label != 0); - - C_bra(exit_label); - break; - - case RETURN: - if (right) { - if (! ChkExpression(right)) break; - /* The type of the return-expression must be - assignment compatible with the result type of the - function procedure (See Rep. 9.11). - */ - if (!TstAssCompat(func_type, right->nd_type)) { -node_error(right, "type incompatibility in RETURN statement"); - break; - } - if (right->nd_type->tp_fund == T_STRING) { - CodePString(right, func_type); - } - else CodePExpr(right); - } - C_bra(RETURN_LABEL); - break; - - default: - crash("(WalkStat)"); - } -} - -extern int NodeCrash(); - -int (*WalkTable[])() = { - NodeCrash, - NodeCrash, - NodeCrash, - NodeCrash, - NodeCrash, - WalkCall, - NodeCrash, - NodeCrash, - NodeCrash, - NodeCrash, - WalkStat, - WalkLink, - NodeCrash -}; - -ExpectBool(nd, true_label, false_label) - register struct node *nd; - label true_label, false_label; -{ - /* "nd" must indicate a boolean expression. Check this and - generate code to evaluate the expression. - */ - struct desig ds; - - if (!ChkExpression(nd)) return; - - if (nd->nd_type != bool_type && nd->nd_type != error_type) { - node_error(nd, "boolean expression expected"); - } - - ds = InitDesig; - CodeExpr(nd, &ds, true_label, false_label); -} - -int -WalkExpr(nd) - register struct node *nd; -{ - /* Check an expression and generate code for it - */ - - if (! ChkExpression(nd)) return 0; - - CodePExpr(nd); - return 1; -} - -int -WalkDesignator(nd, ds) - struct node *nd; - struct desig *ds; -{ - /* Check designator and generate code for it - */ - - if (! ChkVariable(nd)) return 0; - - *ds = InitDesig; - CodeDesig(nd, ds); - return 1; -} - -DoForInit(nd, left) - register struct node *nd, *left; -{ - register struct def *df; - - nd->nd_left = nd->nd_right = 0; - nd->nd_class = Name; - nd->nd_symb = IDENT; - - if (!( ChkVariable(nd) & - WalkExpr(left->nd_left) & - ChkExpression(left->nd_right))) return 0; - - df = nd->nd_def; - if (df->df_kind == D_FIELD) { - node_error(nd, - "FOR-loop variable may not be a field of a record"); - return 1; - } - - if (!df->var_name && df->var_off >= 0) { - node_error(nd, "FOR-loop variable may not be a parameter"); - return 1; - } - - if (df->df_scope != CurrentScope) { - register struct scopelist *sc = CurrVis; - - for (;;) { - if (!sc) { - node_error(nd, - "FOR-loop variable may not be imported"); - return 1; - } - if (sc->sc_scope == df->df_scope) break; - sc = nextvisible(sc); - } - } - - if (df->df_type->tp_size > word_size || - !(df->df_type->tp_fund & T_DISCRETE)) { - node_error(nd, "illegal type of FOR loop variable"); - return 1; - } - - if (!TstCompat(df->df_type, left->nd_left->nd_type) || - !TstCompat(df->df_type, left->nd_right->nd_type)) { - if (!TstAssCompat(df->df_type, left->nd_left->nd_type) || - !TstAssCompat(df->df_type, left->nd_right->nd_type)) { - node_error(nd, "type incompatibility in FOR statement"); - return 1; - } -node_warning(nd, W_OLDFASHIONED, "compatibility required in FOR statement"); - } - - return 1; -} - -DoAssign(nd, left, right) - struct node *nd; - register struct node *left, *right; -{ - /* May we do it in this order (expression first) ??? - The reference manual sais nothing about it, but the book does: - it sais that the left hand side is evaluated first. - DAMN THE BOOK! - */ - struct desig dsr; - register struct type *rtp, *ltp; - - if (! (ChkExpression(right) & ChkVariable(left))) return; - rtp = right->nd_type; - ltp = left->nd_type; - - if (right->nd_symb == STRING) TryToString(right, ltp); - dsr = InitDesig; - - if (! TstAssCompat(ltp, rtp)) { - node_error(nd, "type incompatibility in assignment"); - return; - } - -#define StackNeededFor(ds) ((ds)->dsg_kind == DSG_PLOADED \ - || (ds)->dsg_kind == DSG_INDEXED) - CodeExpr(right, &dsr, NO_LABEL, NO_LABEL); - if (complex(rtp)) { - if (StackNeededFor(&dsr)) CodeAddress(&dsr); - } - else { - CodeValue(&dsr, rtp->tp_size, rtp->tp_align); - CodeCoercion(rtp, ltp); - RangeCheck(ltp, rtp); - } - CodeMove(&dsr, left, rtp); -} - -RegisterMessages(df) - register struct def *df; -{ - register struct type *tp; - - for (; df; df = df->df_nextinscope) { - if (df->df_kind == D_VARIABLE && !(df->df_flags & D_NOREG)) { - /* Examine type and size - */ - tp = BaseType(df->df_type); - if ((df->df_flags & D_VARPAR) || - (tp->tp_fund & (T_POINTER|T_HIDDEN|T_EQUAL))) { - C_ms_reg(df->var_off, pointer_size, - reg_pointer, 0); - } - else if (tp->tp_fund & T_NUMERIC) { - C_ms_reg(df->var_off, - tp->tp_size, - tp->tp_fund == T_REAL ? - reg_float : reg_any, - 0); - } - } - } -} diff --git a/lang/m2/comp/walk.h b/lang/m2/comp/walk.h deleted file mode 100644 index 4222dbeb5..000000000 --- a/lang/m2/comp/walk.h +++ /dev/null @@ -1,11 +0,0 @@ -/* P A R S E T R E E W A L K E R */ - -/* Definition of WalkNode macro -*/ - -extern int (*WalkTable[])(); - -#define WalkNode(xnd, xlab) ((xnd) && (*WalkTable[(xnd)->nd_class])((xnd), (xlab))) - -extern label text_label; -extern label data_label; diff --git a/lang/m2/comp/warning.h b/lang/m2/comp/warning.h deleted file mode 100644 index ee7cc60c6..000000000 --- a/lang/m2/comp/warning.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Warning classes, at the moment three of them: - Strict (R) - Ordinary (W) - Old-fashioned(O) -*/ - -/* Bits for a bit mask: */ - -#define W_ORDINARY 1 -#define W_STRICT 2 -#define W_OLDFASHIONED 4 - -#define W_ALL (W_ORDINARY|W_STRICT|W_OLDFASHIONED) - -#define W_INITIAL (W_ORDINARY | W_OLDFASHIONED) - -/* The bit mask itself: */ -extern int warning_classes; diff --git a/lang/occam/lib/AR2 b/lang/occam/lib/AR2 deleted file mode 100755 index d249beb97..000000000 --- a/lang/occam/lib/AR2 +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -case $# in - 0) ar ru /user0/bot/lib/lib2.a *.o - ranlib /user0/bot/lib/lib2.a - rm -f *.o - ;; - *) keys=$1 - shift - ar $keys /user0/bot/lib/lib2.a $* - ;; -esac diff --git a/lang/occam/lib/AR4 b/lang/occam/lib/AR4 deleted file mode 100755 index 0560c4a81..000000000 --- a/lang/occam/lib/AR4 +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -case $# in - 0) ar ru /user0/bot/lib/lib4.a *.o - ranlib /user0/bot/lib/lib4.a - rm -f *.o - ;; - *) keys=$1 - shift - ar $keys /user0/bot/lib/lib4.a $* - ;; -esac diff --git a/lang/occam/lib/Makefile b/lang/occam/lib/Makefile deleted file mode 100644 index 357ab5fbf..000000000 --- a/lang/occam/lib/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -PRIMITIVES= par_vax.s -PARALLEL= parco.c par.c co.c -OCRT= ocrt.c builtin.c channel.c chan_struct.c - -COMMON= $(PRIMITIVES) $(PARALLEL) $(OCRT) - -SIZE2= em2.e -SIZE4= em4.e - -LIB2= /user0/bot/lib/lib2.a -LIB4= /user0/bot/lib/lib4.a - -ACK2= vax2 -ACK4= vax4 - -all: lib2 lib4 - -lib2: $(COMMON) $(SIZE2) - rm -f *.o $(LIB2) - $(ACK2) -c.o -L -Dvoid=char -Dptrdiff=long $(COMMON) $(SIZE2) - ar cq $(LIB2) *.o - rm -f *.o - -lib4: $(COMMON) $(SIZE4) - rm -f *.o $(LIB4) - $(ACK4) -c.o -L -Dvoid=char $(COMMON) $(SIZE4) - ar cq $(LIB4) *.o - rm -f *.o diff --git a/lang/occam/lib/em2.e b/lang/occam/lib/em2.e deleted file mode 100644 index fb81a1edc..000000000 --- a/lang/occam/lib/em2.e +++ /dev/null @@ -1,52 +0,0 @@ - mes 2,2,4 - -oldtrp - bss 4, 0, 0 - - exp $init - pro $init, 0 - loc -321-1 - sim - lpi $catch1 - sig - sde oldtrp - cal $initfile - ret 0 - end 0 - - pro $catch1, 0 - lde oldtrp - sig - asp 4 - loe 0 - lde 4 - lol 0 - cal $catch - asp 8 - lol 0 - trp - rtt - end 0 - - exp $now - pro $now, 12 - zre deadlock - lal -12 - loc 35 - mon - asp 2 - ldl -12 - ret 4 - end 12 - - exp $block_mo - pro $block_mo, 0 - ldl 4 - ldl 8 - ldl 0 - loc 4 - loc 2 - cuu - bls 2 - ret 0 - end 0 diff --git a/lang/occam/lib/em4.e b/lang/occam/lib/em4.e deleted file mode 100644 index ff948932c..000000000 --- a/lang/occam/lib/em4.e +++ /dev/null @@ -1,49 +0,0 @@ - mes 2,4,4 - -oldtrp - bss 4, 0, 0 - - exp $init - pro $init, 0 - loc -321-1 - sim - lpi $catch1 - sig - ste oldtrp - cal $initfile - ret 0 - end 0 - - pro $catch1, 0 - loe oldtrp - sig - asp 4 - loe 0 - loe 4 - lol 0 - cal $catch - asp 12 - lol 0 - trp - rtt - end 0 - - exp $now - pro $now, 12 - zre deadlock - lal -12 - loc 35 - mon - asp 4 - lol -12 - ret 4 - end 12 - - exp $block_mo - pro $block_mo, 0 - lol 4 - lol 8 - lol 0 - bls 4 - ret 0 - end 0 diff --git a/lang/occam/lib/ocm_chan.h b/lang/occam/lib/ocm_chan.h deleted file mode 100644 index 0a010758b..000000000 --- a/lang/occam/lib/ocm_chan.h +++ /dev/null @@ -1,48 +0,0 @@ -/* $Header$ */ -/* channel.h - channel definitions */ -#include -#include "parco.h" - -typedef union channel { - struct { /* Interprocess channel */ - char _type; /* Channel type, see note */ - char synch; /* State in channel synchronization */ - long val; /* Transmitted value */ - } c; - struct { /* File channel */ - char _type; /* Dummy field, see note */ - char index; /* Index in the file array */ - char flgs; /* Status flags: in use & readahead */ - char preread; /* Possible preread character */ - } f; -} chan; -#define type c._type /* Channel type */ -/* Note: The channel type should not be part of each structure in chan. But - * the C alignment rules would make chan about 50% bigger if we had done it - * the right way. Note that the order of fields in a struct cannot be a problem - * as long as struct c is the largest within the union. - */ - -#define C_T_CHAN 0 /* Type of a interprocess channel */ -#define C_T_FILE 1 /* Type of a file channel */ - -#define C_S_FREE 0 /* IP channel is free */ -#define C_S_ANY 1 /* IP channel contains data */ -#define C_S_ACK 2 /* IP channel data is removed */ - -#define C_F_EOF (-1L) /* File channel returns EOF */ -#define C_F_TEXT (-2L) /* File channel becomes line oriented */ -#define C_F_RAW (-3L) /* File channel becomes character oriented */ - -#define C_F_INUSE 0x01 /* File channel is connected to a UNIX file */ -#define C_F_READAHEAD 0x02 /* File channel has a preread character */ - -extern chan file[_NFILE]; /* Array of file channels */ -extern FILE *unix_file[_NFILE]; /* Pointers to buffered UNIX files */ - -void c_init(); - -void chan_in(), cbyte_in(), c_wa_in(), c_ba_in(); -void chan_out(), c_wa_out(), c_ba_out(); - -int chan_any(); diff --git a/lang/occam/lib/ocm_parco.h b/lang/occam/lib/ocm_parco.h deleted file mode 100644 index 9fb1c647e..000000000 --- a/lang/occam/lib/ocm_parco.h +++ /dev/null @@ -1,19 +0,0 @@ -/* $Header$ */ -/* parco.h - Define names for simulation routines - * - * This file is to be included by users of the higher-level routines - * - */ - -void pc_begin(), resumenext(), parend(), resume(), coend(); -int pc_fork(); - -#define nullid ((int *) 0 - (int *) 0) - /* I.e. a 0 of type "pointer difference" */ - -#define parbegin(sbrk) pc_begin(sbrk, nullid) -#define parfork() pc_fork(nullid) -#define cobegin(sbrk, id) pc_begin(sbrk, id) -#define cofork(id) pc_fork(id) - -extern int deadlock; diff --git a/lang/occam/lib/ocm_proc.h b/lang/occam/lib/ocm_proc.h deleted file mode 100644 index 6eb2824f1..000000000 --- a/lang/occam/lib/ocm_proc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $Header$ */ -/* process.h - Define administration types and functions - * - * This file is to be included by implementors of the higher - * level routines - * - */ -#include "parco.h" - -#ifndef ptrdiff /* This type must be able to hold a pointer difference */ -#define ptrdiff int /* Define as long int if necessary */ -#endif - -#define nil 0 -void *alloc(), free(); - -typedef ptrdiff wordsize, identification; - -wordsize top_size(); -int top_save(); -void top_load(); /* Primitives */ - -struct procgroup; - -struct process { - struct process *next; /* Next process in the same group */ - struct procgroup *down; /* Process group running under this process */ - void *stack; /* Pointer to the saved stack top */ - identification id; /* Coroutine identification */ -}; - -#define init_between __i_b__ /* These names are hidden */ -#define save_between __s_b__ -#define load_betweens __l_b__ -#define delete_between __d_b__ - -void init_between(), save_between(), load_betweens(), delete_between(); - -struct procgroup { - struct process **active;/* Active process within this group */ - struct procgroup *up; /* The group that this group belongs to */ - struct process *first; /* List of processes belonging to this group */ - void *s_brk; /* Point where the stack is split */ - void *between; /* Stack space between s_brk and up->s_brk */ -}; - -#define group __grp__ /* Ignore this please */ -#define highest_group __hgrp__ - -extern struct procgroup *group; /* Current running group */ -extern struct procgroup *highest_group; /* highest group that has been seen - * while searching for a process - */ diff --git a/lang/occam/lib/par_em2.e b/lang/occam/lib/par_em2.e deleted file mode 100644 index ed45d527c..000000000 --- a/lang/occam/lib/par_em2.e +++ /dev/null @@ -1,53 +0,0 @@ - mes 2,2,4 - exp $top_size - pro $top_size, 14 - ldl 0 ; s_brk - lor 1 ; s_brk SP - sbs 4 ; s_brk-SP - ret 4 ; return size of block to be saved - end 14 - - exp $top_save - pro $top_save, 0 - loe 0 - lde 4 ; load line number and file name - lim ; ignore mask - lor 0 ; LB - ldl 0 ; size of block - loc 4 - loc 2 - cuu - dup 2 - stl 0 ; push & store size in 2 bytes - lor 1 ; SP (the SP BEFORE pushing) - lor 1 ; SP (address of stack top to save) - ldl 4 ; area - lol 0 ; size - bls 2 ; move whole block - asp 18 ; remove the lot from the stack - loc 1 - ret 2 ; return 1 - end 0 - - exp $top_load - pro $top_load, 0 - ldl 0 - dup 4 - sde area ; copy area pointer from argument 0 - loi 4 ; load indirect to - str 1 ; restore SP - lde area ; load area, note that the SP is now correct - lor 1 ; SP (the SP AFTER, see above) - lde area - lof 4 ; size of block - bls 2 ; move block back (SP becomes the SP BEFORE again!) - asp 2 ; drop size - str 0 ; LB - sim ; ignore mask - sde 4 - ste 0 ; line and file - loc 0 - ret 2 ; return 0 - end 0 -area - bss 4,0,0 diff --git a/lang/occam/lib/par_em4.e b/lang/occam/lib/par_em4.e deleted file mode 100644 index b47cffbd3..000000000 --- a/lang/occam/lib/par_em4.e +++ /dev/null @@ -1,46 +0,0 @@ - mes 2,4,4 - exp $top_size - pro $top_size, 20 - lol 0 ; s_brk - lor 1 ; s_brk SP - sbs 4 ; s_brk-SP - ret 4 ; return size of block to be saved - end 20 - - exp $top_save - pro $top_save, 0 - lde 0 ; load line number and file name - lim ; ignore mask - lor 0 ; LB - lol 0 ; size of block - lor 1 ; SP (the SP BEFORE pushing) - lor 1 ; SP (address of stack top to save) - lol 4 ; area - lol 0 ; size - bls 4 ; move whole block - asp 24 ; remove the lot from the stack - loc 1 - ret 4 ; return 1 - end 0 - - exp $top_load - pro $top_load, 0 - lol 0 - dup 4 - ste area ; copy area pointer from argument 0 - loi 4 ; load indirect to - str 1 ; restore sp - loe area ; load area, note that the SP is now correct - lor 1 ; SP (the SP AFTER, see above) - loe area - lof 4 ; size of block - bls 4 ; move block back (SP becomes the SP BEFORE again!) - asp 4 ; drop size - str 0 ; LB - sim ; ignore mask - sde 0 ; line and file - loc 0 - ret 4 ; return 0 - end 0 -area - bss 4,0,0 diff --git a/lang/occam/lib/par_vax.s b/lang/occam/lib/par_vax.s deleted file mode 100644 index 04ab0a977..000000000 --- a/lang/occam/lib/par_vax.s +++ /dev/null @@ -1,51 +0,0 @@ - # VAX code for the top_* primitives - - .set BIG, 0x8000 # 32K chunk per movc3 - .text - .align 1 - .globl _top_size - .globl _top_save - .globl _top_load - -_top_size: .word 0x0000 - subl3 sp, 4(ap), r0 # bytes between stack pointer and break - addl2 $(8+6+1)*4, r0 # add 8 regs, 6 pushed longwords (line, file, - ret # ap, fp, size, sp) and 1 extra argument - -_top_save: .word 0x0ff0 # save regs r4-r11 - movq hol0, -(sp) # push line number and file name - movq ap, -(sp) # push LB equivalents ap and fp - pushl 4(ap) # push size - pushal -4(sp) # push sp (the sp AFTER pushing) - movl $BIG, r6 # chunk size in r6 - movl 4(ap), r7 # size of block to move - movl sp, r1 # source address - movl 8(ap), r3 # destination address - cmpl r7, r6 - jlequ 0f -1: movc3 r6, (r1), (r3) # move chunk of the block, add r6 to r1 and r3 - subl2 r6, r7 - cmpl r7, r6 - jgtru 1b -0: movc3 r7, (r1), (r3) # move what's left - movl $1, r0 # return 1 - ret - -_top_load: .word 0x0000 - movl 4(ap), r1 # source - movl (r1), sp # restore sp - movl $BIG, r6 # chunk size - movl 4(r1), r7 # size - movl sp, r3 # destination - cmpl r7, r6 - jlequ 0f -1: movc3 r6, (r1), (r3) # move chunk of the block back - subl2 r6, r7 - cmpl r7, r6 - jgtru 1b -0: movc3 r7, (r1), (r3) # move what's left back - addl2 $8, sp # pop saved sp and size - movq (sp)+, ap # pop LB's - movq (sp)+, hol0 # pop line and file - clrl r0 # return 0 - ret diff --git a/lib/descr/ibm.nosid b/lib/descr/ibm.nosid deleted file mode 100644 index d334f57ba..000000000 --- a/lib/descr/ibm.nosid +++ /dev/null @@ -1,40 +0,0 @@ -# $Revision$ -var w=2 -var p=2 -var s=2 -var l=4 -var f=4 -var d=8 -var NAME=i8086 -var M=i86 -var LIB=lib/i86/tail_ -var LIBIBM=lib/ibm/tail_ -var RT=lib/i86/head_ -var RTIBM=lib/ibm/head_ -var CPP_F=-Dunix -var INCLUDES=-I{EM}/include -I{EM}/lib/ibm/include -name be - from .m.g - to .s - program {EM}/lib/{M}/cg - args < - stdout - need .e -end -name asld - from .s.a - to .out - outfile a.out - program {EM}/lib/{M}/as - mapflag -l* LNAME={EM}/{LIB}* - mapflag -i IFILE={EM}/{RT}i - args {IFILE?} (.e:{HEAD}={EM}/{RTIBM}em) \ - ({RTS}:.b.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \ - (.p:{TAIL}={EM}/{LIB}pc) \ - (.b:{TAIL}={EM}/{LIB}bc) \ - (.b.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \ - (.e:{TAIL}={EM}/{LIBIBM}em) \ - (.b.c.p:{TAIL}={EM}/{LIBIBM}mon) \ - (.e:{TAIL}={EM}/{LIBIBM}em.vend) - linker -end diff --git a/lib/descr/m68k2.macs b/lib/descr/m68k2.macs deleted file mode 100644 index 203e7e31b..000000000 --- a/lib/descr/m68k2.macs +++ /dev/null @@ -1,39 +0,0 @@ -# $Revision$ -var w=2 -var p=4 -var s=2 -var l=4 -var f=4 -var d=8 -var NAME=m68k2 -var M=m68k2 -var LIBDIR=/lib/{M} -var LIB=lib/{M}/tail_ -var RT=lib/{M}/head_ -var INCLUDES=-I{EM}/include -I/usr/include -name be - from .m.g - to .s - program {EM}/lib/{M}/cg - args < - stdout - need .e -end -name asld - from .s.a - to .out - outfile a.out - program {EM}/lib/{M}/as - mapflag -l* LNAME={EM}/{LIB}* - args (.e:{HEAD}={EM}/{RT}em) \ -({RTS}:.b.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \ -(.p.c.b:{TAIL}={EM}/{LIBDIR}/sys1.s) (.p:{TAIL}={EM}/{LIBDIR}/sys2.s) \ -(.c:{TAIL}={EM}/{LIBDIR}/write.s) \ -(.p:{TAIL}={EM}/{LIB}pc) \ -(.b:{TAIL}={EM}/{LIB}bc) \ -(.b.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \ -(.b.c:{TAIL}={EM}/{LIB}mon {EM}/{LIB}fake) \ -(.e:{TAIL}={EM}/{LIB}em.rt {EM}/{LIB}em.vend) - prep cond - linker -end diff --git a/lib/descr/nascom b/lib/descr/nascom deleted file mode 100644 index db67d2005..000000000 --- a/lib/descr/nascom +++ /dev/null @@ -1,30 +0,0 @@ -# $Revision$ -var w=1 -var p=2 -var s=1 -var l=2 -var f=4 -var d=8 -var NAME=nascom -var M=z80a -var LIB=lib/{M}/tail_ -var RT=lib/{M}/head_ -var INCLUDES=-I{EM}/include -I/usr/include -name be - from .m.g - to .s - program {EM}/lib/{M}/be - args < - stdout - need .e -end -name asld - from .s.a - to .out - outfile a.out - program {EM}/lib/z80/as - mapflag -l* LNAME={EM}/{LIB}* - args (.e:{HEAD}={EM}/{RT}em) ({RTS}:.b.c={EM}/{RT}cc) -o > \ -(.e:{TAIL}={EM}/{LIB}em.1 {EM}/{LIB}em.2) - linker -end diff --git a/lib/descr/net86 b/lib/descr/net86 deleted file mode 100644 index 27097aed5..000000000 --- a/lib/descr/net86 +++ /dev/null @@ -1,32 +0,0 @@ -var w=2 -var p=2 -var s=2 -var l=4 -var f=4 -var d=8 -var NAME=i8086 -var M=i86 -var LIB=mach/i86/lib/tail_ -var RT=mach/i86/lib/head_ -var INCLUDES=-I{EM}/include -I/usr/include -name be - from .m - to .s - program {EM}/lib/{M}_cg - args < - prop > - need .e -end -name asld - from .s.a - to a.out - program {EM}/lib/{M}_as - mapflag -l* LNAME={EM}/{LIB}* - mapflag -i IFILE={EM}/{RT}i - args {IFILE?} (.e:{HEAD}={EM}/{RT}em) \ -({RTS}:.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \ -(.p:{TAIL}={EM}/{LIB}pc) (.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \ -(.c.p.e:{TAIL}={EM}/{LIB}netio) (.c.p.e:{TAIL}={EM}/{LIB}alo) \ -(.c.p:{TAIL}={EM}/{LIB}mon) (.e:{TAIL}={EM}/{LIB}em) - prop C -end diff --git a/lib/descr/sat86 b/lib/descr/sat86 deleted file mode 100644 index ecfa18d82..000000000 --- a/lib/descr/sat86 +++ /dev/null @@ -1,34 +0,0 @@ -var w=2 -var p=2 -var s=2 -var l=4 -var f=4 -var d=8 -var NAME=i8086 -var M=i86 -var LIB=mach/i86/lib/tail_ -var ALIB=mach/i86/lib/sat_tail_ -var RT=mach/i86/lib/head_ -var ART=mach/i86/lib/sat_head_ -var CCP_F=-Dunix -var INCLUDES=-I{EM}/include -I/usr/include -name be - from .m - to .s - program {EM}/lib/{M}_cg - args < - prop > - need .e -end -name asld - from .s.a - to a.out - program {EM}/lib/{M}_as - mapflag -l* LNAME={EM}/{LIB}* - args (.e:{HEAD}={EM}/{ART}em) \ -({RTS}:.c={EM}/{RT}cc) ({RTS}:.p={EM}/{RT}pc) -o > < \ -(.p:{TAIL}={EM}/{LIB}pc) (.c:{TAIL}={EM}/{LIB}cc.1s {EM}/{LIB}cc.2g) \ -(.c.p:{TAIL}={EM}/{ALIB}mon) (.c.p.e:{TAIL}={EM}/{LIB}alo) \ -(.e:{TAIL}={EM}/{LIB}em) - prop C -end diff --git a/lib/vax4/sedf b/lib/vax4/sedf deleted file mode 100644 index b26db01c9..000000000 --- a/lib/vax4/sedf +++ /dev/null @@ -1,104 +0,0 @@ -# $Header$ -/movab/ { -s/movab 1(\(.*\)),\1$/incl \1/ -s/movab -1(\(.*\)),\1$/decl \1/ -s/movab \([0-9]*\)(\(.*\)),\2$/addl2 $\1,\2/ -s/movab -\([0-9]*\)(\(.*\)),\2$/subl2 $\1,\2/ -s/movab 0(\(.*\)) \[\(.*\)\],\1$/addl2 \2,\1/ -s/movab 0(\(.*\)) \[\(.*\)\],\2$/addl2 \1,\2/ -} -/$0/ { -s/movz[bw]\([wl]\) $0,/clr\1 / -s/mov\([bwl]\) $0,/clr\1 / -s/cvt[bw]\([wl]\) $0,/clr\1 / -} -/add/ { -s/\(add[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/ -s/\(add[fdlw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/ -s/add\([wl]\)2 \$-\([0-9]*\),/sub\12 $\2,/ -s/add\([wl]\)3 \$-\([0-9]*\),/sub\13 $\2,/ -s/add\([wl]\)3 \(.*\),\$-\([0-9]*\),/sub\13 $\3,\2,/ -} -/mul/ { -s/\(mul[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/ -s/\(mul[fdlw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/ -} -/sub/ { -s/\(sub[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/ -s/sub\([wl]\)2 \$-\([0-9]*\),/add\12 $\2,/ -s/sub\([wl]\)3 \$-\([0-9]*\),/add\13 $\2,/ -} -/div/s/\(div[fdlw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/ -/bi/s/\(bi[cs][lw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/ -/bis/s/\(bis[lw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/ -/xor/ { -s/\(xor[lw]\)3 \(.*\),\(.*\),\3$/\12 \2,\3/ -s/\(xor[lw]\)3 \(.*\),\(.*\),\2$/\12 \3,\2/ -} -/$1/ { -s/add\([wl]\)2 \$1,/inc\1 / -s/sub\([wl]\)2 \$1,/dec\1 / -} -/$-1/ { -s/add\([wl]\)2 \$-1,/dec\1 / -s/sub\([wl]\)2 \$-1,/inc\1 / -} -/cmp[bwl].*$0/ { -N -s/cmp\([bwl]\) \(.*\),$0$/tst\1 \2/ -s/cmp\([bwl]\) $0,\(.*\)\njneq/tst\1 \2\ -jneq/ -s/cmp\([bwl]\) $0,\(.*\)\njeql/tst\1 \2\ -jeql/ -s/cmp\([bwl]\) $0,\(.*\)\njgtr/tst\1 \2\ -jlss/ -s/cmp\([bwl]\) $0,\(.*\)\njlss/tst\1 \2\ -jgtr/ -s/cmp\([bwl]\) $0,\(.*\)\njgeq/tst\1 \2\ -jleq/ -s/cmp\([bwl]\) $0,\(.*\)\njleq/tst\1 \2\ -jgeq/ -P -D -} -/(sp)+/ { -N -s/movl (sp)+,\(.*\)\npushl \1$/movl (sp),\1/ -s/tst[wl] (sp)+\nmovl fp,sp$/movl fp,sp/ -s/tst\([wl]\) (sp)+\nmov\1 \(.*\),-(sp)/mov\1 \2,(sp)/ -s/tst\([wl]\) (sp)+\nclr\1 -(sp)/clr\1 (sp)/ -s/tst\([wl]\) (sp)+\nmovzb\1 \(.*\),-(sp)/movzb\1 \2,(sp)/ -s/tst\([wl]\) (sp)+\ncvtb\1 \(.*\),-(sp)/cvtb\1 \2,(sp)/ -s/tst\([wl]\) (sp)+\ntst\1 \(.*\)$/mov\1 \2,(sp)+/ -s/tstl (sp)+\npushl \(.*\)$/movl \1,(sp)/ -s/tstl (sp)+\npusha\([bwlq]\) \(.*\)$/mova\1 \2,(sp)/ -P -D -} -/^addl2 .*,sp/ { -N -s/addl2 .*,sp\nmovl fp,sp$/movl fp,sp/ -s/^addl2 $6,sp\nmovw \(.*\),-(sp)/tstl (sp)+\ -movw \1,(sp)/ -s/^addl2 $6,sp\nclrw -(sp)/tstl (sp)+\ -clrw (sp)/ -s/^addl2 $8,sp\nmovq \(.*\),-(sp)/movq \1,(sp)/ -P -D -} -/clrw -(sp)/ { -N -s/clrw -(sp)\nmovw \($[0-9]*\),-(sp)/pushl \1/ -s/clrw -(sp)\nmnegw $\([0-9]*\),-(sp)/movzwl $-\1,-(sp)/ -s/clrw -(sp)\nmovw \(.*\),-(sp)/movzwl \1,-(sp)/ -s/clrw -(sp)\ncvtbw \(\$[0-9]*\),-(sp)/pushl \1/ -s/clrw -(sp)\ncvtbw \(\$.*\),-(sp)/movzwl \1,-(sp)/ -P -D -} -/mov/ { -N -s/mov\([wl]\) \(.*\),\(.*\)\ntst\1 \3$/mov\1 \2,\3/ -P -D -} diff --git a/mach/i80/libmon/head.s b/mach/i80/libmon/head.s deleted file mode 100644 index f5bd23517..000000000 --- a/mach/i80/libmon/head.s +++ /dev/null @@ -1,49 +0,0 @@ -.define hol0, argv, envp, begbss -.define .ignmask,.reghp,.trapproc,.fra -.define .retadr,.retadr1,.areg,.bcreg,.tmp1 -.define block1, block2, block3 -.define .stop - - .base 0x1000 -.text - lxi h,0x1000 ! stack will grow from 0x1000 downwards - sphl - lxi h,begbss ! clear bss - lxi d,endbss-begbss - mvi c,0 - -2: mov m,c - inx h - dcx d - mov a,e - ora d - jnz 2b - - lxi h,envp ! call main - push h - lxi h,argv - push h - lxi h,0 - push h - call _m_a_i_n -.stop: jmp 0xfb52 - -.bss -begbss: -.trapproc: .space 2 -.ignmask: .space 2 -.data -hol0: .space 8 -.reghp: .word endbss -argv: .word 0 -envp: .word 0 -.retadr: .space 2 ! used to save return address -.retadr1: .space 2 ! reserve -.bcreg: .space 2 ! used to save localbase -.areg: .space 1 -.tmp1: .space 2 -.fra: .space 8 ! 8 bytes function return area -block1: .space 4 ! used by 32 bits divide and -block2: .space 4 ! multiply routines -block3: .space 4 - diff --git a/mach/i80/libmon/tail.s b/mach/i80/libmon/tail.s deleted file mode 100644 index bd667480e..000000000 --- a/mach/i80/libmon/tail.s +++ /dev/null @@ -1,7 +0,0 @@ -.define endtext, enddata, endbss -.text -endtext: .align 2 -.data -enddata: .align 2 -.bss -endbss: .align 2 diff --git a/mach/i86/as/READ_ME b/mach/i86/as/READ_ME deleted file mode 100644 index b620073b9..000000000 --- a/mach/i86/as/READ_ME +++ /dev/null @@ -1,9 +0,0 @@ -The mach?.c files in this directory were made for an earlier version of -the universal assembler and are too dependent on its innards. -I have no idea in what way they should be changed. - - Duk Bekema - -I adapted them to the new framework. It appears to work now. - - Ceriel Jacobs diff --git a/mach/i86/libem/tail.s b/mach/i86/libem/tail.s deleted file mode 100644 index 059b23769..000000000 --- a/mach/i86/libem/tail.s +++ /dev/null @@ -1,16 +0,0 @@ -.define endtext,enddata,endbss -.define _end,_etext,_edata - - ! $Header$ - .text -endtext: -_etext: - .align 2 - .data -enddata: -_edata: - .align 2 - .bss -_end: -endbss: - .align 2 diff --git a/mach/m68k2/cv/cv.prev.c b/mach/m68k2/cv/cv.prev.c deleted file mode 100644 index d5b358ed7..000000000 --- a/mach/m68k2/cv/cv.prev.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -#include -#include "out.h" - -#ifndef NORCSID -static char rcs_id[] = "$Header$" ; -#endif - -#define ASSERT(x) switch (2) { case 0: case (x): ; } - -/* - * Header and section table of new format object file. - */ -struct outhead outhead; -struct outsect outsect[S_MAX]; - -char *output_file; -int output_file_created; - -char *program ; - -main(argc, argv) - int argc; - char *argv[]; -{ - register int nsect; - register struct outsect *sectp; - register FILE *input; - register FILE *output; - - ASSERT(sizeof(struct outhead) == SZ_HEAD); - ASSERT(sizeof(struct outsect) == SZ_SECT); - - input = stdin; output = stdout; - program= argv[0] ; - switch (argc) { - case 1: break; - case 3: if ((output = fopen(argv[2], "w")) == (FILE *)0) - fatal("Can't write %s.\n", argv[2]); - output_file = argv[2]; - output_file_created = 1; - /* FALLTHROUGH */ - case 2: if ((input = fopen(argv[1], "r")) == (FILE *)0) - fatal("Can't read %s.\n", argv[1]); - break; - default:fatal("Usage: %s
.\n", argv[0]); - } - if ( !rhead(input,&outhead) ) - fatal("Reading header failed.\n"); - if (BADMAGIC(outhead)) - fatal("Not an ack object file.\n"); - if (outhead.oh_nrelo > 0) - fprintf(stderr, "Warning: relocation information present.\n"); - for ( nsect=0 ; nsectos_base; - flen = sectp->os_flen; -#ifdef DO_BSS - zero = sectp->os_size - flen; -#endif DO_BSS - - while (flen) { - cnt = flen > BUFSIZ ? BUFSIZ : flen; - if (fread((char *)buffer, 1, cnt, input) != cnt) - fatal("Reading code bytes failed.\n"); - if (fwrite((char *)&base, 4, 1, output) != 1) - fatal("Writing start address failed.\n"); - if (fwrite((char *)&cnt, 2, 1, output) != 1) - fatal("Writing byte count failed.\n"); - if (fwrite((char *)buffer, 1, cnt, output) != cnt) - fatal("Writing byte count failed.\n"); - base += cnt; - flen -= cnt; - } -#ifdef DO_BSS - while (zero) { - cnt = zero > BUFSIZ ? BUFSIZ : zero; - if (fwrite((char *)&base, 4, 1, output) != 1) - fatal("Writing start address failed.\n"); - if (fwrite((char *)&cnt, 2, 1, output) != 1) - fatal("Writing byte count failed.\n"); - if (fseek(output, (long)cnt, 1) < (long)0) - fatal("Fseek failed.\n"); - base += cnt; - zero -= cnt; - } -#endif DO_BSS - sectp++; - } - exit(0); -} - -rhead(f,head) struct outhead *head ; FILE *f ; { - char buf[SZ_HEAD] ; - if ( fread(buf,SZ_HEAD,1,f)!=1 ) return 0 ; - iconvert(buf,(char *)head,SF_HEAD) ; - return 1 ; -} - -rsect(f,sect) struct outsect *sect ; FILE *f ; { - char buf[SZ_SECT] ; - if ( fread(buf,SZ_SECT,1,f)!=1 ) return 0 ; - iconvert(buf,(char *)sect,SF_SECT) ; - return 1 ; -} - -rrelo(f,relo) struct outrelo *relo ; FILE *f ; { - char buf[SZ_RELO] ; - if ( fread(buf,SZ_RELO,1,f)!=1 ) return 0 ; - iconvert(buf,(char *)relo,SF_RELO) ; - return 1 ; -} - -rname(f,name) struct outname *name ; FILE *f ; { - char buf[SZ_NAME] ; - if ( fread(buf,SZ_NAME,1,f)!=1 ) return 0 ; - iconvert(buf,(char *)name,SF_NAME) ; - return 1 ; -} - -iconvert(buf,str,fmt) char *buf, *str, *fmt ; { - register char *nf, *ni, *no ; - int last, i ; - long value ; - ni=buf ; no=str ; nf=fmt ; - while ( last = *nf++ ) { - last -= '0' ; - if ( last<1 || last >9 ) fatal("illegal out.h format string\n"); - value=0 ; - i=last ; - while ( i-- ) { - value = (value<<8) + (ni[i]&0xFF) ; - } - switch ( last ) { - case 0 : break ; - case 1 : *no= value ; break ; - case 2 : *(unsigned short *)no = value ; break ; - case 4 : *(long *)no = value ; break ; - default : - fatal("illegal out.h format string\n"); - } - ni += last ; no += last ; - } -} - -/* VARARGS1 */ -fatal(s, a1, a2) - char *s; -{ - fprintf(stderr,"%s: ",program) ; - fprintf(stderr, s, a1, a2); - if (output_file_created) - unlink(output_file); - exit(-1); -} diff --git a/mach/m68k2/dl/cv.c b/mach/m68k2/dl/cv.c deleted file mode 100644 index 0fa9c30aa..000000000 --- a/mach/m68k2/dl/cv.c +++ /dev/null @@ -1,71 +0,0 @@ -static char rcsid[] = "$Header$"; -/* - * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. - * - * This product is part of the Amsterdam Compiler Kit. - * - * Permission to use, sell, duplicate or disclose this software must be - * obtained in writing. Requests for such permissions may be sent to - * - * Dr. Andrew S. Tanenbaum - * Wiskundig Seminarium - * Vrije Universiteit - * Postbox 7161 - * 1007 MC Amsterdam - * The Netherlands - * - */ - -#include -#include - -/* - * NOTE: Beware that the a.out.h file included here should be the a.out.h - * file of the TARGET machine, not of the SOURCE machine. - */ - -struct bhdr s_exec; - -main(argc,argv) char **argv; { - unsigned short losh,hish; - long addr,maxaddr; - short count; - - maxaddr=0; - if (argc != 3) { - fprintf(stderr,"Usage: %s VU-a.out Bleasdale-a.out\n",argv[0]); - exit(-1); - } - if (freopen(argv[1],"r",stdin)==NULL) { - perror(argv[1]); - exit(-1); - } - if (freopen(argv[2],"w",stdout)==NULL) { - perror(argv[2]); - exit(-1); - } - while (fread(&hish,sizeof(short),1,stdin)==1) { - if (fread(&losh,sizeof(short),1,stdin)!=1) - exit(fprintf(stderr,"foo\n")); - addr=losh+(((long)hish)*65536L); - addr -= 0x20000; /* entry point is 0x20000 on Bleasdale */ - if (fread(&count,sizeof(short),1,stdin)!=1) - exit(fprintf(stderr,"bar\n")); - fseek(stdout,addr+sizeof(s_exec),0); - while (count--) { - putchar(getchar()); - addr++; - } - if (addr>maxaddr) - maxaddr = addr; - } - s_exec.fmagic = FMAGIC; - s_exec.dsize = maxaddr; - s_exec.entry = 0x20000; - fseek(stdout,0L,0); - fwrite(&s_exec,sizeof(s_exec),1,stdout); - chmod(argv[2],0755); - return 0; -} - - diff --git a/mach/m68k2/libem/READ_ME b/mach/m68k2/libem/READ_ME deleted file mode 100644 index f0e7d9a76..000000000 --- a/mach/m68k2/libem/READ_ME +++ /dev/null @@ -1,5 +0,0 @@ -The original EM library routines saved all registers -(including scratch registers) in global data; hence they -were not reentrant. -The new routines do not save registers d0,d1,d2,a0 and a1. -They are reentrant. diff --git a/mach/m68k4/libem/aciaio.s b/mach/m68k4/libem/aciaio.s deleted file mode 100644 index 09577e1fd..000000000 --- a/mach/m68k4/libem/aciaio.s +++ /dev/null @@ -1,36 +0,0 @@ -.define .outch1,.outch2,.inch1,.inch2 -.sect .text -.sect .rom -.sect .data -.sect .bss - - ! a0,d0 used - ! character in d1 - - .sect .text -.inch1: - move.l #acia1,a0 - bra .inch -.inch2: - move.l #acia2,a0 -.inch: - move.b (a0),d1 - asr #1,d1 - bcc .inch - move.b 2(a0),d1 - and #0x7f,d1 - rts - -.outch1: - move.l #acia1,a0 - bra .outch -.outch2: - move.l #acia2,a0 -.outch: - move.b (a0),d0 - asr #2,d0 - bcc .outch - move.b d1,2(a0) - rts - -.align 2 diff --git a/mach/m68k4/libem/ara.s b/mach/m68k4/libem/ara.s deleted file mode 100644 index e4e9ab195..000000000 --- a/mach/m68k4/libem/ara.s +++ /dev/null @@ -1,101 +0,0 @@ -.define .sar -.define .lar -.define .aar -.sect .text -.sect .rom -.sect .data -.sect .bss - - !register usage: - ! a0 : descriptor address - ! d0 : index - ! a1 : base address - .sect .text -.aar: - move.l 4(sp),a0 ! descriptor address - move.l 8(sp),d0 ! index - sub.l (a0),d0 ! index - lower bound : relative index - move.l 8(a0),-(sp) ! # bytes / element - move.l d0,-(sp) - jsr .mlu - move.l 12(sp),a1 ! base address - add.l d1,a1 ! address of element - move.l (sp)+,a0 ! return address - add.l #8,sp ! pop arguments - move.l a1,(sp) ! returned on stack - jmp (a0) - -.lar: - ! register usage: like .aar - - move.l 4(sp),a0 - move.l 8(sp),d0 - move.l 12(sp),a1 - sub.l (a0),d0 - move.l d0,-(sp) - move.l 8(a0),-(sp) - jsr .mlu - move.l 12(sp),a1 - move.l 4(sp),a0 - add.l d1,a1 ! address of element - move.l 8(a0),d0 - add.l d0,a1 ! a1++ because of predecrement - move.l (sp)+,a0 ! return address - add.l #12,sp ! pop parameters - clr.l d1 !?nodig? - asr #1,d0 - bne 3f - move.b -(a1),d1 ! 1 byte element - move.l d1,-(sp) - bra 5f -3: - asr #1,d0 - bne 4f - move.w -(a1),d1 ! 2 byte element - move.l d1,-(sp) - bra 5f -4: - sub.l #1,d0 -1: - move.l -(a1),-(sp) ! 4n byte element (n = 1,2,...) - dbf d0,1b -5: - jmp (a0) - -.sar: - !register usage: same as lar - - move.l 4(sp),a0 - move.l 8(sp),d0 - move.l 12(sp),a1 - sub.l (a0),d0 - move.l d0,-(sp) - move.l 8(a0),-(sp) - jsr .mlu - move.l 12(sp),a1 - move.l 4(sp),a0 - add.l d1,a1 - move.l 8(a0),d0 ! # bytes / element - move.l (sp)+,a0 ! return address - add.l #12,sp ! pop parameters - clr.l d1 !?nodig? - asr #1,d0 - bne 3f - move.l (sp)+,d1 - move.b d1,(a1) ! 1 byte element - bra 4f -3: - asr #1,d0 - bne 5f - move.l (sp)+,d1 - move.w d1,(a1) ! 2 byte element - bra 4f -5: - sub.l #1,d0 -1: - move.l (sp)+,(a1)+ ! 4n byte element (n = 1,2,...) - dbf d0,1b -4: - jmp (a0) - -.align 2 diff --git a/mach/m68k4/libem/ari.s b/mach/m68k4/libem/ari.s deleted file mode 100644 index cefb0f663..000000000 --- a/mach/m68k4/libem/ari.s +++ /dev/null @@ -1,36 +0,0 @@ -.define .sari -.define .lari -.define .aari -.sect .text -.sect .rom -.sect .data -.sect .bss - - .sect .text -.aari: - move.l (sp)+,d0 ! return address - cmp.l #4, (sp)+ ! size of descriptor elements - bne 9f - move.l d0,-(sp) - jmp .aar - - -.lari: - move.l (sp)+,d0 ! return address - cmp.l #4, (sp)+ ! size of descriptor elements - bne 9f - move.l d0,-(sp) - jmp .lar -9: - move.w #EILLINS,-(sp) - jmp .fat - - -.sari: - move.l (sp)+,d0 ! return address - cmp.l #4, (sp)+ ! size of descriptor elements - bne 9b - move.l d0,-(sp) - jmp .sar - -.align 2 diff --git a/mach/m68k4/libem/sav.s b/mach/m68k4/libem/sav.s deleted file mode 100644 index 5f29178c0..000000000 --- a/mach/m68k4/libem/sav.s +++ /dev/null @@ -1,13 +0,0 @@ -.define .savd0 -.define .savret -.define .savreg - -.data -.savd0: - .long 0 -.savret: - .long 0 -.savreg: - .space 128 -.text -.align 2 diff --git a/mach/m68k4/libem/sys1.s b/mach/m68k4/libem/sys1.s deleted file mode 100644 index 49a3d7590..000000000 --- a/mach/m68k4/libem/sys1.s +++ /dev/null @@ -1,62 +0,0 @@ -.extern _errno -.sect .text -.sect .rom -.sect .data -.sect .bss -.sect .data -_errno: -.extern _lseek -.short 0 -.sect .text -_lseek: -link a6,#-0 -.sect .data -_13: -.short 29561 -.short 29489 -.short 11875 -.short 0 -.sect .text -move.l #_13,.filn -move.w #8,.lino -move.w #0,-(sp) -move.w #0,-(sp) -move.l (sp)+,d0 -unlk a6 -rts -.extern _close -_close: -link a6,#-0 -move.l #_13,.filn -move.w #12,.lino -move.w #0,-(sp) -move.w (sp)+,d0 -unlk a6 -rts -.extern _ioctl -_ioctl: -link a6,#-0 -move.l #_13,.filn -move.w #18,.lino -move.w #0,-(sp) -move.w (sp)+,d0 -unlk a6 -rts -.extern _read -_read: -link a6,#-0 -move.l #_13,.filn -move.w #24,.lino -move.w #-1,-(sp) -move.w (sp)+,d0 -unlk a6 -rts -.extern _open -_open: -link a6,#-0 -move.l #_13,.filn -move.w #30,.lino -move.w #-1,-(sp) -move.w (sp)+,d0 -unlk a6 -rts diff --git a/mach/m68k4/libem/sys2.s b/mach/m68k4/libem/sys2.s deleted file mode 100644 index 661f2fb57..000000000 --- a/mach/m68k4/libem/sys2.s +++ /dev/null @@ -1,11 +0,0 @@ -.extern _exit -.sect .text -.sect .rom -.sect .data -.sect .bss -! Fake system call for 68000 running MACSBUG - -.sect .text - -_exit: - jmp 0x0200f6 diff --git a/mach/mantra/int/header b/mach/mantra/int/header deleted file mode 100644 index ff0fa03e4..000000000 --- a/mach/mantra/int/header +++ /dev/null @@ -1,8 +0,0 @@ -!definitions -!#define lword -!#define FLTRAP -#define opfreq 0 -#define last 1 -#define test 1 -#define count 0 -#define flow 0 diff --git a/mach/mantra/int/mloope b/mach/mantra/int/mloope deleted file mode 100644 index 9507ea16e..000000000 --- a/mach/mantra/int/mloope +++ /dev/null @@ -1,11 +0,0 @@ -.sect .text -.sect .rom -.sect .data -.sect .bss -.sect .text - .sect .text -end: - .sect .bss -endbss: - .sect .data -enddata: diff --git a/mach/mantra/int/prep b/mach/mantra/int/prep deleted file mode 100755 index 4f4c41996..000000000 --- a/mach/mantra/int/prep +++ /dev/null @@ -1,3 +0,0 @@ -rm -f temp.c -cat header deffile $1 >> temp.c -../../../lib/cpp -P temp.c >$2 diff --git a/mach/pdp/cg/peep.c b/mach/pdp/cg/peep.c deleted file mode 100644 index 32d0d040b..000000000 --- a/mach/pdp/cg/peep.c +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef NORCSID -static char rcsid[] = "$Header$"; -#endif - -#include - -/* - * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. - * - * This product is part of the Amsterdam Compiler Kit. - * - * Permission to use, sell, duplicate or disclose this software must be - * obtained in writing. Requests for such permissions may be sent to - * - * Dr. Andrew S. Tanenbaum - * Wiskundig Seminarium - * Vrije Universiteit - * Postbox 7161 - * 1007 MC Amsterdam - * The Netherlands - * - * Author: Hans van Staveren - */ - -char buf[512]; -char *index(); - -main() { - register n,sa; - register char *p; - - sa=0; - for (;;) { - getline(buf); - if (n=stackadjust()) { - sa += n; - continue; - } - if (nullinstruction()) - continue; - if (sa) { - if (buf[0]=='t' && buf[1]=='s' && buf[2]=='t' && buf[3]==' ') { - sa -= 2; - buf[0]='m'; - buf[1]='o'; - buf[2]='v'; - strcat(buf,",(sp)+"); - } else if (buf[0]=='m' && buf[1]=='o' && buf[2]=='v' && - buf[3]==' ' && (p=index(&buf[5],','))!=0 && - p[1]=='-' && p[2]=='(' && p[3]=='s') { - sa -= 2; - p[1]=' '; - } - } - switch(sa) { - case 0:break; - case 2:puts("tst (sp)+");sa=0;break; - case 4:puts("cmp (sp)+,(sp)+");sa=0;break; - case 6:puts("add $06,sp");sa=0;break; - } - puts(buf); - } -} - -getline(buf) register char *buf; { - register c; - - while ((c=getchar())==' ' || c=='\t') - ; - if (c==EOF) - exit(0); - do *buf++=c; - while ((c=getchar())!='\n'); - *buf=0; -} - -stackadjust() { - - if (buf[0]=='t' && - buf[1]=='s' && - buf[2]=='t' && - buf[3]==' ' && - buf[4]=='(' && - buf[5]=='s' && - buf[6]=='p' && - buf[7]==')' && - buf[8]=='+') return(2); - if (buf[0]=='c' && - buf[1]=='m' && - buf[2]=='p' && - buf[3]==' ' && - buf[4]=='(' && - buf[5]=='s' && - buf[6]=='p' && - buf[7]==')' && - buf[8]=='+' && - buf[9]==',' && - buf[10]=='(' && - buf[11]=='s' && - buf[12]=='p' && - buf[13]==')' && - buf[14]=='+') return(4); - if (buf[0]=='a' && - buf[1]=='d' && - buf[2]=='d' && - buf[3]==' ' && - buf[4]=='$' && - buf[5]=='0' && - buf[6]=='6' && - buf[7]==',' && - buf[8]=='s' && - buf[9]=='p' && - buf[10]==0) return(6); - return(0); -} - -nullinstruction() { - register char *p; - - if (buf[4]=='$' && buf[5]=='0' && buf[6]=='0' && buf[7]==',') { - p=index(buf,'-'); - if (p!=0 && p[1]=='(') - return(0); - p=index(buf,'+'); - if (p!=0 && p[-1]==')') - return(0); - if (buf[0]=='b' && buf[1]=='i' && (buf[2]=='s' || buf[2]=='c')) - return(1); - if (buf[0]=='a' && buf[1]=='d' && buf[2]=='d') - return(1); - if (buf[0]=='s' && buf[1]=='u' && buf[2]=='b') - return(1); - } - return(0); -} diff --git a/mach/pdp/libem/blm.s b/mach/pdp/libem/blm.s deleted file mode 100644 index ea55f5f13..000000000 --- a/mach/pdp/libem/blm.s +++ /dev/null @@ -1,29 +0,0 @@ -/ $Header$ -.globl blm~ -.globl save~,retu~ - -/ Size in r0 -blm~: - jsr pc,save~ - mov (sp)+,r2 - mov (sp)+,r3 - mov r0,r1 - asr r0 - beq 2f -/ Now avoid wrong copy. -/ The pieces may overlap ! - cmp r3,r2 - beq 2f - blt 3f -1: - mov (r3)+,(r2)+ - sob r0,1b -2: - jmp retu~ -3: - add r1,r3 - add r1,r2 -4: - mov -(r3),-(r2) - sob r0,4b - br 2b diff --git a/mach/pdp/libpc/makefile b/mach/pdp/libpc/makefile deleted file mode 100644 index ddc6a8e63..000000000 --- a/mach/pdp/libpc/makefile +++ /dev/null @@ -1,21 +0,0 @@ -MAKEFILE=../../proto/libg/Makefile -MACHDEF="MACH=pdp -Rbe-p2" "SUF=s" "ASAR=ar" -PCDEF="PREF=pc" "SUB=" "SRC=lang/pc/libpc" -LIBDIR=../lib - -install: - make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) cp - -cmp: - make -f $(MAKEFILE) $(PCDEF) $(MACHDEF) all - cmp head_pc $(LIBDIR)/head_pc - cmp tail_pc $(LIBDIR)/tail_pc - -clean: - -rm -f *.old *.[ce$(SUF)] tail* head* - -opr: - make pr | opr - -pr: - @pr Makefile diff --git a/mach/pdp/ncg/mach.c b/mach/pdp/ncg/mach.c deleted file mode 100644 index 9f9e95e3a..000000000 --- a/mach/pdp/ncg/mach.c +++ /dev/null @@ -1,205 +0,0 @@ -#ifndef NORCSID -static char rcsid[] = "$Header$"; -#endif - -/* - * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. - * - * This product is part of the Amsterdam Compiler Kit. - * - * Permission to use, sell, duplicate or disclose this software must be - * obtained in writing. Requests for such permissions may be sent to - * - * Dr. Andrew S. Tanenbaum - * Wiskundig Seminarium - * Vrije Universiteit - * Postbox 7161 - * 1007 MC Amsterdam - * The Netherlands - * - * Author: Hans van Staveren - */ - -/* - * machine dependent back end routines for the PDP-11 - */ - -con_part(sz,w) register sz; word w; { - - while (part_size % sz) - part_size++; - if (part_size == 2) - part_flush(); - if (sz == 1) { - w &= 0xFF; - if (part_size) - w <<= 8; - part_word |= w; - } else { - assert(sz == 2); - part_word = w; - } - part_size += sz; -} - -con_mult(sz) word sz; { - long l; - - if (sz != 4) - fatal("bad icon/ucon size"); - l = atol(str); - fprintf(codefile,"\t%o;%o\n",(int)(l>>16),(int)l); -} - -con_float() { - double f; - register short *p,i; - - /* - * This code is correct only when the code generator is - * run on a PDP-11 or VAX-11 since it assumes native - * floating point format is PDP-11 format. - */ - - if (argval != 4 && argval != 8) - fatal("bad fcon size"); - f = atof(str); - p = (short *) &f; - i = *p++; - if (argval == 8) { - fprintf(codefile,"\t%o;%o;",i,*p++); - i = *p++; - } - fprintf(codefile,"\t%o;%o\n",i,*p++); -} - -#ifdef REGVARS - -char Rstring[10]; -full lbytes; -struct regadm { - char *ra_str; - long ra_off; -} regadm[2]; -int n_regvars; - -regscore(off,size,typ,score,totyp) long off; { - - /* - * This function is full of magic constants. - * They are a result of experimentation. - */ - - if (size != 2) - return(-1); - score -= 1; /* allow for save/restore */ - if (off>=0) - score -= 2; - if (typ==reg_pointer) - score *= 17; - else if (typ==reg_loop) - score = 10*score+50; /* Guestimate */ - else - score *= 10; - return(score); /* 10 * estimated # of words of profit */ -} - -i_regsave() { - - Rstring[0] = 0; - n_regvars=0; -} - -f_regsave() { - register i; - - if (n_regvars==0 || lbytes==0) { - fprintf(codefile,"mov r5,-(sp)\nmov sp,r5\n"); - if (lbytes == 2) - fprintf(codefile,"tst -(sp)\n"); - else if (lbytes!=0) - fprintf(codefile,"sub $0%o,sp\n",lbytes); - for (i=0;i6) { - fprintf(codefile,"mov $0%o,r0\n",lbytes); - fprintf(codefile,"jsr r5,PR%s\n",Rstring); - } else { - fprintf(codefile,"jsr r5,PR%d%s\n",lbytes,Rstring); - } - } - for (i=0;i=0) - fprintf(codefile,"mov 0%lo(r5),%s\n",regadm[i].ra_off, - regadm[i].ra_str); -} - -regsave(regstr,off,size) char *regstr; long off; { - - fprintf(codefile,"/ Local %ld into %s\n",off,regstr); - strcat(Rstring,regstr); - regadm[n_regvars].ra_str = regstr; - regadm[n_regvars].ra_off = off; - n_regvars++; -} - -regreturn() { - - fprintf(codefile,"jmp RT%s\n",Rstring); -} - -#endif - -prolog(nlocals) full nlocals; { - -#ifndef REGVARS - fprintf(codefile,"mov r5,-(sp)\nmov sp,r5\n"); - if (nlocals == 0) - return; - if (nlocals == 2) - fprintf(codefile,"tst -(sp)\n"); - else - fprintf(codefile,"sub $0%o,sp\n",nlocals); -#else - lbytes = nlocals; -#endif -} - -dlbdlb(as,ls) string as,ls; { - - if (strlen(as)+strlen(ls)+23 -uses REG={LOCAL, SL, 2}, - REG={const2,$1-1} -gen 1: - move {regind2,%a, SL},%a - sob %b,{label,1b} yields %a - -pat lxa $1==0 yields {addr_local, SL} - -pat lxa $1==1 -uses REG={LOCAL, SL, 2 } yields {regconst2, %a, SL } - -pat lxa $1==2 -uses REG={LOCAL, SL, 2 } -gen move {regind2, %a, SL }, %a yields {regconst2, %a, SL } - -pat lxa $1==3 -uses REG={LOCAL, SL, 2 } -gen move {regind2, %a, SL }, %a - move {regind2, %a, SL }, %a yields {regconst2, %a, SL } - -pat lxa $1 > 3 -uses REG={LOCAL, SL, 2}, - REG={const2,$1-1} -gen 1: - move {regind2,%a, SL},%a - sob %b,{label,1b} yields {regconst2, %a, SL } - -pat dch leaving loi 2 - -pat loi $1==2 -with REG yields {regdef2, %1} -with exact regconst2 yields {regind2, %1.reg, %1.off} -with exact relative2 yields {reldef2, %1.off} -with exact regind2 yields {reginddef2, %1.reg, %1.off} -with exact regdef2 yields {reginddef2, %1.reg, 0} -with exact addr_local yields {LOCAL, %1.ind,2} -with exact addr_external yields {relative2, %1.off} -with exact LOCAL yields {reginddef2, lb, %1.ind} - -pat loi $1==1 -with REG yields {regdef1, %1} -with exact regconst2 yields {regind1, %1.reg, %1.off} -with exact addr_external yields {relative1, %1.off} -with exact addr_local yields {regind1, lb, %1.ind} -with exact relative2 yields {reldef1, %1.off} -with exact regind2 yields {reginddef1, %1.reg, %1.off} -with exact regdef2 yields {reginddef1, %1.reg, 0} -with exact LOCAL yields {reginddef1, lb, %1.ind} - -pat loi $1==4 -with REG yields {regdef4, %1} -with exact regconst2 yields {regind4, %1.reg, %1.off} -with exact addr_local yields {DLOCAL,%1.ind,4} -with exact addr_external yields {relative4, %1.off} - -pat loi $1==8 -with REG yields {regdef8, %1} -with exact regconst2 yields {regind8, %1.reg, %1.off} -with exact addr_local yields {regind8, lb , %1.ind} -with exact addr_external yields {relative8, %1.off} - -pat loi -with exact addr_local - kills ALL - uses REG={const2,$1/2}, REG - gen move lb,%b - add {const2,%1.ind+$1},%b - 1: - mov {autodec,%b},{autodec,sp} - sob %a,{label,1b} -with exact addr_external - kills ALL - uses REG={const2,$1/2}, REG - gen mov {addr_external,%1.off+$1},%b - 1: - mov {autodec,%b},{autodec,sp} - sob %a,{label,1b} -with REG - kills ALL - uses REG={const2,$1} - gen add %a,%1 - asr %a - 1: - mov {autodec,%1},{autodec,sp} - sob %a,{label,1b} - - -pat ldl yields {DLOCAL, $1,4} -pat lde yields {relative4, $1} -pat ldf -with regconst2 yields {regind4,%1.reg,$1+%1.off} -with exact addr_external yields {relative4, $1+%1.off} -with exact addr_local yields {DLOCAL, %1.ind+$1,4} - -pat lpi yields {addr_external, $1} - -/**************************************************************** - * Group 2 : Store instructions. * - * * - * These instructions are likely to ruin the fake-stack. * - * We don't expect many items on the fake-stack anyway * - * because we seem to have evaluated an expression just now. * - ****************************************************************/ - -pat stl with xsrc2 -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen move %1,{LOCAL,$1,2} - -pat ste with xsrc2 -kills posextern -gen move %1, {relative2, $1 } - -pat sil with xsrc2 -kills allexeptcon -gen move %1, {reginddef2,lb,$1} - -pat stf -with regconst2 xsrc2 - kills allexeptcon - gen move %2,{regind2,%1.reg,$1+%1.off} -with addr_external xsrc2 - kills allexeptcon - gen move %2,{relative2,$1+%1.off} - -pat sti $1==2 -with REG xsrc2 - kills allexeptcon - gen move%2,{regdef2,%1} -with regconst2 xsrc2 - kills allexeptcon - gen move%2,{regind2,%1.reg,%1.off} -with addr_external xsrc2 - kills allexeptcon - gen move %2,{relative2,%1.off} -with addr_local xsrc2 - kills allexeptcon - gen move %2,{LOCAL, %1.ind, 2} -with relative2 xsrc2 - kills allexeptcon - gen move %2,{reldef2,%1.off} -with regind2 xsrc2 - kills allexeptcon - gen move %2,{reginddef2,%1.reg,%1.off} - -pat sti $1==1 -with REG src1or2 - kills allexeptcon - gen move %2,{regdef1,%1} -with exact regconst2 src1or2 - kills allexeptcon - gen move %2,{regind1,%1.reg,%1.off} -with exact addr_external src1or2 - kills allexeptcon - gen move %2,{relative1,%1.off} -with exact addr_local src1or2 - kills allexeptcon - gen move %2,{regind1, lb, %1.ind} -with exact relative2 src1or2 - kills allexeptcon - gen move %2,{reldef1,%1.off} -with exact regind2 src1or2 - kills allexeptcon - gen move %2,{reginddef1,%1.reg,%1.off} - -pat sti $1==4 -with exact REG FLTREG - kills allexeptcon - gen movfo %2,{regdef4,%1} -with exact regind2 FLTREG - kills allexeptcon - gen movfo %2,{reginddef4,%1.reg,%1.off} -with exact relative2 FLTREG - kills allexeptcon - gen movfo %2,{reldef4,%1.off} -with exact REG ftolong - kills allexeptcon - gen setl. - movfi %2.reg,{regdef2,%1} - seti. -with exact regind2 ftolong - kills allexeptcon - gen setl. - movfi %2.reg,{reginddef2,%1.reg,%1.off} - seti. -with exact relative2 ftolong - kills allexeptcon - gen setl. - movfi %2.reg,{reldef2,%1.off} - seti. -with exact regconst2 FLTREG - kills allexeptcon - gen movfo %2,{regind4,%1.reg,%1.off} -with exact regconst2 ftolong - kills allexeptcon - gen setl. - movfi %2.reg,{regind2,%1.reg,%1.off} - seti. -with exact addr_local FLTREG - kills allexeptcon - gen movfo %2,{DLOCAL,%1.ind,4} -with exact addr_local ftolong - kills allexeptcon - gen setl. - movfi %2.reg,{DLOCAL,%1.ind,4} - seti. -with exact addr_external FLTREG - kills allexeptcon - gen movfo %2,{relative4,%1.off} -with exact addr_external ftolong - kills allexeptcon - gen setl. - movfi %2.reg,{relative2,%1.off} - seti. -with REG src2 src2 - kills allexeptcon - gen move %2,{regdef2,%1} - move %3,{regind2,%1,2} -with REG STACK - gen mov {autoinc,sp},{autoinc,%1} - mov {autoinc,sp},{regdef2,%1} - -pat sti $1==8 -with exact REG DBLREG - kills allexeptcon - gen movf %2,{regdef8,%1} -with exact regind2 DBLREG - kills allexeptcon - gen movf %2,{reginddef8,%1.reg,%1.off} -with exact relative2 DBLREG - kills allexeptcon - gen movf %2,{reldef8,%1.off} -with exact regconst2 DBLREG - kills allexeptcon - gen movf %2,{regind8,%1.reg,%1.off} -with exact addr_local DBLREG - kills allexeptcon - gen movf %2,{regind8, lb, %1.ind} -with exact addr_external DBLREG - kills allexeptcon - gen movf %2,{relative8, %1.off} -with REG regind8 - kills allexeptcon - gen mov {regind2,%2.reg,%2.off },{autoinc,%1} - mov {regind2,%2.reg,%2.off+2},{autoinc,%1} - mov {regind2,%2.reg,%2.off+4},{autoinc,%1} - mov {regind2,%2.reg,%2.off+6},{regdef2,%1} -with REG relative8 - kills allexeptcon - uses REG={addr_external,%2.off} - gen mov {autoinc,%a},{autoinc,%1} - mov {autoinc,%a},{autoinc,%1} - mov {autoinc,%a},{autoinc,%1} - mov {regdef2,%a},{regdef2,%1} -with REG STACK - gen mov {autoinc,sp},{autoinc,%1} - mov {autoinc,sp},{autoinc,%1} - mov {autoinc,sp},{autoinc,%1} - mov {autoinc,sp},{regdef2,%1} - -pat sti -with REG STACK -uses REG={const2,$1/2} -gen 1: - mov {autoinc,sp},{autoinc,%1} - sob %a,{label,1b} - -pat lal sti $2>2 && $2<=8 -with exact xsrc2 - yields %1 - leaving stl $1 lal $1+2 sti $2-2 -with - yields {addr_local,$1} - leaving sti $2 - -pat sdl -with exact FLTREG - kills indordef, locals %ind <= $1+2 && %ind+%size > $1 - gen move %1,{DLOCAL,$1,4} -with exact ftolong - kills indordef, locals %ind <= $1+2 && %ind+%size > $1 - gen setl. - movfi %1.reg,{DLOCAL,$1,4} - seti. -with src2 src2 - kills indordef, locals %ind <= $1+2 && %ind+%size > $1 - gen move %1,{LOCAL,$1,2} - move %2,{LOCAL,$1+2,2} - -pat sde -with exact FLTREG - kills posextern - gen move %1,{relative4,$1} -with exact ftolong - kills posextern - gen setl. - movfi %1.reg,{relative4,$1} - seti. -with src2 src2 - kills posextern - gen move %1, {relative2, $1 } - move %2, {relative2, $1+2} - -pat sdf -with exact regconst2 FLTREG - kills allexeptcon - gen move %2,{regind4,%1.reg,$1+%1.off} -with exact regconst2 ftolong - kills allexeptcon - gen setl. - movfi %2.reg,{regind4,%1.reg,$1+%1.off} - seti. -with exact addr_external FLTREG - kills allexeptcon - gen move %2,{relative4,$1+%1.off} -with exact addr_external ftolong - kills allexeptcon - gen setl. - movfi %2.reg,{relative4, $1+%1.off} - seti. -with regconst2 src2 src2 - kills allexeptcon - gen move %2,{regind2,%1.reg,$1+%1.off} - move %3,{regind2,%1.reg,$1+2+%1.off} -with addr_external src2 src2 - kills allexeptcon - gen move %2,{relative2,$1+%1.off} - move %3,{relative2,$1+2+%1.off} - -/**************************************************************** - * Group 3 : Integer arithmetic. * - * * - * Implemented (sometimes with the use of subroutines) : * - * all 2 and 4 byte arithmetic. * - ****************************************************************/ - -pat adi $1==2 -with exact REG const2 yields {regconst2,%1,%2.num} -with exact REG addr_external yields {regconst2,%1,%2.off} -with exact REG addr_local - gen add lb,%1 yields {regconst2,%1,%2.ind} -with exact REG addr_local - uses REG - gen mov lb,%a - add %1,%a yields {regconst2,%a,%2.ind} -with exact REG regconst2 - gen add %2.reg,%1 yields {regconst2,%1,%2.off} -with exact src2-REG const2+addr_external+addr_local - uses reusing %1,REG=%1 yields %2 %a - leaving adi 2 -with exact regconst2 const2 yields {regconst2,%1.reg,%2.num+%1.off} -with exact regconst2 addr_external yields {regconst2,%1.reg,%2.off+%1.off} -with exact regconst2 addr_local - gen add lb,%1.reg yields {regconst2,%1.reg,%2.ind+%1.off} -with exact regconst2 regconst2 - gen add %2.reg,%1.reg yields {regconst2,%1.reg,%2.off+%1.off} -with exact regconst2 noconst2 - gen add %2,%1.reg yields %1 -with exact REG noconst2 - gen add %2,%1 yields %1 -with exact src2 regconst2 - gen add %1,%2.reg yields %2 -with exact regconst2 src2 - gen add %2,%1.reg yields %1 -with src2 REG - gen add %1,%2 yields %2 - -pat adi $1==4 -with REG REG src2 src2 - gen add %4,%2 - adc %1 - add %3,%1 yields %2 %1 -with REG REG src2 STACK - gen add {autoinc,sp},%2 - adc %1 - add %3,%1 yields %2 %1 -with REG REG STACK - gen add {autoinc,sp},%1 - add {autoinc,sp},%2 - adc %1 yields %2 %1 -with src2 src2 REG REG - gen add %2,%4 - adc %3 - add %1,%3 yields %4 %3 - -pat sbi $1==2 -with src2 REG - gen sub %1,%2 yields %2 -with exact REG src2-REG - gen sub %2,%1 - neg %1 yields %1 - -pat sbi $1==4 -with src2-REG src2-REG REG REG - gen sub %2,%4 - sbc %3 - sub %1,%3 yields %4 %3 -with src2 src2 STACK - gen sub %2,{regind2,sp,2} - sbc {regdef2,sp} - sub %1,{regdef2,sp} - -pat mli $1==2 -with ODDREG src2 - gen mul %2,%1 yields %1 -with src2 ODDREG - gen mul %1,%2 yields %2 - -pat mli $1==4 -with STACK - gen jsr pc,{label, "mli4~"} yields r1 r0 - -pat dvi $1==2 -with src2 src2 - uses reusing %2,REGPAIR - gen mov %2,%a.2 - sxt %a.1 - div %1,%a.1 yields %a.1 -with src2 src2 STACK - gen mov %1,{autodec,sp} - mov %2,r1 - sxt r0 - div {autoinc,sp},r0 yields r0 - -pat dvi $1==4 -with STACK - gen jsr pc,{label, "dvi4~"} yields r1 r0 - -pat rmi $1==2 -with src2 src2 - uses reusing %2,REGPAIR - gen mov %2,%a.2 - sxt %a.1 - div %1,%a.1 yields %a.2 -with src2 src2 STACK - gen mov %1,{autodec,sp} - mov %2,r1 - sxt r0 - div {autoinc,sp},r0 yields r1 - -pat rmi $1==4 -with STACK -gen jsr pc,{label, "rmi4~"} yields r1 r0 - -pat ngi $1==2 -with REG -gen neg %1 yields %1 - -pat ngi $1==4 -with REG REG -gen neg %1 - neg %2 - sbc %1 yields %2 %1 - -pat loc sli $1==1 && $2==2 -with REG -gen asl %1 yields %1 - -pat sli $1==2 -with src2 REG -gen ash %1,%2 yields %2 - -pat sli $1==4 -with src2 REGPAIR -gen ashc %1,%2 yields %2 - -pat loc sri $1==1 && $2==2 -with REG -gen asr %1 yields %1 - -pat loc sri $2==2 -with REG -gen ash {const2,0-$1},%1 yields %1 - -pat sri $1==2 -with REG REG -gen neg %1 - ash %1,%2 yields %2 - -pat loc sri $2==4 -with REGPAIR -gen ashc {const2,0-$1},%1 yields %1 - -pat sri $1==4 -with REG REGPAIR -gen neg %1 - ashc %1,%2 yields %2 - -/************************************************ - * Group 4 : unsigned arithmetic * - * * - * adu = adi * - * sbu = sbi * - * slu = sli * - * * - * Supported : 2- and 4 byte arithmetic. * - ************************************************/ - -pat adu leaving adi $1 -pat sbu leaving sbi $1 -pat mlu $1==2 leaving mli 2 - -pat mlu $1==4 -with STACK -gen jsr pc,{label, "mlu4~"} yields r1 r0 - -pat dvu $1==2 -with STACK -gen jsr pc,{label, "dvu2~"} yields r0 - -pat dvu $1==4 -with STACK -gen jsr pc,{label, "dvu4~"} yields r1 r0 - -pat rmu $1==2 -with STACK -gen jsr pc,{label, "rmu2~"} yields r1 - -pat rmu $1==4 -with STACK -gen jsr pc,{label, "rmu4~"} yields r1 r0 - -pat slu leaving sli $1 - -pat sru $1==2 -with REG xsrc2 -uses reusing %2,REGPAIR -gen move %2,%a.2 - move {const2,0},%a.1 - neg %1 - ashc %1,%a yields %a.2 - -pat loc sru $2==2 -with xsrc2 -uses reusing %1,REGPAIR -gen move %1,%a.2 - move {const2,0},%a.1 - ashc {const2,0-$1},%a yields %a.2 - -pat sru $1==4 -with STACK -gen move {const2,$1},r0 - jsr pc,{label, "sru~"} - -/************************************************ - * Group 5 : Floating point arithmetic * - * * - * Supported : 4- and 8 byte arithmetic. * - ************************************************/ - -pat adf $1==4 -with FLTREG FLTREG - gen addf %1,%2 yields %2 -with FLTREG FLTREG - gen addf %2,%1 yields %1 - -pat adf $1==8 -with double8 DBLREG - gen addf %1,%2 yields %2 -with DBLREG double8 -gen addf %2,%1 yields %1 - -pat sbf $1==4 -with FLTREG FLTREG -gen subf %1,%2 yields %2 - -pat sbf $1==8 -with double8 DBLREG -gen subf %1,%2 yields %2 - -pat mlf $1==4 -with FLTREG FLTREG - gen mulf %1,%2 yields %2 -with FLTREG FLTREG - gen mulf %2,%1 yields %1 - -pat mlf $1==8 -with double8 DBLREG - gen mulf %1,%2 yields %2 -with DBLREG double8 - gen mulf %2,%1 yields %1 - -pat dvf $1==4 -with FLTREG FLTREG -gen divf %1,%2 yields %2 - -pat dvf $1==8 -with double8 DBLREG -gen divf %1,%2 yields %2 - -pat ngf $1==4 -with FLTREG -gen negf %1 yields %1 - -pat ngf $1==8 -with DBLREG -gen negf %1 yields %1 - -pat fif $1==4 -with longf4 FLTREG -uses FLTREGPAIR -gen move %1,%a.1 - modf %2,%a yields %a.1 %a.2 - -pat fif $1==8 -with double8 double8 -uses DBLREGPAIR -gen move %1,%a.1 - modf %2,%a yields %a.1 %a.2 - -pat fef $1==4 -with FLTREG -uses REG -gen movei %1,%a - movie {const2,0},%1 yields %1 %a - -pat fef $1==8 -with DBLREG -uses REG -gen movei %1,%a - movie {const2,0},%1 yields %1 %a - -/**************************************** - * Group 6 : pointer arithmetic. * - * * - * Pointers have size 2 bytes. * - ****************************************/ - -pat adp -with REG yields {regconst2, %1, $1} -with exact regconst2 yields {regconst2, %1.reg, $1+%1.off} -with exact addr_external yields {addr_external, $1+%1.off} -with exact addr_local yields {addr_local,%1.ind+$1} - -pat ads $1==2 leaving adi 2 -pat sbs $1==2 leaving sbi $1 - -/**************************************** - * Group 7 : increment/decrement/zero * - ****************************************/ - -pat inc -with REG -gen inc %1 yields %1 - -pat inl -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen inc {LOCAL,$1,2} - -pat ine -kills posextern -gen inc {relative2, $1} - -pat dec -with REG -gen dec %1 yields %1 - -pat del -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen dec {LOCAL, $1, 2} - -pat dee -kills posextern -gen dec {relative2, $1} - -pat lol loc sbi stl $1==$4 && $3==2 -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen sub {const2,$2},{LOCAL,$1,2} - -pat lol ngi stl $1==$3 && $2==2 -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen neg {LOCAL, $1, 2} - -pat lil ngi sil $1==$3 && $2==2 -kills allexeptcon -gen neg {ILOCAL, $1} - -pat lil inc sil $1==$3 -kills allexeptcon -gen inc {ILOCAL, $1} - -pat lol adi stl $2==2 && $1==$3 -with src2 -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen add %1,{LOCAL, $1, 2} - -pat lol adp stl $1==$3 && $2==1 -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen inc {LOCAL, $1, 2} - -pat lol adp stl $1==$3 -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen add {const2, $2},{LOCAL, $1, 2} - -pat loe adi ste $2==2 && $1==$3 -with src2 -kills posextern -gen add %1,{relative2, $1} - -pat loe adp ste $1==$3 -kills posextern -gen add {const2, $2},{relative2, $1} - -pat lol ior stl $2==2 && $1==$3 -with src2 -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen bis %1,{LOCAL, $1, 2} - -pat loe ior ste $2==2 && $1==$3 -with src2 -kills posextern -gen bis %1,{relative2, $1} - -pat lol and stl $2==2 && $1==$3 -with REG -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen com %1 - bic %1,{LOCAL, $1, 2} - -pat loe and ste $2==2 && $1==$3 -with REG -kills posextern -gen com %1 - bic %1,{relative2, $1} - -pat loc lol and stl $3==2 && $2==$4 -kills indordef, locals %ind <= $2 && %ind+%size > $2 -gen bic {const2, ~$1},{LOCAL, $2, 2} - -pat loc loe and ste $3==2 && $2==$4 -kills posextern -gen bic {const2, ~$1},{relative2, $2} - -pat zrl -kills indordef, locals %ind <= $1 && %ind+%size > $1 -gen clr {LOCAL, $1, 2} - -pat zre -kills posextern -gen clr {relative2, $1} - -pat zrf $1==4 -uses FLTREG -gen clrf %a yields %a - -pat zrf $1==8 -uses DBLREG -gen clrf %a yields %a - -pat zer $1==2 yields {const2, 0} -pat zer $1==4 yields {const2,0} {const2,0} -pat zer $1==6 yields {const2,0} {const2,0} {const2,0} -pat zer $1==8 yields {const2,0} {const2,0} - {const2,0} {const2,0} -pat zer defined($1) -with STACK -gen move {const2,$1/2},r0 - 1: - clr {autodec,sp} - sob r0,{label, 1b} - -/**************************************** - * Group 8 : Convert instructions * - ****************************************/ - -pat cii -with STACK -gen jsr pc,{label, "cii~"} - -pat cfi leaving cfu -pat ciu leaving cuu -pat cui leaving cuu - -pat cfu -with STACK -gen jsr pc,{label, "cfi~"} - -pat cif -with STACK -gen jsr pc,{label, "cif~"} - -pat cuf -with STACK -gen jsr pc,{label, "cuf~"} - -pat cff -with STACK -gen jsr pc,{label, "cff~"} - -pat cuu -with STACK -gen jsr pc,{label, "cuu~"} - -pat loc loc cii $1==1 && $2==2 -with src1or2 -uses reusing %1,REG -gen movb %1,%a yields %a - -pat loc loc cii $1==1 && $2==4 -with src1or2 -uses reusing %1,REG,REG -gen movb %1,%a - sxt %b yields %a %b - -pat loc loc cii $1==2 && $2==4 -with src2 -uses reusing %1,REG,REG -gen move %1,%a - test %a - sxt %b yields %a %b - -pat loc loc loc cii $1>=0 && $2==2 && $3==4 leaving loc $1 loc 0 - -pat loc loc loc cii $1< 0 && $2==2 && $3==4 leaving loc $1 loc 0-1 - -pat loc loc cii $1==4 && $2==2 -with src2 - -pat loc loc cuu $1==2 && $2==4 leaving loc 0 - -pat loc loc cuu $1==4 && $2==2 -with src2 - -pat loc loc cfi leaving loc $1 loc $2 cfu - -pat loc loc cfu $1==4 && $2==2 -with FLTREG yields {ftoint,%1} - -pat loc loc cfu $1==4 && $2==4 -with FLTREG yields {ftolong,%1} - -pat loc loc cfu $1==8 && $2==2 -with DBLREG yields {ftoint,%1.1} - -pat loc loc cfu $1==8 && $2==4 -with DBLREG yields {ftolong,%1.1} - -pat loc loc cif $1==2 && $2==4 -with src2 -uses FLTREG -gen movif %1,%a yields %a - -pat loc loc cif $1==2 && $2==8 -with src2 -uses DBLREG -gen movif %1,%a yields %a - -pat loc loc cif $1==4 && $2==4 -with exact long4-REGPAIR - uses FLTREG - gen setl. - movif %1,%a - seti. yields %a -with STACK - uses FLTREG - gen setl. - movif {autoinc,sp},%a - seti. yields %a - -pat loc loc cif $1==4 && $2==8 -with exact long4-REGPAIR - uses DBLREG - gen setl. - movif %1,%a - seti. yields %a -with STACK - uses DBLREG - gen setl. - movif {autoinc,sp},%a - seti. yields %a - -pat loc loc cuf $1==2 && $2==4 -with STACK -uses FLTREG -gen clr {autodec,sp} - setl. - movif {autoinc,sp},%a - seti. yields %a - -pat loc loc cuf $1==2 && $2==8 -with STACK -uses DBLREG -gen clr {autodec,sp} - setl. - movif {autoinc,sp},%a - seti. yields %a - -pat loc loc cuf $1==4 leaving loc $1 loc $2 cif - -pat loc loc cff $1==4 && $2==8 -with longf4 - FLTREG - uses DBLREG - gen movof %1,%a yields %a -with FLTREG - uses DBLREG - gen move %1,%a.1 yields %a - -pat loc loc cff $1==8 && $2==4 -with DBLREG yields %1.1 - -/**************************************** - * Group 9 : Logical instructions * - ****************************************/ - -pat and $1==2 -with const2 REG - gen bic {const2,~%1.num},%2 yields %2 -with REG const2 - gen bic {const2,~%2.num},%1 yields %1 -with REG REG - gen com %1 - bic %1,%2 yields %2 - -pat and defined($1) -with STACK -gen move {const2,$1}, r0 - jsr pc,{label, "and~"} - -pat ior $1==2 -with REG src2 - gen bis %2,%1 yields %1 -with src2 REG - gen bis %1,%2 yields %2 - -pat ior $1==8 -with exact src2 src2 src2 src2 STACK - gen bis %1,{regdef2,sp} - bis %2,{regind2,sp,2} - bis %3,{regind2,sp,4} - bis %4,{regind2,sp,6} -with STACK -uses REG={const2,$1} - gen add sp,%a - bis {autoinc,sp},{autoinc,%a} - bis {autoinc,sp},{autoinc,%a} - bis {autoinc,sp},{autoinc,%a} - bis {autoinc,sp},{autoinc,%a} - -pat ior defined($1) -with STACK -uses REG={const2,$1},REG={const2,$1/2} -gen add sp,%a - 1: - bis {autoinc,sp},{autoinc,%a} - sob %b,{label,1b} - -pat xor $1==2 -with REG REG - gen xor %1,%2 yields %2 -with REG REG - gen xor %2,%1 yields %1 - -pat xor defined($1) -with STACK -gen move {const2,$1},r0 - jsr pc,{label, "xor~"} - -pat com $1==2 -with REG -gen com %1 yields %1 - -pat com defined($1) -with STACK -uses REG={const2,$1/2},REG -gen mov sp,%b - 1: - com {autoinc,%b} - sob %a,{label,1b} - -pat rol $1==2 -with const2 ODDREG - gen ashc {const2,%1.num-16},%2 yields %2 -with REG ODDREG - gen sub {const2,16},%1 - ashc %1,%2 yields %2 - -pat rol defined($1) -with STACK -gen move {const2,$1},r0 - jsr pc,{label, "rol~"} - -pat ror $1==2 -with const2 ODDREG - gen ashc {const2,0-%1.num},%2 yields %2 -with REG ODDREG - gen neg %1 - ashc %1,%2 yields %2 - -pat ror defined($1) -with STACK -gen move {const2,$1},r0 - jsr pc,{label, "ror~"} - -pat com and $1==2 && $2==2 -with src2 REG -gen bic %1,%2 yields %2 - -pat com and $1==$2 -with STACK -uses REG={const2,$1},REG -gen mov sp,%b - add %a,%b - asr %a - 1: - bic {autoinc,sp},{autoinc,%b} - sob %a,{label,1b} - -/******************************** - * Group 10 : Set instructions * - ********************************/ - -pat inn $1==2 -with REG REG -gen neg %1 - ash %1,%2 - bic {const2,0177776},%2 yields %2 - -pat loc inn $2==2 && $1==0 -with REG -gen bic {const2,0177776},%1 yields %1 - -pat loc inn $2==2 && $1==1 -with REG -gen asr %1 - bic {const2,0177776},%1 yields %1 - -pat loc inn $2==2 -with REG -gen ash {const2,0-$1},%1 - bic {const2,0177776},%1 yields %1 - -pat loc inn zeq $2==2 yields {const2, 1<<$1} - leaving and 2 zeq $3 - -pat inn zeq $1==2 -with src2 -uses REG={const2,1} -gen ash %1,%a yields %a - leaving and 2 zeq $2 - -pat loc inn zne $2==2 yields {const2, 1<<$1} - leaving and 2 zne $3 - -pat inn zne $1==2 -with src2 -uses REG={const2,1} -gen ash %1,%a yields %a - leaving and 2 zne $2 - -pat inn defined($1) -with src2 STACK -gen move %1,r1 - move {const2,$1},r0 - jsr pc,{label, "inn~"} yields r0 - -pat set $1==2 -with REG -uses REG={const2,1} -gen ash %1,%a yields %a - -pat set defined($1) -with src2 STACK -gen move %1,r1 - move {const2,$1},r0 - jsr pc,{label, "set~"} - -/**************************************** - * Group 11 : Array instructions * - ****************************************/ - -pat lae aar $2==2 && rom($1,3)==1 && rom($1,1)==0 leaving adi 2 -pat lae aar $2==2 && rom($1,3)==1 && rom($1,1)!=0 leaving adi 2 adp 0-rom($1,1) - -pat lae aar $2==2 && rom($1,3)==2 && rom($1,1)==0 -with REG -gen asl %1 yields %1 leaving adi 2 - -pat lae aar $2==2 && rom($1,3)==2 && rom($1,1)!=0 -with REG -gen asl %1 yields {regconst2,%1,(0-2)*rom($1,1)} - leaving adi 2 - -pat lae aar $2==2 && rom($1,3)==4 && rom($1,1)==0 -with REG -gen ash {const2,2},%1 yields %1 leaving adi 2 - -pat lae aar $2==2 && rom($1,3)==4 && rom($1,1)!=0 -with REG -gen ash {const2,2},%1 yields {regconst2,%1,(0-4)*rom($1,1)} - leaving adi 2 - -pat lae aar $2==2 && rom($1,3)==8 && rom($1,1)==0 -with REG -gen ash {const2,3},%1 yields %1 - leaving adi 2 - -pat lae aar $2==2 && rom($1,3)==8 && rom($1,1)!=0 -with REG -gen ash {const2,3},%1 yields {regconst2,%1,(0-8)*rom($1,1)} - leaving adi 2 - -pat lae aar $2==2 && rom($1,1)==0 -with ODDREG -gen mul {const2,rom($1,3)},%1 yields %1 leaving adi 2 - -pat lae aar $2==2 && defined(rom($1,1)) -with ODDREG -gen mul {const2,rom($1,3)},%1 yields {regconst2,%1,(0-rom($1,3))*rom($1,1)} - leaving adi 2 - -pat aar $1==2 -with STACK -gen mov {autoinc,sp},r0 - mov {autoinc,sp},r1 - jsr pc,{label, "aar~"} - -pat lae sar defined(rom($1,3)) leaving lae $1 aar $2 sti rom($1,3) -pat lae lar defined(rom($1,3)) leaving lae $1 aar $2 loi rom($1,3) -pat sar $1==2 -with STACK -gen mov {autoinc,sp},r0 - mov {autoinc,sp},r1 - jsr pc,{label, "sar~"} - -pat lar $1==2 -with STACK -gen mov {autoinc,sp},r0 - mov {autoinc,sp},r1 - jsr pc,{label, "lar~"} - -/**************************************** - * group 12 : Compare instructions * - ****************************************/ - -pat cmi $1==2 -with src2 REG - gen sub %1,%2 yields %2 -with REG src2 - gen sub %2,%1 - neg %1 yields %1 - -pat cmi $1==4 -with STACK -gen jsr pc,{label, "cmi4~"} yields r0 - -pat cmf defined($1) -with STACK -gen move {const2,$1},r0 - jsr pc,{label, "cmf~"} yields r0 - -pat cmu $1==2 leaving cmp - -pat cmu $1==4 -with STACK -gen jsr pc,{label, "cmu4~"} yields r0 - -pat cmu defined($1) -with STACK -gen move {const2,$1},r0 - jsr pc,{label, "cmu~"} yields r0 - -pat cms $1==2 leaving cmi $1 - -pat cms defined($1) -with STACK -gen move {const2,$1},r0 - jsr pc,{label, "cms~"} yields r0 -pat cmp -with src2 src2 -uses REG = {const2,0} -gen cmp %1,%2 - beq {label,2f} - bhi {label,1f} - inc %a - br {label,2f} - 1: - dec %a - 2: yields %a - -proc txxand -with src2 REG -gen test %1 - bxx* {label,1f} - clr %2 - 1: yields %2 - -proc txxior -with src2 REG -gen test %1 - bxx* {label,1f} - bis {const2,1},%2 - 1: yields %2 - -proc txx -with src2 -uses REG={const2,0} -gen test %1 - bxx* {label,1f} - inc %a - 1: yields %a - -pat tlt and $2==2 call txxand("blt") -pat tle and $2==2 call txxand("ble") -pat teq and $2==2 call txxand("beq") -pat tne and $2==2 call txxand("bne") -pat tgt and $2==2 call txxand("bgt") -pat tge and $2==2 call txxand("bge") - -pat tlt ior $2==2 call txxior("bge") -pat tle ior $2==2 call txxior("bgt") -pat teq ior $2==2 call txxior("bne") -pat tne ior $2==2 call txxior("beq") -pat tgt ior $2==2 call txxior("ble") -pat tge ior $2==2 call txxior("blt") - -pat tlt call txx("bge") -pat tle call txx("bgt") -pat teq call txx("bne") -pat tne call txx("beq") -pat tgt call txx("ble") -pat tge call txx("blt") - -proc andtxx -with src2 src2 -uses REG={const2,0} -gen bit %1,%2 - bxx* {label,1f} - inc %a - 1: yields %a - -pat and tne $1==2 call andtxx("beq") -pat and teq $1==2 call andtxx("bne") - -proc cmitxxand -with src2 src2 REG -gen cmp %2,%1 - bxx* {label,1f} - clr %3 - 1: yields %3 - -proc cmitxxior -with src2 src2 REG -gen cmp %2,%1 - bxx* {label,1f} - bis {const2,1},%3 - 1: yields %3 - -proc cmitxx -with src2 src2 -uses REG={const2,0} -gen cmp %2,%1 - bxx* {label,1f} - inc %a - 1: yields %a - -pat cmi tlt and $1==2 && $3==2 call cmitxxand("blt") -pat cmi tle and $1==2 && $3==2 call cmitxxand("ble") -pat cmi teq and $1==2 && $3==2 call cmitxxand("beq") -pat cmi tne and $1==2 && $3==2 call cmitxxand("bne") -pat cmi tgt and $1==2 && $3==2 call cmitxxand("bgt") -pat cmi tge and $1==2 && $3==2 call cmitxxand("bge") - -pat cmi tlt ior $1==2 && $3==2 call cmitxxior("bge") -pat cmi tle ior $1==2 && $3==2 call cmitxxior("bgt") -pat cmi teq ior $1==2 && $3==2 call cmitxxior("bne") -pat cmi tne ior $1==2 && $3==2 call cmitxxior("beq") -pat cmi tgt ior $1==2 && $3==2 call cmitxxior("ble") -pat cmi tge ior $1==2 && $3==2 call cmitxxior("blt") - -pat cmi tlt $1==2 call cmitxx("bge") -pat cmi tle $1==2 call cmitxx("bgt") -pat cmi teq $1==2 call cmitxx("bne") -pat cmi tne $1==2 call cmitxx("beq") -pat cmi tgt $1==2 call cmitxx("ble") -pat cmi tge $1==2 call cmitxx("blt") - -pat loc cmi teq and $1>=0 && $1<=127 && $2==2 && $4==2 -with exact src1 REG - gen cmpb %1,{const2,$1} - beq {label,1f} - clr %2 - 1: yields %2 -with yields {const2, $1} - leaving cmi 2 teq and 2 - -pat loc cmi teq ior $1>=0 && $1<=127 && $2==2 && $4==2 -with exact src1 REG - gen cmpb %1,{const2,$1} - bne {label,1f} - bis {const2,1},%2 - 1: yields %2 -with yields {const2, $1} - leaving cmi 2 teq ior 2 - -pat loc cmi teq $1>=0 && $1<=127 && $2==2 -with exact src1 -uses REG={const2,0} - gen cmpb %1,{const2,$1} - bne {label,1f} - inc %a - 1: yields %a -with yields {const2, $1} - leaving cmi 2 teq - -pat loc cmi tne and $1>=0 && $1<=127 && $2==2 && $4==2 -with exact src1 REG - gen cmpb %1,{const2,$1} - bne {label,1f} - clr %2 - 1: yields %2 -with yields {const2, $1} - leaving cmi 2 tne and 2 - -pat loc cmi tne ior $1>=0 && $1<=127 && $2==2 && $4==2 -with exact src1 REG - gen cmpb %1,{const2,$1} - beq {label,1f} - bis {const2,1},%2 - 1: yields %2 -with yields {const2, $1} - leaving cmi 2 tne ior 2 - -pat loc cmi tne $1>=0 && $1<=127 && $2==2 -with exact src1 - uses REG={const2,0} - gen cmpb %1,{const2,$1} - beq {label,1f} - inc %a - 1: yields %a -with yields {const2, $1} - leaving cmi 2 tne - -proc cmptxx -with src2 src2 -uses REG={const2,0} -gen cmp %2,%1 - bxx* {label,1f} - inc %a - 1: yields %a - -pat cmp tlt call cmptxx("bhis") -pat cmp tle call cmptxx("bhi") -pat cmp teq call cmptxx("bne") -pat cmp tne call cmptxx("beq") -pat cmp tgt call cmptxx("blos") -pat cmp tge call cmptxx("blo") - -proc cmf4txx -with FLTREG FLTREG -uses REG={const2,0} -gen cmpf %2,%1 - cfcc. - bxx* {label,1f} - inc %a - 1: yields %a - -pat cmf tlt $1==4 call cmf4txx("bge") -pat cmf tle $1==4 call cmf4txx("bgt") -pat cmf teq $1==4 call cmf4txx("bne") -pat cmf tne $1==4 call cmf4txx("beq") -pat cmf tgt $1==4 call cmf4txx("ble") -pat cmf tge $1==4 call cmf4txx("blt") - -proc cmf8txx -with DBLREG double8 - uses REG={const2,0} - gen cmpf %2,%1 - cfcc. - bxx[1] {label,1f} - inc %a - 1: yields %a -with double8 DBLREG - uses REG={const2,0} - gen cmpf %1,%2 - cfcc. - bxx[2] {label,1f} - inc %a - 1: yields %a - -pat cmf tlt $1==8 call cmf8txx("bge","ble") -pat cmf tle $1==8 call cmf8txx("bgt","blt") -pat cmf teq $1==8 call cmf8txx("bne","bne") -pat cmf tne $1==8 call cmf8txx("beq","beq") -pat cmf tgt $1==8 call cmf8txx("ble","bge") -pat cmf tge $1==8 call cmf8txx("blt","bgt") - -/**************************************** - * Group 13 : Branch instructions * - ****************************************/ - -pat bra -with STACK -gen jbr {label, $1} - -proc bxx example beq -with src2 src2 STACK -gen cmp %2,%1 - jxx* {label, $1} -pat blt call bxx("jlt") -pat ble call bxx("jle") -pat beq call bxx("jeq") -pat bne call bxx("jne") -pat bgt call bxx("jgt") -pat bge call bxx("jge") - -pat loc beq $1>=0 && $1<=127 -with exact src1 STACK - gen cmpb %1,{const2,$1} - jeq {label, $2} -with yields {const2, $1} - leaving beq $2 - -pat loc bne $1>=0 && $1<=127 -with exact src1 STACK - gen cmpb %1,{const2,$1} - jne {label, $2} -with yields {const2, $1} - leaving bne $2 - -proc zxx example zeq -with src2 STACK -gen test %1 - jxx* {label, $1} - -pat zlt call zxx("jlt") -pat zle call zxx("jle") -pat zeq call zxx("jeq") -pat zne call zxx("jne") -pat zgt call zxx("jgt") -pat zge call zxx("jge") - -proc cmpzxx example cmp zeq -with src2 src2 STACK -gen cmp %2,%1 - jxx* {label, $2} - -pat cmp zlt call cmpzxx("jlo") -pat cmp zle call cmpzxx("jlos") -pat cmp zeq call cmpzxx("jeq") -pat cmp zne call cmpzxx("jne") -pat cmp zgt call cmpzxx("jhi") -pat cmp zge call cmpzxx("jhis") - -proc cmf4zxx example cmf zeq -with FLTREG FLTREG STACK -gen cmpf %2,%1 - cfcc. - jxx* {label, $2} - -pat cmf zlt $1==4 call cmf4zxx("jlt") -pat cmf zle $1==4 call cmf4zxx("jle") -pat cmf zeq $1==4 call cmf4zxx("jeq") -pat cmf zne $1==4 call cmf4zxx("jne") -pat cmf zgt $1==4 call cmf4zxx("jgt") -pat cmf zge $1==4 call cmf4zxx("jge") - -proc cmf8zxx example cmf zeq -with DBLREG double8 STACK - gen cmpf %2,%1 - cfcc. - jxx[1] {label, $2} -with double8 DBLREG STACK - gen cmpf %1,%2 - cfcc. - jxx[2] {label, $2} - -pat cmf zlt $1==8 call cmf8zxx("jlt","jgt") -pat cmf zle $1==8 call cmf8zxx("jle","jge") -pat cmf zeq $1==8 call cmf8zxx("jeq","jeq") -pat cmf zne $1==8 call cmf8zxx("jne","jne") -pat cmf zgt $1==8 call cmf8zxx("jgt","jlt") -pat cmf zge $1==8 call cmf8zxx("jge","jle") - -proc andzen example and zeq -with src2 src2 STACK -gen bit %1,%2 - jxx* {label, $2} - -pat and zeq $1==2 call andzen("jeq") -pat and zne $1==2 call andzen("jne") - -/************************************************ - * group 14 : Procedure call instructions * - ************************************************/ - -pat cal -with STACK -gen jsr pc,{label, $1} - -pat cai -with REG STACK -gen jsr pc,{regdef2,%1} - -pat lfr $1==2 yields r0 -pat lfr $1==4 yields r1 r0 -pat lfr $1==8 yields {relative8,"retar"} -pat lfr -with STACK -gen move {const2,$1},r0 - jsr pc,{label, "lfr~"} - -pat lfr ret $1==$2 leaving ret 0 - - -pat ret $1==0 -with STACK -gen mov lb,sp - rts pc - -pat ret $1==2 -with src2 STACK -gen move %1,r0 - mov lb,sp - rts pc - -pat ret $1==4 -with STACK -gen mov {autoinc,sp},r0 - mov {autoinc,sp},r1 - mov lb,sp - rts pc - -pat ret $1==8 yields {addr_external, "retar"} - leaving sti 8 ret 0 - -pat ret -with STACK -gen move {const2,$1},r0 - jmp {label,"ret~"} - -/************************************************ - * Group 15 : Miscellaneous instructions * - ************************************************/ - -pat asp $1==2 -with STACK -gen tst {autoinc,sp} - -pat asp $1==4 -with STACK -gen cmp {autoinc,sp},{autoinc,sp} - -pat asp $1==0-2 -with STACK -gen tst {autodec,sp} - -pat asp -with STACK -gen add {const2,$1},sp - -pat ass $1==2 -with STACK -gen add {autoinc,sp},sp - -pat blm $1==4 -with REG REG -gen mov {autoinc,%2},{autoinc,%1} - mov {regdef2,%2},{regdef2,%1} - -pat blm $1==6 -with REG REG -gen mov {autoinc,%2},{autoinc,%1} - mov {autoinc,%2},{autoinc,%1} - mov {regdef2,%2},{regdef2,%1} - -pat blm $1==8 -with REG REG -gen mov {autoinc,%2},{autoinc,%1} - mov {autoinc,%2},{autoinc,%1} - mov {autoinc,%2},{autoinc,%1} - mov {regdef2,%2},{regdef2,%1} - -pat blm -with REG REG -uses REG={const2,$1/2} -gen 1: - mov {autoinc,%2},{autoinc,%1} - sob %a,{label,1b} - -pat lae csa $2==2 -with src2 STACK -gen move %1,r1 - move {addr_external,$1},r0 - jmp {label, "csa~"} - -pat csa $1==2 -with STACK -gen mov {autoinc,sp},r0 - mov {autoinc,sp},r1 - jmp {label, "csa~"} - -pat lae csb $2==2 -with src2 STACK -gen move %1,r1 - move {addr_external,$1},r0 - jmp {label, "csb~"} - -pat csb $1==2 -with STACK -gen mov {autoinc,sp},r0 - mov {autoinc,sp},r1 - jmp {label, "csb~"} - -pat dup $1==2 -with REG yields %1 %1 - -pat dup $1==4 -with exact long4 yields %1 %1 -with src2 src2 yields %2 %1 %2 %1 - -pat dup $1==8 -with exact long8 yields %1 %1 -with STACK -gen move {const2, $1}, r0 - jsr pc,{label, "dup~"} - -pat dup -with STACK -gen move {const2, $1}, r0 - jsr pc,{label, "dup~"} - -pat dus $1==2 -with src2 STACK -gen move %1,r0 - jsr pc,{label, "dup~"} - -pat gto -with STACK -gen mov {addr_external, $1},{autodec,sp} - jmp {label, "gto~"} - -pat fil -gen mov {addr_external, $1},{relative2, "hol0"+4} - -pat lim yields { relative2, "trpim~"} - -pat lin -gen mov {const2,$1},{relative2, "hol0"} - -pat lni -gen inc {relative2, "hol0"} - -pat lor $1==0 yields lb - -pat lor $1==1 -with STACK -uses REG -gen mov sp,%a yields %a - -pat lor $1==2 yields {relative2,"reghp~"} - -pat mon -with STACK -gen jsr pc,{label, "mon~"} - -pat nop -with STACK -gen jsr pc,{label, "nop~"} - -pat rck $1==2 -with src2 - -pat rtt leaving ret 0 - -pat sig -with src2 -uses REG -gen move {relative2,"trppc~"},%a - mov %1,{relative2,"trppc~"} yields %a - -pat sim -with STACK -gen jsr pc,{label, "sim~"} - -pat str $1==0 -with src2 -gen mov %1,lb - -pat str $1==1 -with src2 STACK -gen mov %1,sp - -pat str $1==2 -with STACK -gen jsr pc,{label, "strhp~"} - -pat trp -with STACK -gen jsr pc,{label, "trp~"} - -pat exg $1==2 -with src2 src2 yields %1 %2 - -pat exg defined($1) -with STACK -gen move {const2,$1},r0 - jsr pc,{label, "exg~"} - -pat lol lal sti $1==$2 && $3==1 /* throw away funny C-proc-prolog */ - -pat los -gen jmp {label, illins} - -pat sts -gen jmp {label, illins} - -pat inn -gen jmp {label, illins} - -pat set -gen jmp {label, illins} diff --git a/mach/pmds/cv/pdp_cv.c b/mach/pmds/cv/pdp_cv.c deleted file mode 100644 index b11f6574f..000000000 --- a/mach/pmds/cv/pdp_cv.c +++ /dev/null @@ -1,41 +0,0 @@ -/* The format of the a.out files produced by the assemblers - is machine dependent. - This program acts as a gateway between two machines and it's effect - is independent of the machine it executes on. - The a.out file is assumed to be made on a pdp-11 - while the target machine is a Philip Microcomputer Development system - -*/ - -#include - -main(argc,argv) char **argv ; { - char i_addr[4]; - short count; - char i_count[2]; - - if (argc != 3) { - fprintf(stderr,"Usage: %s pdp-a.out VU-pmds-a.out\n",argv[0]); - exit(-1); - } - if (freopen(argv[1],"r",stdin)==NULL) { - perror(argv[1]); - exit(-1); - } - if (freopen(argv[2],"w",stdout)==NULL) { - perror(argv[2]); - exit(-1); - } - while (fread(&i_addr,sizeof i_addr,1,stdin)==1) { - putchar(i_addr[1]) ; putchar(i_addr[0]) ; - putchar(i_addr[3]) ; putchar(i_addr[2]) ; - if (fread(&i_count,sizeof i_count,1,stdin)!=1) - exit(fprintf(stderr,"foo\n")); - putchar(i_count[1]) ; putchar(i_count[0]) ; - count= ((i_count[1]&0377)<<8) | (i_count[0]&0377) ; - while (count--) { - putchar(getchar()); - } - } - return 0; -} diff --git a/mach/pmds/cv/vax_cv.c b/mach/pmds/cv/vax_cv.c deleted file mode 100644 index 6e210f176..000000000 --- a/mach/pmds/cv/vax_cv.c +++ /dev/null @@ -1,41 +0,0 @@ -/* The format of the a.out files produced by the assemblers - is machine dependent. - This program acts as a gateway between two machines and it's effect - is independent of the machine it executes on. - The a.out file is assumed to be made on a vax-11 - while the target machine is a Philips Microcomputer Development system - -*/ - -#include - -main(argc,argv) char **argv ; { - char i_addr[4]; - short count; - char i_count[2]; - - if (argc != 3) { - fprintf(stderr,"Usage: %s vax-a.out VU-pmds-a.out\n",argv[0]); - exit(-1); - } - if (freopen(argv[1],"r",stdin)==NULL) { - perror(argv[1]); - exit(-1); - } - if (freopen(argv[2],"w",stdout)==NULL) { - perror(argv[2]); - exit(-1); - } - while (fread(&i_addr,sizeof i_addr,1,stdin)==1) { - putchar(i_addr[3]) ; putchar(i_addr[2]) ; - putchar(i_addr[1]) ; putchar(i_addr[0]) ; - if (fread(&i_count,sizeof i_count,1,stdin)!=1) - exit(fprintf(stderr,"foo\n")); - putchar(i_count[1]) ; putchar(i_count[0]) ; - count= ((i_count[1]&0377)<<8) | (i_count[0]&0377) ; - while (count--) { - putchar(getchar()); - } - } - return 0; -} diff --git a/mach/vax4/cg/READ_ME b/mach/vax4/cg/READ_ME deleted file mode 100644 index 6d6d36100..000000000 --- a/mach/vax4/cg/READ_ME +++ /dev/null @@ -1,8 +0,0 @@ ---------- $Header$ -------- -The file "table" is too large. The "cgg" program cannot generate -"tables.h" and "tables.c" on a PDP 11/44. -Therefore the distribution includes two files "tables1.c" and "tables1.h", -which you can copy to "tables.c" and "tables.h". -Make sure "tables.c" and "tables.h" are newer than "table", -before trying again. They also must be newer than the "cgg" program -(../../../lib/cgg). diff --git a/mach/vax4/libem/head_em.s b/mach/vax4/libem/head_em.s deleted file mode 100644 index 2124e04b0..000000000 --- a/mach/vax4/libem/head_em.s +++ /dev/null @@ -1,93 +0,0 @@ -#include "system.h" -#include "em_abs.h" -#ifdef BSD42 -#include "/usr/include/syscall.h" -#endif BSD42 - - # $Header$ - -.globl hol0 -.globl .reghp -.globl .trppc -.globl .trpim - - # run time startoff - .word 0 - bispsw $0100 # set FU(0100) - movl 4(sp),r0 - clrl -4(r0) - movl sp,r0 - movl (r0)+,r1 - movl r0,r2 -a1: - tstl (r0)+ - bneq a1 - cmpl r0,(r2) - blssu a2 - tstl -(r0) -a2: - pushl r0 - pushl r2 - pushl r1 - movl $m1,ap - chmk (ap)+ # catch floating point exception - calls $3,_m_a_i_n - movl $m2,ap - movl r0,6(ap) - chmk (ap)+ - halt - - .align 1 -sig8: - .word 0x0000 - pushl 8(ap) - movl (sp)+,ap - pushl tab [ap] - jsb .trp - movl $m1,ap - chmk (ap)+ - ret - - .data -#ifdef BSD42 -m1: - .word SYS_sigvec - .long 3 - .long 8 - .long m1a - .long 0 -m1a: - .long sig8 - .long 0 - .long 0 -#else BSD42 -m1: - .word 48 - .long 2 - .long 8 - .long sig8 -#endif BSD42 -m2: - .word 1 - .long 1 - .long 0 -.reghp: - .long _end -hol0: - .space 8 -.trppc: - .space 4 -.trpim: - .long 0 -tab: - .long 0 - .long EIOVFL - .long EIDIVZ - .long EFOVFL - .long EFDIVZ - .long EFUNFL - .long EILLINS - .long EARRAY - .long EFOVFL - .long EFDIVZ - .long EFUNFL diff --git a/mach/vax4/libem/system.h b/mach/vax4/libem/system.h deleted file mode 100644 index 56ac7facc..000000000 --- a/mach/vax4/libem/system.h +++ /dev/null @@ -1,4 +0,0 @@ -/* $Header$ */ -/*#define BSD42 */ -/*#define BSD41c */ -#define BSD41a diff --git a/mach/z80/int/dlbin.c b/mach/z80/int/dlbin.c deleted file mode 100644 index bdf6fc7e0..000000000 --- a/mach/z80/int/dlbin.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Download Z80 load module into the RC702 - * - * Adapted (untested) to new ack.out format by - * Ceriel Jacobs, Vrije Universiteit, Amsterdam - */ -#include -#include -#include - -int disp = 0; - -char hex[] = "0123456789ABCDEF"; - -#define DATTYPE 0 -#define EOFTYPE 1 -#define SEGTYPE 2 -#define PCTYPE 3 - -#define MAXBYTE 32 - -char *progname; - -struct outhead ohead; -struct outsect sect[MAXSECT]; - -long pc; - -main(argc,argv) char **argv; { - register unsigned nd; - register char *s; - int first = 1; - int i; - - progname = argv[0]; - while (argc > 1 && argv[1][0] == '-') { - switch (argv[1][1]) { - case 'd': - /* displacement at load time */ - disp = atoi(&argv[1][2]); - break; - } - argc--; - argv++; - } - s = "a.out"; - if (argc == 2) - s = argv[1]; - else if (argc != 1) { - fprintf(stderr,"usage: %s [flags] [object file]\n",progname); - exit(-1); - } - if (! rd_open(s)) { - fprintf(stderr,"%s: can't open %s\n",progname,s); - exit(-1); - } - rd_ohead(&ohead); - if (ohead.oh_flags & HF_LINK) { - fprintf(stderr,"%s: %s contains unresolved references\n",progname,s); - exit(-1); - } - rd_sect(sect, ohead.oh_nsect); - for (i = 0; i < ohead.oh_nsect; i++) { - rd_outsect(i); - pc = sect[i].os_base; - if (first) { - first = 0; - putchar('L'); - putchar('S'); - } - segment(i); - while (sect[i].os_size) { - unsigned int sz = 8096, fl; - extern char *calloc(); - register char *buf; - char *pbuf; - - if (sz > sect[i].os_size) sz = sect[i].os_size; - sect[i].os_size -= sz; - pbuf = buf = calloc(sz, 1); - if (fl = sect[i].os_flen) { - if (fl > sz) fl = sz; - sect[i].os_flen -= fl; - - rd_emit(buf, (long) fl); - } - while (sz >= MAXBYTE) { - data(MAXBYTE, (int) pc, buf); - sz -= MAXBYTE; - buf += MAXBYTE; - pc += MAXBYTE; - } - if (sz > 0) { - data(sz, (int) pc, buf); - } - free(pbuf); - } - } - if (first == 0) eof(); - exit(0); -} - -segment(sg) { - - newline(2,0,SEGTYPE); - word(sg); - endline(); -} - -data(nd,pc,buf) - register char *buf; - int pc; -{ - register i; - - newline(nd, pc+disp, DATTYPE); - for (i = 0; i < nd; i++) { - byte(*buf++); - } - endline(); -} - -int check, bytecount; - -newline(n,pc,typ) { - - check = 0; - bytecount = n+5; - putchar('\n'); /* added instruction */ - putchar(':'); - byte(n); - word(pc); - byte(typ); -} - -endline() { - - byte(-check); - assert(bytecount == 0); -} - -word(w) { - - byte(w>>8); - byte(w); -} - -byte(b) { - - check += b; - bytecount--; - putchar(hex[(b>>4) & 017]); - putchar(hex[b & 017]); -} - -rd_fatal() -{ - fprintf(stderr, "%s: Read error\n", progname); - exit(-1); -} - -eof() { - - newline(0,0,EOFTYPE); - byte(0xFF); - putchar('\n'); -} diff --git a/mach/z80/int/doas b/mach/z80/int/doas deleted file mode 100644 index 5d30eae68..000000000 --- a/mach/z80/int/doas +++ /dev/null @@ -1,3 +0,0 @@ -/usr/em/mach/z80/as/as -d em.s atof.s fpp.s mli4.s dvu4.s dvi4.s eb.s >em.list -dl a.out int.hex -dosort int.hex diff --git a/mach/z80/libem/tail.s b/mach/z80/libem/tail.s deleted file mode 100644 index aead49970..000000000 --- a/mach/z80/libem/tail.s +++ /dev/null @@ -1,15 +0,0 @@ -.define endtext,enddata,endbss -.define _end,_etext,_edata - - .text -endtext: -_etext: - .align 2 - .data -enddata: -_edata: - .align 2 - .bss -_end: -endbss: - .align 2 diff --git a/mach/z80/libmon/putchr.nas.s b/mach/z80/libmon/putchr.nas.s deleted file mode 100644 index e66a68910..000000000 --- a/mach/z80/libmon/putchr.nas.s +++ /dev/null @@ -1,33 +0,0 @@ -.define putchr -.sect .text -.sect .rom -.sect .data -.sect .bss -.sect .text -! output routine in monitor -CRT = 0x013B -! output a charcter -! entry: ascii character in a -putchr: - push hl - push bc - ld hl,tab - ld b,5 -1: cp (hl) - jr z,fetch - inc hl - inc hl - djnz 1b -2: call CRT - pop bc - pop hl - ret -fetch: inc hl - ld a,(hl) - jr 2b -! conversion table for nascom characters -tab: .data1 0x0D,0x00 - .data1 0x1B,0x1E - .data1 0x08,0x1D - .data1 0x0A,0x1F - .data1 0x7F,0x00 diff --git a/mach/z80/libmon/putchr.s b/mach/z80/libmon/putchr.s deleted file mode 100644 index 898db469a..000000000 --- a/mach/z80/libmon/putchr.s +++ /dev/null @@ -1,26 +0,0 @@ -.define putchr -.sect .text -.sect .rom -.sect .data -.sect .bss -.sect .text - -putchr: - push hl - push de - push bc - cp 0x0A - jr nz,1f - ld a,0x1F -1: - ld c,a -2: - in a,0xF1 - and 4 - jr z,2b - ld a,c - out 0xF0,a - pop bc - pop de - pop hl - ret diff --git a/mach/z80/libmon/subr.s b/mach/z80/libmon/subr.s deleted file mode 100644 index d82ca4f94..000000000 --- a/mach/z80/libmon/subr.s +++ /dev/null @@ -1,202 +0,0 @@ -.define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno -.sect .text -.sect .rom -.sect .data -.sect .bss -.sect .text -_read: - ld (savebc),bc - push af - pop bc - ld (saveaf),bc ! save all registers in savereg - ld (savede),de - ld (savehl),hl - ld (saveix),ix - ex (sp),hl ! return address in hl - pop bc ! skip return address - pop bc ! get fd - ld a,b ! check fd = 0 - or c - jr nz,errrd - pop de ! get buffer - pop bc ! get count - ld ix,0 ! reset counter - push bc - push de - push ix - push hl ! return address - ex de,hl ! buffer to hl -1: ld a,b - or c - jr z,done ! done if count = 0 - call getchr - ld (hl),a - inc hl ! increment pointer - inc ix ! increment char counter - dec bc ! decrement count - cp 0xA - jr nz,1b ! done if char = CR -done: - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - ret -errrd: - push bc - push hl ! return address - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - ld ix,-1 - ret - -_write: - ld (savebc),bc - push af - pop bc - ld (saveaf),bc ! save all registers in savereg - ld (savede),de - ld (savehl),hl - ld (saveix),ix - ex (sp),hl ! return address in hl - pop de ! skip return address - pop de ! get fd - ld a,e ! check for fd = 1 - cp 1 - jr nz,errwr - ld a,d - or a - jr nz,errwr - pop de ! buffer in de - pop bc ! count in bc - push bc - push de - push de - push hl - ex de,hl ! buffer in hl - ld e,c - ld d,b ! count also in de -1: ld a,b - or c - jr z,exit - ld a,(hl) - call putchr - inc hl - dec bc - jr 1b -errwr: - push de - push hl - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - ld ix,-1 ! error in fd - ret -exit: - push de ! count on stack - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - pop ix ! return count to caller - ret - -_ioctl: - ret -_getpid: - ret - -! open return a file descriptor (0,1,2) -! depending on 'mode' -! mode 2 doesn't work!! -_open: - ld (savebc),bc - push af - pop bc - ld (saveaf),bc ! save all registers in savereg - ld (savede),de - ld (savehl),hl - ld (saveix),ix - pop bc ! return address - pop de ! name pointer - pop ix ! mode (0 for read, - ! 1 for write) - push ix - push de - push bc - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - ret ! return fd = 0 for read - ! fd = 1 for write - -_close: - ld ix,0 ! return succes - ret -_exit: -jp 0x38 -.sect .data -_errno: - .data2 0 -! output routine in monitor -CRT = 0x013B -! output a charcter -! entry: ascii character in a -.sect .text -!putchr: -! push hl -! push bc -! ld hl,tab -! ld b,5 -!1: cp (hl) -! jr z,fetch -! inc hl -! inc hl -! djnz 1b -!2: call CRT -! pop bc -! pop hl -! ret -!fetch: inc hl -! ld a,(hl) -! jr 2b -!! conversion table for nascom characters -!tab: .data1 0x0D,0x00 -! .data1 0x1B,0x1E -! .data1 0x08,0x1D -! .data1 0x0A,0x1F -! .data1 0x7F,0x00 - -KBD = 0x69 -! get character from keyboard -getchr: - call KBD - jr nc,getchr - cp 0x1F - jr z,CR - cp 0x1D - jr z,BS - ret -CR: ld a,0xA - ret -BS: ld a,0x8 - ret diff --git a/mach/z80/libsys/putchr.nas.s b/mach/z80/libsys/putchr.nas.s deleted file mode 100644 index e66a68910..000000000 --- a/mach/z80/libsys/putchr.nas.s +++ /dev/null @@ -1,33 +0,0 @@ -.define putchr -.sect .text -.sect .rom -.sect .data -.sect .bss -.sect .text -! output routine in monitor -CRT = 0x013B -! output a charcter -! entry: ascii character in a -putchr: - push hl - push bc - ld hl,tab - ld b,5 -1: cp (hl) - jr z,fetch - inc hl - inc hl - djnz 1b -2: call CRT - pop bc - pop hl - ret -fetch: inc hl - ld a,(hl) - jr 2b -! conversion table for nascom characters -tab: .data1 0x0D,0x00 - .data1 0x1B,0x1E - .data1 0x08,0x1D - .data1 0x0A,0x1F - .data1 0x7F,0x00 diff --git a/mach/z80/libsys/putchr.s b/mach/z80/libsys/putchr.s deleted file mode 100644 index 898db469a..000000000 --- a/mach/z80/libsys/putchr.s +++ /dev/null @@ -1,26 +0,0 @@ -.define putchr -.sect .text -.sect .rom -.sect .data -.sect .bss -.sect .text - -putchr: - push hl - push de - push bc - cp 0x0A - jr nz,1f - ld a,0x1F -1: - ld c,a -2: - in a,0xF1 - and 4 - jr z,2b - ld a,c - out 0xF0,a - pop bc - pop de - pop hl - ret diff --git a/mach/z80/libsys/subr.s b/mach/z80/libsys/subr.s deleted file mode 100644 index d82ca4f94..000000000 --- a/mach/z80/libsys/subr.s +++ /dev/null @@ -1,202 +0,0 @@ -.define _read,_write,_ioctl,_getpid,_open,_close,_exit,_errno -.sect .text -.sect .rom -.sect .data -.sect .bss -.sect .text -_read: - ld (savebc),bc - push af - pop bc - ld (saveaf),bc ! save all registers in savereg - ld (savede),de - ld (savehl),hl - ld (saveix),ix - ex (sp),hl ! return address in hl - pop bc ! skip return address - pop bc ! get fd - ld a,b ! check fd = 0 - or c - jr nz,errrd - pop de ! get buffer - pop bc ! get count - ld ix,0 ! reset counter - push bc - push de - push ix - push hl ! return address - ex de,hl ! buffer to hl -1: ld a,b - or c - jr z,done ! done if count = 0 - call getchr - ld (hl),a - inc hl ! increment pointer - inc ix ! increment char counter - dec bc ! decrement count - cp 0xA - jr nz,1b ! done if char = CR -done: - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - ret -errrd: - push bc - push hl ! return address - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - ld ix,-1 - ret - -_write: - ld (savebc),bc - push af - pop bc - ld (saveaf),bc ! save all registers in savereg - ld (savede),de - ld (savehl),hl - ld (saveix),ix - ex (sp),hl ! return address in hl - pop de ! skip return address - pop de ! get fd - ld a,e ! check for fd = 1 - cp 1 - jr nz,errwr - ld a,d - or a - jr nz,errwr - pop de ! buffer in de - pop bc ! count in bc - push bc - push de - push de - push hl - ex de,hl ! buffer in hl - ld e,c - ld d,b ! count also in de -1: ld a,b - or c - jr z,exit - ld a,(hl) - call putchr - inc hl - dec bc - jr 1b -errwr: - push de - push hl - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - ld ix,-1 ! error in fd - ret -exit: - push de ! count on stack - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - pop ix ! return count to caller - ret - -_ioctl: - ret -_getpid: - ret - -! open return a file descriptor (0,1,2) -! depending on 'mode' -! mode 2 doesn't work!! -_open: - ld (savebc),bc - push af - pop bc - ld (saveaf),bc ! save all registers in savereg - ld (savede),de - ld (savehl),hl - ld (saveix),ix - pop bc ! return address - pop de ! name pointer - pop ix ! mode (0 for read, - ! 1 for write) - push ix - push de - push bc - ld bc,(saveaf) - push bc - pop af - ld bc,(savebc) - ld de,(savede) - ld hl,(savehl) - ld ix,(saveix) - ret ! return fd = 0 for read - ! fd = 1 for write - -_close: - ld ix,0 ! return succes - ret -_exit: -jp 0x38 -.sect .data -_errno: - .data2 0 -! output routine in monitor -CRT = 0x013B -! output a charcter -! entry: ascii character in a -.sect .text -!putchr: -! push hl -! push bc -! ld hl,tab -! ld b,5 -!1: cp (hl) -! jr z,fetch -! inc hl -! inc hl -! djnz 1b -!2: call CRT -! pop bc -! pop hl -! ret -!fetch: inc hl -! ld a,(hl) -! jr 2b -!! conversion table for nascom characters -!tab: .data1 0x0D,0x00 -! .data1 0x1B,0x1E -! .data1 0x08,0x1D -! .data1 0x0A,0x1F -! .data1 0x7F,0x00 - -KBD = 0x69 -! get character from keyboard -getchr: - call KBD - jr nc,getchr - cp 0x1F - jr z,CR - cp 0x1D - jr z,BS - ret -CR: ld a,0xA - ret -BS: ld a,0x8 - ret diff --git a/man/6500_as.1 b/man/6500_as.1 deleted file mode 100644 index 1c8b43fb2..000000000 --- a/man/6500_as.1 +++ /dev/null @@ -1,66 +0,0 @@ -.\" $Header$ -.TH 6500_AS 1ACK -.SH NAME -6500_as \- assembler for Mostek 6500 -.SH SYNOPSIS -~em/lib/6500/as [options] argument ... -.SH DESCRIPTION -This assembler is made with the general framework -described in \fIuni_ass\fP(6). It is an assembler-loader. -.SH "SECTIONS and TYPES" -An additional section, the \fIzeropage\fP, can be started by the -\&\fI.sect .zero\fP pseudo-instruction. -Some adressing-modes require an address between 0 and 255. -Such an address must be defined with the means of the \fI.sect .zero\fP -pseudo-instruction. -A plain number between 0 and 255 is not allowed. -The assembler will complain that it must be a zero page expression. -.IP example -\&.sect .zero -.br -answer: .space 1 -.br -\&.text -.br -and (answer, x) -.SH SYNTAX -.IP expressions -An two-byte expression followed by the pseudo-operator \fI.h\fP (\fI.l\fP) -has the value of the higher (lower) byte of the expression. -\&\fI.h\fP and \fI.l\fP bind stronger than all other operators. -E.g. -1.h parses as -[1.h] which has value 0. -You have to write [-1].h to get 0xFF. -.IP "addressing modes" -.nf -.ta 16n 24n 32n 40n 48n -syntax meaning (name) - -#expr 8-bit value (immediate) - -expr address (direct) - -expr, x expr + contents of x - or or -expr, y expr + contents of y - yields address (indexed) - -(expr) address of address (only with JMP) (indirect) -.fi - -In the next two addressing modes \fIexpr\fP has to be -a zeropage expression. - -.nf -(expr, x) expr + contents of x - yields address (pre-indexed indirect) - -(expr), y contents of expr + contents of y - yields address (post-indexed indirect) -.fi -.IP instructions -There are two mnemonics that do not map onto one machine-instruction: -\fIadd\fP and \fIsub\fP. \fIAdd mode\fP maps onto \fIclc; adc mode\fP. -\fISub mode\fP maps onto \fIsec; sbc mode\fP. -.SH "SEE ALSO" -uni_ass(6), -ack(1) diff --git a/man/6800_as.1 b/man/6800_as.1 deleted file mode 100644 index 08791a50e..000000000 --- a/man/6800_as.1 +++ /dev/null @@ -1,55 +0,0 @@ -.\" $Header$ -.TH 6800_AS 1 -.ad -.SH NAME -6800_as \- assembler for Motorola 6800 -.SH SYNOPSIS -/usr/em/lib/6800_as [options] argument ... -.SH DESCRIPTION -This assembler is made with the general framework -described in \fIuni_ass\fP(6). -.SH SYNTAX -.IP registers -The 6800 has two accumulator registers, A and B. An instruction that refers -to accumulator A, has an "a" as last character. In the same way a "b" means -that the instruction uses B as accumulator. -.IP "addressing modes" -.nf -.ta 8n 16n 24n 32n 40n 48n -syntax meaning (name) - -#expr with cpx, ldx, lds a 2-byte value, - otherwise a 1-byte value (immediate) - -expr 2-byte address. Allowed in the register - memory group. (extended) -expr 1-byte address if appropriate, 2-byte - in other cases. (auto-direct/extended) -,x indexed with zero offset. (indexed) -expr,x indexed with 16 bit offset. (indexed-2) -expr,x indexed with the shortest possible off- - set. (auto indexed) -bit,expr bit number and direct address. - (bit set/clear) -bit,expr,tag bit number, direct address and branch - tag. Automatically changed to reversed - condition branch and jump if appropri- - ate. (bit test and branch) -tag branch tag. Converted to reversed con- - dition branch and jump if appropriate. - (branch) -.fi -.IP "PSEUDO INSTRUCTIONS" - - .dram use the zero page ram/io segment. - .dprom use the zero page (ep)rom segment. - .cmos assemble cmos version instructions. -.SH "SEE ALSO" -uni_ass(6), -ack(1), -.br -M6805 HMOS, M146805 CMOS family, Motorola, -Prentice-Hall, Inc., 1983, (ISBN 0-13-541375-3). -.SH EXAMPLE -An example of Motorola 6805 assembly code. -.sp 2 -.nf -.ta 8n 16n 32n 40n 48n 56n 64n - .dram - one: .space 1 ! a-port - .dprom - c1: .byte 1 - .text - start: ldx #c1 ! load address of c1 - txa - sta one - add c1 ! add one - brset 1,one,whoop ! jif bit one of aport - bset 1,one ! set it now - .data - .ascii "unused string" - .text - whoop: nop - .org 0xff8 - .word start ! set vector address - .text - nop ! resume code -.fi -.SH AUTHOR -Written by Gijs Mos. -Not a member of the ACK group. -.SH BUGS -The assembler has not been well tested. diff --git a/man/6809_as.1 b/man/6809_as.1 deleted file mode 100644 index 10e38c1a2..000000000 --- a/man/6809_as.1 +++ /dev/null @@ -1,147 +0,0 @@ -.\" $Header$ -.TH 6809_AS 1 -.ad -.SH NAME -6809_as \- assembler for 6809 -.SH SYNOPSIS -/usr/em/lib/6809_as [options] argument ... -.SH DESCRIPTION -This assembler is made with the general framework -described in \fIuni_ass\fP(6). -.SH SYNTAX -.IP registers -The 6809 contains four 8-bit registers registers: -two accumulators (a and b), -a direct page register (dp), -and a condition code register (cc), -and five 16-bit registers: -two index registers (x and y), -a user an a hardware stack pointer (u resp. s), -and a program counter (pc). -The index registers and the stack pointers are indexable. -Accumulators a and b can be concatenated to form -the double accumulator d, -of which a is the high and b is the low byte. -An instruction that refers to accumulator a -has an "a" as last character. -In the same way a "b" means that the instruction -uses b as accumulator. -.IP "pseudo instructions" -The 6809 assembler recognizes one additional instruction -that is not translated into a machine instruction: setdp. -It expects an expression as argument. -This is used for efficient address encoding of some addressing -mode (see below). -.IP "addressing modes" -.nf -.ta 8n 16n 24n 32n 40n 48n -syntax meaning (name) - -reg The operand of the instruction is in \fIreg\fP. - -reglist \fIreglist\fP is a either list of registers, seperated - by ','s, or the word "all". It encodes in a register - save mask, where "all" means all registers, that can - be used by the push-pull instructions pshs, pshu, - puls, and pulu. - -expr The two-byte value of \fIexpr\fP is the exact memory - address. Not that this mode always requires one - byte more than "expr". - (relative for branch-instructions) - -#expr The value of \fIexpr\fP is one- or two-byte immediate - data. (immediate) - -(expr) The value of \fIexpr\fP is a pointer to the address - of the operand. (indirect) - -expr, reg The value of \fIexpr\fP added to the contents of \fIreg\fP - (which must be a 16-bit register) yields the - effective address of the operand. - (constant-offset indexed) - -, ireg The contents of \fIireg\fP (which must be indexable) - yields the effective address of the operand. - (constant-offset indexed) - -(expr, reg) The value of \fIexpr\fP added to the contents of \fIreg\fP - (which must be a 16-bit register) yields a pointer - to the effective address of the operand. - (constant-offset indexed indirect) - -(, ireg) The contents of \fIireg\fP (which must be indexable) - yields a pointer to the effective address of the - operand. (constant-offset indexed indirect) - -ac, ireg The contents of \fIac\fP (which must be an accumulator) - added to the contents of \fIireg\fP (which must be - indexable) yields the effective address of the - operand. (accumulator indexed) - -(ac, ireg) The contents of \fIac\fP (which must be an accumulator) - added to the contents of \fIireg\fP (which must be - indexable) yields a pointer to the effective address - of the operand. (accumulator indexed indirect) - -,ireg+ -,ireg++ The contents of \fIireg\fP (which must be indexable) is - used as effective address of the operand. After that - it is incremented by 1 (+) or 2 (++). - (auto-increment) - -(,ireg++) The contents of \fIireg\fP (which must be indexable) is - used as a pointer to the effective address of the - operand. After that it is incremented by 2. - (auto-increment indirect) - -,-ireg -,--ireg \fIireg\fP (which must be indexable) is decremented - by 1 (-) or 2 (--). After that, its contents is used - as effective address of the operand. - (auto-decrement) - -(,--ireg) \fIireg\fP (which must be indexable) is decremented by 2. - After that, its contents is used as a pointer to the - effective address of the operand. - (auto-decrement indirect) - -.fi -.SH "SEE ALSO" -uni_ass(6), -ack(1), -.br -MC6809 preliminary programming manual, Motorola Inc., First Edition, 1979 -.SH EXAMPLE -An example of 6809 assembly code. -.nf -.ta 8n 16n 24n 32n 40n 48n - contby = 80 - - compgo: lda #contby - ldx #table - 2 !start of table - - clrb - co1: addb #2 - lsra - bcc co1 - jmp (b, x) !accumulator offset indirect -.fi diff --git a/man/8080_as.1 b/man/8080_as.1 deleted file mode 100644 index 4a1563620..000000000 --- a/man/8080_as.1 +++ /dev/null @@ -1,36 +0,0 @@ -.\" $Header$ -.TH 8080_AS 1 -.ad -.SH NAME -8080_as \- assembler for Intel 8080 and 8085 -.SH SYNOPSIS -/usr/em/lib/8080_as [options] argument ... -.SH DESCRIPTION -This assembler is made with the general framework -described in \fIuni_ass\fP(6). -.SH SYNTAX -.IP registers -The 8080 has seven one-byte registers: a, b, c, d, e, h, l; -and two two-byte registers: sp and psw, respectively the stack pointer -and the processor status word. -.IP "addressing modes" -.nf -.ta 8n 16n 24n 32n 40n 48n -syntax meaning - -expr one- or two-byte address or immediate - data, depending on the instruction. - -a,b,c,d,e,h,l -sp,psw (lower byte) of register - -b,d,h register-pair b-c, d-e, or h-l - -m register-pair h-l is address of - (one or two byte) operand -.fi -.SH "SEE ALSO" -uni_ass(1), -ack(1), -.br -System 80/20-4 microcomputer hardware reference manual, 1978 Intel corporation diff --git a/man/a.out.5 b/man/a.out.5 deleted file mode 100644 index 25cc6b5b2..000000000 --- a/man/a.out.5 +++ /dev/null @@ -1,46 +0,0 @@ -.\" $Header$ -.TH A.OUT 5 -.SH NAME -a.out \- universal assembler load format -.SH DESCRIPTION -The load files produced by the universal assemblers look very -much alike. -These load files consist of sequences of variable length -records, each describing a part of the initialized memory. -Bss type memory is left uninitialized by the universal assembler -and has to be initialized at run-time. -The EM header em_head will perform this task on most systems. -Each record consists of a \fIcount\fP, an \fIaddress\fP and -\fIcount\fP bytes. -The first byte should be placed at \fIaddress\fP, the second at -\fIaddress+1\fP, etc. - -.nf -struct loadf { - unsigned short l_addr[2] ; /* address */ - short l_cnt ; /* count */ - unsigned char data[] ; /* data */ -} ; -.fi - -This representation is machine dependent in two ways. -First, the byte order in the first three fields is the byte order -of the machine the universal assembler is running. -Second, the format of the address differs from machine to machine. -.br -For example, for the Intel 8086 the first entry contains a -16-bit offset and the second entry a segment number. -The segment number has to be multiplied by 16 and added to -the addres to obtain the address of the first byte to be -initialized. -.br -The PDP 11 version stores the address in l_addr[0] and the type -of the initialized memory in l_addr[1]. -Types 1 and 3 are absolute, 4 is text, 5 is data and 6 BSS. -.br -For all other currently available machines the -array of shorts is 'replaced' by a long. -This long contains the 32-bit address. -.SH "SEE ALSO" -uni_ass(VI) -.SH BUGS diff --git a/man/arch.1 b/man/arch.1 deleted file mode 100644 index 4d675b626..000000000 --- a/man/arch.1 +++ /dev/null @@ -1,135 +0,0 @@ -.\" $Header$ -.TH ARCH 1 -.SH NAME -arch \- archive and library maintainer -.SH SYNOPSIS -.B arch -key [ posname ] afile name ... -.SH DESCRIPTION -.I Arch -maintains groups of files -combined into a single archive file. -Its main use -is to create and update library files as used by a linker. -It can be used, though, for any similar purpose. -The Amsterdam compiler kit provides its own archiver with a -fixed, machine-independent format, much like the UNIX-V7 -archive format. -EM programs using libraries assume archives in EM format. -.PP -.I Key -is one character from the set -.B drqtpmx, -optionally concatenated with -one or more of -.B vuaibcl. -.I Afile -is the archive file. -The -.I names -are constituent files in the archive file. -The meanings of the -.I key -characters are: -.TP -.B d -Delete the named files from the archive file. -.TP -.B r -Replace the named files in the archive file. -If the optional character -.B u -is used with -.B r, -then only those files with -modified dates later than -the archive files are replaced. -If an optional positioning character from the set -.B abi -is used, then the -.I posname -argument must be present -and specifies that new files are to be placed -after -.RB ( a ) -or before -.RB ( b -or -.BR i ) -.IR posname . -Otherwise -new files are placed at the end. -.TP -.B q -Quickly append the named files to the end of the archive file. -Optional positioning characters are invalid. -The command does not check whether the added members -are already in the archive. -Useful only to avoid quadratic behavior when creating a large -archive piece-by-piece. -.TP -.B t -Print a table of contents of the archive file. -If no names are given, all files in the archive are tabled. -If names are given, only those files are tabled. -.TP -.B p -Print the named files in the archive. -.TP -.B m -Move the named files to the end of the archive. -If a positioning character is present, -then the -.I posname -argument must be present and, -as in -.B r, -specifies where the files are to be moved. -.TP -.B x -Extract the named files. -If no names are given, all files in the archive are -extracted. -In neither case does -.B x -alter the archive file. -.TP -.B v -Verbose. -Under the verbose option, -.I arch -gives a file-by-file -description of the making of a -new archive file from the old archive and the constituent files. -When used with -.B t, -it gives a long listing of all information about the files. -When used with -.BR p , -it precedes each file with a name. -.TP -.B c -Create. -Normally -.I arch -will create -.I afile -when it needs to. -The create option suppresses the -normal message that is produced when -.I afile -is created. -.TP -.B l -Local. -Normally -.I arch -places its temporary files in the directory /tmp. -This option causes them to be placed in the local directory. -.SH FILES -/tmp/v* temporaries -.SH "SEE ALSO" -em_ass(I), arch(V), -.SH BUGS -If the same file is mentioned twice in an argument list, -it may be put in the archive twice. diff --git a/man/arch.5 b/man/arch.5 deleted file mode 100644 index 32ce70042..000000000 --- a/man/arch.5 +++ /dev/null @@ -1,52 +0,0 @@ -.\" $Header$ -.TH ARCH 5 -.SH NAME -arch \- archive (library) file format -.SH SYNOPSIS -.B #include "/usr/em/h/arch.h" -.SH DESCRIPTION -The archive command -.I arch -is used to combine several files into -one. -Archives are used mainly as libraries to be searched -by the EM assembler/linker em_ass(VI) or the universal -assembler/linker em_unias(VI). -.PP -A file produced by -.I arch -has a magic number at the start, -followed by the constituent files, each preceded by a file header. -The magic number and header layout as described in the -include file are: -.RS -.PP -.nf -.ta \w'#define 'u +\w'ARMAG 'u -.so ../h/arch.h -.fi -.RE -.LP -The name is a null-terminated string; -The sizes of the other entries are determined as follows: -long's are 4 bytes in PDP-11 order, int are 2 bytes, low order -byte first, char's are 1 byte. -The date is in the -form of -.IR time (2); -the user ID and group ID are numbers; the mode is a bit pattern -per -.IR chmod (2); -the size is counted in bytes. -.PP -Each file begins on a even offset; -a null byte is inserted between files if necessary. -Nevertheless the size given reflects the -actual size of the file exclusive of padding. -.PP -Notice there is no provision for empty areas in an archive -file. -.SH "SEE ALSO" -arch(I), em_ass(VI), em_unias(VI) -.SH BUGS -Coding user and group IDs as characters is a botch. diff --git a/man/em.1 b/man/em.1 deleted file mode 100644 index f8ed40c5d..000000000 --- a/man/em.1 +++ /dev/null @@ -1,87 +0,0 @@ -.\" $Header$ -.TH EM I -.ad -.SH NAME -em \- calling program for em interpreters -.SH SYNOPSIS -em [-t] [+fcp] [loadfile [args ... ...] ] -.SH DESCRIPTION -The loadfile ("e.out" if not specified) is opened to read the first 8 word header. -The format of this header is explained in e.out(V). -One of these 8 words is a flag word -specifying the interpreter options requested at compile time. -The usual setting of these options is +t -f -c -p. -One of these options may be overridden at run time -by the corresponding flag of em. -Based on these options the name of the appropriate interpreter -is constructed. -.PP -This interpreter is first searched for in /usr/em/mach/pdp/int, then in the current -directory. -.PP -The flags control the following options that can be turned off -or on by prepending them with - or + respectively: -.IP t -run time tests for undefined variables, array bounds etc... -This option costs a small amount of memory and some time. -However, it is very useful for debugging. -.IP p -profiling of the entire program. The interpreter maintain tables containing -an estimate of the number of memory cycles used per source line. -This option is expensive in time as well as in memory space. -The result tables made at run time are dumped onto a file named -em_runinf. This file is converted to human readable format -by the program eminform(I) which writes the profiling information -on a file called em_profile. -.IP f -maintain a bit map of all source lines that have been executed. -This map is written also onto the file em_runinf and can be interpreted by eminform(I) which writes in this case the file em_flow. -This option is almost free in time and space. -.IP c -count line usage in tables that -contains for every source line the number of times it -was entered. -These tables are also written onto em_runinf. -Eminform(I) can be used to convert this information into the -file em_count. -Cheap in time, expensive in memory space. -.PP -These flags -give rise to 5 different interpreters which are in the -directory /usr/em/mach/pdp/int -.PP -If the interpreter exits with a non-zero exit status, then the line numbers -of the 64 last executed source lines are dumped on the file -em_runinf -in the current directory. Eminform(I) writes this information -on the human readable file em_last. -.SH "FILES" -.IP /usr/em/mach/pdp/int/em_???? 35 -interpreters proper -.PD 0 -.IP /usr/em/lib/pdp_int/em_???? -source of interpreter -.IP /usr/em/mach/pdp/int/?+ -positive option switch -.IP /usr/em/mach/pdp/int/?- -negative option switch -.IP em_runinf -memory dump containing runtime information -.IP em_profile -profile data -.IP em_count -source line count data -.IP em_flow -source line flow data -.IP em_last -last lines executed -.PD -.SH "SEE ALSO" -eminform(I), ack(I), int(I) -.SH BUGS -Most error messages are self explanatory. -The interpreter stops in case of lack of space with an error -message SEGVIO stack overflow. -If runtime flags are turned on it is advisable to try again -with the default options. -Bugs should be reported to Evert Wattel. diff --git a/man/em_decode.6 b/man/em_decode.6 deleted file mode 100644 index d1901baaf..000000000 --- a/man/em_decode.6 +++ /dev/null @@ -1,40 +0,0 @@ -.\" $Header$ -.TH EM_DECODE VI -.ad -.SH NAME -em_decode,em_encode \- compact to readable EM and v.v. -.SH SYNOPSIS -/usr/em/lib/em_decode [ inputfile [ outputfile ] ] -.br -/usr/em/lib/em_encode [ inputfile [ outputfile ] ] -.SH DESCRIPTION -Most programs involved with the EM project only produce and accept -EM programs in compact form. -These files are only machine readable. -A description of this compact form can be found in [1]. -To inspect the code produced by compilers or to patch them for one reason -or another, you need human readable assembly code. -Em_decode will do the job for you. -.PP -Em_decode accepts the normal compact form in both optimized and -unoptimized form -.PP -Sometimes you have to make some special routines directly -in EM, for instance the routines implementing the system calls. -At these times you may use em_encode to produce compact routines -out of these human readable assembly modules. -.PP -The first argument is the input file. -The second argument is the output file. -Both programs can act as a filter. -.SH "SEE ALSO" -.IP [1] -A.S.Tanenbaum, Ed Keizer, Hans van Staveren & J.W.Stevenson -"Description of a machine architecture for use of -block structured languages" Informatica rapport IR-81. -.IP [2] -ack(I) -.SH DIAGNOSTICS -Error messages are intended to be self-explanatory. -.SH AUTHOR -Johan Stevenson, Vrije Universiteit. diff --git a/man/eminform.1 b/man/eminform.1 deleted file mode 100644 index 18e5dc142..000000000 --- a/man/eminform.1 +++ /dev/null @@ -1,51 +0,0 @@ -.\" $Header$ -.tr ~ -.TH EMINFORM I -.ad -.SH NAME -eminform \- converts runtime information of interpreted em to -human readable form. -.SH SYNOPSIS -eminform -.SH DESCRIPTION -The EM interpreter, em(I), has several debugging features built in. -They can be activated by flag options to em(I). -The EM interpreter collects the information while it runs the program. -When the program is terminated, the interpreter dumps this information onto -a file called em_runinf. -Eminform converts this information in human readable form onto -a set of files with fixed names, the file em_runinf itself is unlinked. -.PP -.in +15 -.ti -13 -~~em_last~~~~A circular buffer is used to keep track of -the last collection of executed source lines. -.ti -13 -~~em_flow~~~~A bit map for all source lines tells which lines -are executed. -.ti -13 -~~em_count~~~Count the number of times each source line was entered. -.ti -13 -~~em_profile~Estimate the number of memory cycles -spent on each source line. -.in -15 -.LP -The most common use of eminform is to print the numbers of the last executed -source lines if an execution error occurred. -No arguments are needed in this case. -.LP -Eminform will create only those files for which there were -interpreter flags turned on. If no runtime error occurred and -no flag was turned on the file em_runinf is not created. In -this case eminform will give the error message "read header -failed". -.SH FILES -em_runinf, em_last, em_flow, em_count, em_profile -.SH "SEE ALSO" -ack(I), int(I), em(I). -.SH BUGS -If an entire procedure is not touched, the the file name in -which this procedure occured is unknown. -If no em_runinf is available the error message is "read header -failed" and a core dump is created. -Bugs should be reported to Evert Wattel diff --git a/man/i86_as.1 b/man/i86_as.1 deleted file mode 100644 index 9f694715e..000000000 --- a/man/i86_as.1 +++ /dev/null @@ -1,145 +0,0 @@ -.\" $Header$ -.TH I86_AS 1 -.ad -.SH NAME -i86_as \- assembler for Intel 8086 -.SH SYNOPSIS -/usr/em/lib/i86_as [options] argument ... -.SH DESCRIPTION -This assembler is made with the general framework -described in \fIuni_ass\fP(6). -.SH SYNTAX -.IP segments -An address on the Intel 8086 consists of two pieces: -a segment number and an offset. A memory address is computed as -the segment number shifted left 4 bits + the offset. -Assembly language addresses only give the offset, with the exception of -the address of an inter-segment jump or call (see \fIaddressing modes\fP -below). -For each segment type (.org, .text, .data, or .bss) the segment number -must be given with the .sbase pseudo-instruction. -The syntax is: -.br - .sbase expression -.br -with segment-id one of .org, .text, .data, or .bss. -Example: -.br - .sbase .text 0x1000 - -.IP registers -The Intel 8086 has the following 16-bit registers: -.br -Four general registers: ax (accumulator), bx (base), cx (count), and dx (data). -The upper halves and lower halves of these registers are separately -addressable as ah, bh, ch, dh, and al, bl, cl, dl respectively. -.br -Two pointer registers: sp (stack pointer) and bp (base pointer). -.br -Two index registers: si (source index) and di (destination index). -.br -Four segment registers: cs (code), ds (data), ss (stack), and es (extra). -.IP "addressing modes" -.nf -.ta 8n 16n 24n 32n 40n 48n -syntax meaning - -expr the value of \fIexpr\fP is immediate data or - an address offset. There is no special - notation for immediate data. - -register one of the aforementioned general registers - or their upper or lower halves, or one of the - four segment registers. - -(expr) the value of expr is the address of the operand. - -(reg) -expr (reg) the value of \fIexpr\fP (if present) + the contents of - \fIreg\fP (which must be a pointer or an index register) - is the address of the operand. - -(preg) (ireg) -expr (preg) (ireg) - the value of \fIexpr\fP (if present) + the contents of - \fIpreg\fP (which must be a pointer register) + the - contents of \fIireg\fP (which must be an index register) - is the address of the operand. - -The next addressing mode is only allowed with the instructions -"callf" or "jmpf". - -expr : expr the value of the first \fIexpr\fP is a segment number, - the value of the second \fIexpr\fP is an address offset. - The (absolute) address of the operand is computed - as described above. -.fi - -.IP instructions -Each time an address is computed the assembler decide which segment register -to use. You can override the assembler's choice by prefixing the instruction -with one of eseg, cseg, sseg, or dseg; these prefixes indicate that the -assembler should choose es, cs, ss, or ds instead. -.br -Example: -.ti +8 -dseg movs -.SH "SEE ALSO" -uni_ass(6), -ack(1), -.br -MCS-86 assembly language reference manual, 1978, Intel Corporation -.SH EXAMPLE -.nf -.ta 8n 16n 24n 32n 40n 48n -An example of Intel 8086 assembly language: - - _panic: - push bp - mov bp,sp - .data - _35: - .word 24944 - .word 26990 - .word 14947 - .word 32 - .text - call _disable - mov ax,_35 - push ax - call _str - pop si - push 4(bp) - call _str - pop si - call _nlcr - call _exit - mov sp,bp - pop bp - ret - .extern _nopanic - _nopanic: - push bp - mov bp,sp - .data - _38: - .word 28526 - .word 24944 - .word 26990 - .word 14947 - .word 32 - .text - mov ax,_38 - push ax - call _str - pop si - push 4(bp) - call _str - pop si - push 6(bp) - call _octal - pop si - mov sp,bp - pop bp - ret -.fi diff --git a/man/m68k2_as.1 b/man/m68k2_as.1 deleted file mode 100644 index 77ef9308a..000000000 --- a/man/m68k2_as.1 +++ /dev/null @@ -1,100 +0,0 @@ -.\" $Header$ -.TH M68K2_AS 1 -.ad -.SH NAME -m68k2_as \- assembler for Motorola 68000 -.SH SYNOPSIS -/usr/em/lib/m68k2_as [options] argument ... -.br -/usr/em/lib/m68k4_as [options] argument ... -.SH DESCRIPTION -This assembler is made with the general framework -described in \fIuni_ass\fP(6). -.SH SYNTAX -.IP registers -The 68000 has the following registers: -seven data-registers (d1 - d7), seven address-registers (a1 - a6, sp) -of which sp is the system stack pointer, a program counter (pc), -a status register (sr), and a condition codes register (ccr) which is actually -just the low order byte of the status register. -.IP "addressing modes" -.nf -.ta 8n 16n 24n 32n 40n 48n -syntax meaning (name) - -reg contents of \fIreg\fP is operand, where \fIreg\fP is - one of the registers mentioned above (register direct) - -(areg) contents of \fIareg\fP is address of operand, where - \fIareg\fP is an address-register - (address register indirect) - -(areg)+ same as (areg), but after the address is used, - \fIareg\fP is incremented by the operand length - (postincrement) - --(areg) same as (areg), but before the address is used, - \fIareg\fP is decremented by the operand length - (predecrement) - -expr(areg) -expr(pc) \fIexpr\fP + the contents of the register yields the - address of the operand (displacement) - -expr(areg, ireg) -expr(pc, ireg) \fIexpr\fP + the contents of the register + the contents - of \fIireg\fP yields the address of the operand. \fIireg\fP is - an address- or a data-register. - \fIireg\fP may be followed by .w or .l indicating whether - the size of the index is a word or a long - (displacement with index) - -expr \fIexpr\fP is the address of the operand - (absolute address) - -#expr \fIexpr\fP is the operand (immediate) -.fi - -Some instructions have as operand a register list. This list consists of -one or more ranges of registers separated by '/'s. A register range consists -of either one register (e.g. d3) or two registers separated by a '-' -(e.g. a2-a4, or d4-d5). The two registers must be in the same set (address- -or data-registers) and the first must have a lower number than the second. -.IP instructions -Some instructions can have a byte, word, or longword operand. -This may be indicated by prepending the mnemonic with .b, .w, or .l -respectively. Default is .w. -.SH "SEE ALSO" -uni_ass(6), -ack(1), -.br -MC68000 16-bit microprocessor User's manual, Motorola Inc, 1979 -.SH EXAMPLE -.sp 2 -.nf -.ta 8n 16n 24n 32n 40n 48n 56n 64n - .define .cii - - .text - .cii: - movem.l a0/d0/d1,.savreg - move.l (sp)+,a0 ! return address - move (sp)+,d0 ! destination size - sub (sp)+,d0 ! destination - source size - bgt 1f - sub d0,sp ! pop extra bytes - bra 3f - 1: - move (sp),d1 - ext.l d1 - swap d1 - asr #1,d0 - 2: - move.w d1,-(sp) - sub #1,d0 - bgt 2b - 3: - move.l a0,-(sp) - movem.l .savreg,a0/d0/d1 - rts -.fi diff --git a/man/m68k_int.1 b/man/m68k_int.1 deleted file mode 100644 index 9948e4e74..000000000 --- a/man/m68k_int.1 +++ /dev/null @@ -1,96 +0,0 @@ -.\" $Header$ -.TH EM I -.ad -.SH NAME -em \- calling program for em interpreters -.SH SYNOPSIS -em [-t] [+fcp] [loadfile [args ... ...] ] -.SH DESCRIPTION -The loadfile ("e.out" if not specified) is opened to read the first 8 word header. -The format of this header is explained in e.out(V). -One of these 8 words is a flag word -specifying the interpreter options requested at compile time. -The usual setting of these options is +t -f -c -p. -These options may be overridden at runtime as follows: -em -t turns the test option of; em +c turns count on ; em +p turns profile -on ; em +c +p turns both count and profile on. -Based on these options the name of the appropriate interpreter -is constructed. -Two versions exist, one for two byte words and four byte pointers and -one for four byte words and pointers. -The information in the header of the e.out file is used by em to select the -right interpreter for the word size of used in the e.out file. -.PP -This interpreter is searched for in /usr/em/lib/int[24]4. -.PP -The flags control the following options that can be turned off -or on by prepending them with - or + respectively: -.IP t -run time tests for undefined variables, array bounds etc... -This option costs a small amount of memory and some time. -However, it is very useful for debugging. -.IP p -profiling of the entire program. The interpreter maintains tables containing -an estimate of the number of processor state cycles used per source line. -A processor state cycle is equal to two internal clock cycles. -This option is expensive in time as well as in memory space. -The result tables made at run time are dumped in a human readable -format onto a file named -em_profile. -.IP f -maintain a bit map of all source lines that have been executed. -This map is written onto a file em_flow . -This option is almost free in time and space. -The file is not easy to read. -Of each procedure only the lines between the first statement and the last -statement are represented in the bit map. -Currently this option is not installed in the em tree. -.IP c -count line usage in tables that -contains for every source line the number of times it -was entered. -These tables are written onto em_count, a human readable file . -This option is cheap in time, but costs some in memory space. -.IP l -dump the line numbers of the last 64 lines entered onto a file named -em_last. -This file will be in a human readable format. -This option is used simultaneously with the test option. -.PP -These flags -give rise to 5 different interpreters which are in the -directory /usr/em/lib/int24 or in /usr/em/lib/int44 -for the two byte word or the four byte word options, respectively. -.PP -.SH "FILES" -.IP /usr/em/lib/int[24]4/em_???? 35 -interpreters proper -.PD 0 -.IP /usr/em/mach/m68k2/int/mloop? -source of interpreter -.IP em_profile -profile data -.IP em_count -source line count data -.IP em_flow -source line flow data -.IP em_last -last lines executed -.PD -.SH "SEE ALSO" -\fIack\fP(I), -\fIint24\fP(I), -\fIint44\fP(I) -.SH BUGS -Most error messages are self explanatory. -If runtime flags are turned on it is advisable to try again -with the default options. -If the interpreter does not work most probably your particular -machine has an other format for the system calls then assumed -in the source. -In that case adapt source file mloopc to your machine. -Also the instruction that causes the machine to allocate stack -space might differ . -In that case adapt the macro \fIclaimstack\fP in deffile. -.SH AUTHOR -Freek van Schagen diff --git a/man/macro.v7 b/man/macro.v7 deleted file mode 100644 index 620e78cf7..000000000 --- a/man/macro.v7 +++ /dev/null @@ -1,66 +0,0 @@ -.\" $Header$ -.de TH -.PD -.br -.bp -.lc -.nr in 5 -.de hd -'sp 2 -'tl '\\$1(\\$2)'Amsterdam Compiler Kit'\\$1(\\$2)' -'sp 2 -\\.. -.wh -6 fo -.wh 0 hd -.nr pi 5 -.. -.de fo -'sp 2 -'tl ''- % -'' -'bp -.. -.de PD -.nr pd 0.5v -.if \\n(.$ .nr pd \\$1 -.. -.de SH -.nr in 5 -.nr pi 5 -.in \\n(in -.ti 0 -.sp \\n(pdu -.ne 2 -.fi -\fB\\$1\fP -.br -.. -.de LP -.PP -.. -.de PP -.sp \\n(pdu -.ne 2 -.in \\n(in -.nr pi 5 -.ns -.. -.de IP -.if \\n(.$-1 .nr pi \\$2 -.sp \\n(pdu -.in \\n(in+\\n(pi -.ta \\n(in \\n(in+\\n(pi -.ti 0 -\fB\\$1\fR\c -.if \w'\fB\\$1\fP'-\\n(pin+1n .br -.. -.de RS -.nr in +5 -.in +5 -.. -.de RE -.in -5 -.nr in -5 -.. -.de RF -\fI\\$1\fP(\\$2)\\$3 -.. diff --git a/man/ns_as.1 b/man/ns_as.1 deleted file mode 100644 index d5fd34b90..000000000 --- a/man/ns_as.1 +++ /dev/null @@ -1,148 +0,0 @@ -.TH NS_ASS VI -.ad -.SH NAME -ns_as \- National Semiconductor 16032 assembler/linker -.SH SYNOPSIS -\&..../lib/ns/as [options] argument ... -.SH DESCRIPTION -The assembler for the National Semiconductor 16032 is based -on the universal assembler \fIuni_ass\fP(VI). -The mnemonics for the instructions are taken from the NS-16000 -Programmers Reference Manual. -The syntax of the instruction operands is similar to the syntax used -in that manual, -although the meaning is sometimes quite different. -The cross assembler issued by National Semiconductor -associates a type (sb,..) with each symbol -and automatically generates sb offset mode for symbols of type sb. -This assembler does not record the types, -each symbol simply produces an untyped value. -.sp 1 -The possible operands are: -.IP "general registers -These are called r0, r1, r2, r3, r4, r5, r6 and r7. -The symbol REG is used to indicate use of any of these 8 registers -in other operands. -.IP "floating point registers -These are called f0, f1, f2, f3, f4, f5, f6 and f7. -.IP "dedicated registers -All types of dedicated registers can be used with the appropriate instructions. -Examples: sb, fp, intbase, ptb1. -.IP expr(REG) -register relative -.IP expr(fp) -frame pointer relative -.IP expr(sb) -static base relative -.IP expr(sp) -stack pointer relative -.IP expr(pc) -program counter relative, -the expression indicates a location in memory from which the current value -of '.' is subtracted by the assembler. -E.g. "movw label(pc),r0; label: .word ..." moves the contents of the word -at \fIlabel\fP to r0. -.IP expr(expr(fb)) -.IP expr(expr(sb)) -.IP expr(expr(sp)) -memory relative -.IP @expr -absolute -.IP external(expr)+expr -The external mode is provided, although this assembler -does not build a module table. -.IP tos -top of stack. -.PD 0 -.sp 1 -.PP -Usage of the scaled index operands is allowed. -.br -The convention used to indicate offset length by appending :B, :W or :D -to offsets is not implemented. -The assembler tries to find out the minimal size needed for any constant -in an operand of the instruction placed in the text segment. -Offsets in instructions outside \fI.text\fP are always four bytes. -.PP -All special operands, e.g. register list, configuration list, have -the same format as in the Programmers Reference Manual. -.PP -Whenever possible the assembler automatically uses the short(quick) opcodes for -jsr(jsb), jump(br), add(addq), cmp(cmpq) and mov(movq). -.SH BUGS -The data types floating and packed-decimal are not supported. -.br -Initialization of floating-point numbers is not possible. -.br -The mnemonics of the slave processor instructions are poorly documented, -the format of the NS-16032S-6 data sheet is used. -.br -The documentation gave contradictory information on the format -of a few instructions. -.IP - -Three different schemes are presented for the encoding -of the last operand of the block instructions. -.IP - -Two different values are specified for -the encoding of the msr register in smr and lmr instructions. -.IP - -Two different possibilities are given for the encoding of -the instructions movsu and movus. -.SH EXAMPLE -.nf -.ta 12n 20n 28n 36n - -00000000 0E0B02 setcfg [ m ] - label: -00000003 EC3E lprb psr,r7 -00000005 2D37 sprw intbase,r6 - -00000007 EA7C br label - -00000009 02803B bsr rout1 -0000000C 228044 cxp rout1 -0000000F 1204 ret 4 -00000011 4204 rett 4 -00000013 328044 rxp rout1 - -00000016 1E0300 rdval r0 -00000019 163028 scsr r5 - -0000001C 3F32 shid r6 -0000001E 7F0B bispsrd r1 -00000020 7C17 caseb r2 -00000022 7FA806 cxpd @6 - -00000025 021F jsr @rout1 - -00000027 BEB529 absf f5,f6 -0000002A EE0538 movusw r7,r0 -0000002D 3E40A101 movbl 1,f5 -00000031 CE440003 cmpmb r0,r1,4 - -00000035 CE4F0800 extsd r1,r1,0,1 -00000039 62A0 save [ r5, r7 ] -0000003B 1E0B00 lmr bpr0,r0 - -0000003E 0E8C04 skpst w -00000041 CC0042 acbb 1,r0,label -00000044 B2 rout1: wait -00000045 7F950C0B adjspd 11(12(sb)) -00000049 7CA50D adjspb 13 -0000004C 7DB50102 adjspw external(1)+2 -00000050 7FBD adjspd tos - -00000052 7CED860807 adjspb 7(8(fp))[r6:w] - -.fi -.SH "SEE ALSO" -uni_ass(VI) -.br -NS 16000 Programmers Reference Manual. Publ. no. 420306565-001PB -.br -NS16032S-6, NS16032S-4 High Performance Microprocessors, november 1982 -.br -publ. no. 420306619-002A. -.PD 0 -.SH AUTHOR -Ed Keizer, Vrije Universiteit diff --git a/man/pdp_as.1 b/man/pdp_as.1 deleted file mode 100644 index afd29b027..000000000 --- a/man/pdp_as.1 +++ /dev/null @@ -1,138 +0,0 @@ -.\" $Header$ -.TH PDP_AS 1 -.ad -.SH NAME -pdp_as \- assembler for PDP 11 -.SH SYNOPSIS -/usr/em/lib/pdp_as [options] argument ... -.SH DESCRIPTION -This assembler is made with the general framework -described in \fIuni_ass\fP(6). -.SH SYNTAX -.IP registers -The pdp11 has seven general registers, numbered r0 through r7. -Of these, r6 is the stack pointer and can also be referenced to by \fIsp\fP, -r7 is the program counter and has \fIpc\fP as synonym. There are also six -floating-point registers fr0 through fr5, but the names r0 through r5 can -also be used. From the context will be derived what kind of register is meant. -.IP "addressing modes" -.nf -.ta 8n 16n 24n 32n 40n 48n -syntax meaning (name) - -reg contents of register reg is operand. - (register) - -(reg) contents of reg is address of operand. - (register deferred) - -(reg)+ as (reg), but after the operand is fetched - the contents of reg is incremented by the - size of the operand. (auto-increment) - -*(reg)+ contents of reg points to address of the operand. - after the operand is fetched, reg is incremented - by two. (auto-increment deferred) - --(reg) as (reg), but before the operand is fetched - the contents of reg is decremented by the - size of the operand. (auto-decrement) - -*-(reg) before the operand is fetched, reg is decremented - by two. then the contents of reg points to the - address of the operand. (auto-decrement deferred) - -expr(reg) value of expr + contents of reg yields address - of operand. (index) - -*expr(reg) value of expr + contents of reg yields pointer - to address of operand. (index deferred) - -$expr the value of expr is the operand. (immediate) - -*$expr the value of expr is the address of the operand. - (absolute) - -expr expr is address of operand. (relative) - -*expr expr points to the address of the operand. - (relative deferred) - -.fi -.IP "condition code instructions" -Two or more of the "clear" instructions (clc, cln, clv, clz), or -two or more of the "set" instructions (sec, sen, sev, sez) may be -or-ed together with `|' to yield a instruction that clears or sets two or more -of the condition-bits. Scc and ccc are not predefined. -.IP "extended branches" -The assembler recognizes conditional branches with a "j" substituted for -the "b". When the target is too remote for a simple branch, a converse branch -over a jmp to the target is generated. Likewise jbr assembles into either br -or jmp. -.IP "floating-point instructions" -The names of several floating-point instructions differ from the names -in the handbook mentioned below. Synonyms ending in "d" for instructions ending -in "f" are not recognized. Some instructions have different names; the mapping -is as below. -.nf -.ta 8n 16n 24n 32n 40n 48n - -handbook pdp_as - -ldcif, ldclf, -ldcid, ldcld movif - -stcfi, stcfl, -stcdi, stcdl movfi - -ldcdf, ldcfd movof - -stcdf, stcfd movfo - -ldexp movie - -stexp movei - -ldd, ldf movf - -std, stf movf - -.fi -The movf instruction assembles into stf, when the first operand is one of the -first three floating-point registers, otherwise it assembles into ldf. -.IP sys -This instruction is synonymous with trap. -.SH EXAMPLE -An example of pdp11 assembly code. -.nf -.ta 8n 16n 24n 32n 40n 48n - -!this is the routine that reads numbers into r0 -!the number is terminated by any non digit -!the non digit is left in r1 -innum: clr r3 !r3 will accumulate the number -inloop: jsr pc,_getchar !read a character into r0 - cmp r0,$0121 !is it a Q? - jeq quit - cmp r0,$48 !is the character a digit? - jlt indone !digits 0-9 have codes 060-071 octal - cmp r0,$56 - jgt indone - mul $10,r3 !r3 = 10 * r3 - sub $48,r3 !convert ascii code to numerical value - add r0,r3 !r3 = old sum * 10 + new digi - jbr inloop - -indone: mov r0,r1 !put the first non digit into r1 - mov r3,r0 !put the number read into r0 - rts pc !return to caller - -.fi -.SH "SEE ALSO" -uni_ass(6), -ack(1), -.br -PDP11/60 processor handbook, Digital Equipment Corporation, 1977 -.SH BUGS -You cannot use *reg in place of (reg). Likewise *(reg) is not understood as -*0(reg). diff --git a/man/z8000_as.1 b/man/z8000_as.1 deleted file mode 100644 index cb2bb7771..000000000 --- a/man/z8000_as.1 +++ /dev/null @@ -1,163 +0,0 @@ -.TH Z8000_AS 1 -.ad -.SH NAME -z8000_as \- assembler for Zilog z8000 (segmented version) -.SH SYNOPSIS -/usr/em/lib/z8000_as [options] argument ... -.SH DESCRIPTION -This assembler is made with the general framework -described in \fIuni_ass\fP(6). -.SH SYNTAX -.IP instructions -Instruction mnemonics are implemented exactly as described in -\fIZ8000 PLZ/ASM Assembly Language Programming Manual\fP and -\fIAmZ8001/2 Processor Instruction Set\fP. -.IP registers -The z8000 has sixteen 16-bit general purpose registers specified -as R0 through R15. All sixteen registers can be used as accumulators. -In addition to this, fifteen of the sixteen registers may be used -in addressing mode calculations as either indirect, index or -base-address registers. Because the instruction format encoding -uses the value zero to differentiate between various addressing -modes, register R0 (or the register pair RR0) cannot be used as an -indirect, index or base-address register. -It is also possible to address registers as groups of 8, 32 or 64 bits. -These registers are specified as follows. -.nf -.ta 8n 16n 24n 32n 40n 48n -- RH0, RL0, RH1, RL1, ..., RH7, RL7 for 8-bit regis- - ters. (\fIH\fP stands for high-order byte, and \fIL\fP stands - for low-order byte within a word register). These - registers overlap 16-bit registers R0 through R7. -- RR0, RR2, ..., RR14 for 32-bit register pairs. -- RQ0, RQ4, RQ8 and RQ12 for 64-bit register quadruples. -.fi -Besides register pair RR14 is used as stackpointer. -.IP "addressing modes" -.nf -.ta 8n 16n 24n 32n 40n 48n -syntax meaning (name-mnemonic) - -$expr the value of expr is the operand. - (immediate-IM) - -reg contents of register reg is operand. Any - register as described above is allowed. - (register-R) - -*reg32 contents of register pair reg32 is add- - ress of operand. Any register pair can - be used except RR0. - (indirect register-IR) - -expr expr is address of operand. - (direct address-DA) - -expr(reg16) value of expr + contents of word regis- - ter reg16 yields address of operand. - Any word register can be used except R0. - (indexed address-X) - -expr expr is address of operand. This mode - is implied by its instruction. It is - only used by CALR, DJNZ, JR, LDAR and - LDR and is the only mode available to - these instructions. In fact this mode - differs not from the mode DA. - (relative address-RA) - -reg32($expr) contents of register pair reg32 + value - of expr yields address of operand. Any - register pair can be used except RR0. - (based address-BA) - -reg32(reg16) contents of register pair reg32 + con- - tents of word register reg16 yields - address of operand. Any register pair/ - word register can be used except RR0/R0. - (based indexed address-BX) - -.fi -.IP "segmented addresses" -Segmented addresses require 23 bits, 7 bits for the segment number -and 16 bits for the offset within a segment. -So segment 0 contains addresses 0-FFFF, segment 1 contains addresses -10000-1FFFF, and so on. -.br -Assembler syntax of addresses and immediate data is as described above -(modes IM, DA and X). -Thus the assembler treats e.g. address 2BC0F as an address in segment 2 -with offset BC0F within the segment. -There is also an explicit way to express this using the, more unusual, -syntax <>offset. -.br -There are two internal representations of segmented addresses -depending on the size of the offset. If the offset fits into 8 bits -the address is stored in one word (the low-order byte containing -the offset, bits 8 to 14 containing the segment number and -bit 15 containing a zero) otherwise the address is stored in two -words (the lower word containing the offset, the upper word as -before but bit 15 containing 1 indicating that the offset is in -the next word). -This is important for instructions which has an operand of mode DA -or X. -.IP "extended branches" -When the target address in a relative jump/call (JR/CALR) -does not fit into the instruction format, the assembler generates -a corresponding `normal' jump/call (JP/CALL). -.SH EXAMPLE -An example of z8000 assembly code. -.nf -.ta 8n 16n 24n 32n 40n 48n - -! This z8000 assembly routine converts a positive number -!(in R1) to a string representing the number and puts this -!string into a buffer (R3 contains the starting address of -!this buffer. The base is in R4 determining %x, %d or %o. - -convert: - exts RR0 !sign-extend R1 - div RR0, R4 !divide by the base - test R1 !R1 contains the quotient - jr EQ, 5f - !if quotient is 0 convert is ready - !else push remainder onto the stack - push *RR14, R0 - calr convert !and again... - pop R0, *RR14 -5: add R0, $060 !add `0' - cp R0, $071 !compare to `9' - jr LE, 8f - add R0, $7 !in case of %x `A'-`F' -8: ldb 0(R3), RL0 !put character into buffer - inc R3 - ret - -.fi -.SH "SEE ALSO" -uni_ass(6). -.br -ack(1). -.br -Z8000 PLZ/ASM Assembly Language Programming Manual, april 1979. -.br -AmZ8001/2 Processor Instruction Set, 1979. -.SH BUGS -You cannot use (reg16) instead of 0(reg16). -.br -Condition codes \fIZ\fP (meaning zero), \fIC\fP (meaning carry) and -(meaning always false) are not implemented. -The first two because they also represent flags and the third one -because it's useless. -So for \fIZ\fP/\fIC\fP use \fIEQ\fP/\fIULT\fP. -.br -The z8000 assembly instruction set as described in the book -\fIAmZ8001/2 Processor Instruction Set\fP differs from the one -described in the manual \fIZ8000 PLZ/ASM Assembly Language Programming -Manual\fP in that the book includes CLRL, LDL (format F5.1) and -PUSHL (format F5.1) which all in fact do not (!) work. -.br -On the other side the book excludes SIN, SIND, SINDR, SINI, SINIR, -SOUT, SOUTD, SOTDR, SOUTI and SOTIR. -Whether these instructions do work as described in the manual has not -been tested yet. diff --git a/man/z80_as.1 b/man/z80_as.1 deleted file mode 100644 index be2efb433..000000000 --- a/man/z80_as.1 +++ /dev/null @@ -1,66 +0,0 @@ -.\" $Header$ -.TH z80_AS 1 -.ad -.SH NAME -z80_as \- assembler for Zilog z80 -.SH SYNOPSIS -/usr/em/lib/z80_as [options] argument ... -.SH DESCRIPTION -This assembler is made with the general framework -described in \fIuni_ass\fP(6). -.SH SYNTAX -.IP registers -The z80 has six general-purpose 8-bit registers: b, c, d, e, h, l; -an 8-bit accumulator: a; an 8-bit flag register: f; an 8-bit interrupt -vector: i; an 8-bit memory refresh register: r; two 16-bit index registers: -ix, iy; a 16-bit stack pointer: sp; and a 16-bit program counter: pc. -The general-purpose registers can be paired to form three registers pairs of -16 bits each: bc, de, hl. -An alternate set of registers is provided that duplicates the accumulator, -the flag register, and the general-purpose registers. The "exx"-instruction -exchanges the contents of the two sets of general-purpose registers; the -contents of the accumulator and flag register can be exchanged with the contents -of their alternates by the "ex af, af2"-instruction. -.IP "addressing modes" -.nf -.ta 8n 16n 24n 32n 40n 48n -syntax meaning - -expr dependent on the instruction, the - value of \fIexpr\fP can be immediate - data or the address of the operand. - There is no special notation for - immediate data. - -(ireg + expr) -(ireg - expr) the contents of ireg (which must be - one of the index-registers) + or - - the - one byte - value of \fIexpr\fP - yield the address of the operand. - -(expr) the value of \fIexpr\fP is the address of - the operand. - -reg the contents of \fIreg\fP - one of the above- - mentioned registers - is the operand. - -(reg) the contents of \fIreg\fP - one of the 16-bit - registers except pc - is the address of - the operand. - -nz, z, nc, c, -po, pe, p, m the letters indicate a condition-code: - nonzero, zero, carry, no carry, - parity odd, parity even, sign positive, - sign negative respectively. Used by conditional - jump, call, and return instructions. - -.fi -.IP instructions -The jr-instruction will automatically be replaced by a jp-instruction if the -target is too remote. -.SH "SEE ALSO" -uni_ass(6), -ack(1), -.br -Z80 Users Manual, Joseph J. Carr, Reston Publishing Company, 1980 diff --git a/modules/src/Xmalloc/Makefile b/modules/src/Xmalloc/Makefile deleted file mode 100644 index de3288a94..000000000 --- a/modules/src/Xmalloc/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -EMHOME=../../.. -HDIR = $(EMHOME)/modules/h -INSTALL=$(EMHOME)/modules/install -COMPARE=$(EMHOME)/modules/compare - -CFLAGS = -O -I$(HDIR) - -SOURCES = Xmalloc.c - -OBJECTS = Xmalloc.o - -all: $(OBJECTS) - -install: all - $(INSTALL) lib/Xmalloc.o - -compare: all - $(COMPARE) lib/Xmalloc.o - -clean: - rm -f *.[oa] diff --git a/modules/src/Xmalloc/Xmalloc.c b/modules/src/Xmalloc/Xmalloc.c deleted file mode 100644 index 3320d1ce9..000000000 --- a/modules/src/Xmalloc/Xmalloc.c +++ /dev/null @@ -1,142 +0,0 @@ -/* M E M O R Y A L L O C A T I O N R O U T I N E S */ - -/* The reason for having own memory allocation routines (malloc(), - realloc() and free()) is plain: the garbage collection performed by - the library functions malloc(), realloc() and free() costs a lot of - time, while in most cases (on a VAX) the freeing and reallocation of - memory is not necessary. - The (basic) memory allocating routines offered by this memory - handling package are: - - char *malloc(n) : allocate n bytes - char *realloc(ptr, n) : reallocate buffer to n bytes - (works only if ptr was last allocated) - free(ptr) : if ptr points to last allocated - memory, this memory is re-allocatable - - This module imports routines from "system", an assertion macro, - and the compile-time - constants ALIGNBITS, ALLOCSIZ, DEBUG. - ALIGNBITS is an integer constant defining suitable alignment, - ALLOCSIZ is the size of the chunks of memory asked from the system, - DEBUG enables the assertions. -*/ - -#include -#include - -#ifndef ALIGNBITS -#define ALIGNBITS 07 -#endif - -#ifndef ALLOCSIZ -#define ALLOCSIZ 4096 -#endif - -/* the following variables are used for book-keeping */ -static int nfreebytes = 0; /* # free bytes in sys_break-ed space */ -static char *freeb = 0; /* pointer to first free byte */ -static char *lastalloc; /* pointer to last malloced sp */ -static int lastnbytes; /* nr of bytes in last allocated space */ -static char *firstfreeb; /* pointer to first ever free byte */ - -#define ALIGN(m) (((m)&ALIGNBITS)? (m)+((1+ALIGNBITS)-((m)&ALIGNBITS)):(m)) - -char *sys_break(); - -char * -malloc(n) - unsigned int n; -{ - /* malloc() is a very simple malloc(). - */ - - n = ALIGN(n); - if (nfreebytes < n) { - register int nbts = (n <= ALLOCSIZ) ? ALLOCSIZ : n; - - if (!nfreebytes) { - if (!firstfreeb) { - /* We arrive here the first time malloc is - called - */ - int diff; - - if (!(freeb = sys_break(0))) return 0; - if ((diff = (int)((long)freeb&ALIGNBITS))!=0) { - /* align memory to ALIGNBITS ... */ - diff = (1 + ALIGNBITS) - diff; - if (!(freeb = sys_break(diff))) { - return 0; - } - freeb += diff; - assert(((long)freeb & ALIGNBITS) == 0); - } - firstfreeb = freeb; - } - if (!(freeb = sys_break(nbts))) return 0; - } - else { - if (!sys_break(nbts)) return 0; - } - nfreebytes += nbts; - } - lastalloc = freeb; - freeb = lastalloc + n; - lastnbytes = n; - nfreebytes -= n; - return lastalloc; -} - -char * -realloc(ptr, n) - char *ptr; - unsigned int n; -{ - /* realloc() is designed to append more bytes to the latest - allocated piece of memory. - */ - register int nbytes = n; - - if (!ptr || ptr != lastalloc) { /* security */ - return 0; - } - nbytes -= lastnbytes; /* # bytes required */ - if (nbytes == 0) { /* no extra bytes */ - return lastalloc; - } - - /* if nbytes < 0: free last allocated bytes; - if nbytes > 0: allocate more bytes - */ - if (nbytes > 0) nbytes = ALIGN(nbytes); - if (nfreebytes < nbytes) { - register int nbts = (nbytes < ALLOCSIZ) ? ALLOCSIZ : nbytes; - if (!sys_break(nbts)) return 0; - nfreebytes += nbts; - } - freeb += nbytes; /* less bytes */ - lastnbytes += nbytes; /* change nr of last all. bytes */ - nfreebytes -= nbytes; /* less or more free bytes */ - return lastalloc; -} - -free(p) - char *p; -{ - if (lastalloc && lastalloc == p) { - nfreebytes += lastnbytes; - freeb = lastalloc; - lastnbytes = 0; - lastalloc = 0; - } -} - -#ifdef DEBUG -mem_stat() -{ - - printf("Total nr of bytes allocated: %d\n", - sys_break(0) - firstfreeb); -} -#endif DEBUG diff --git a/modules/src/em_opt/Makefile b/modules/src/em_opt/Makefile deleted file mode 100644 index 1c9539ac2..000000000 --- a/modules/src/em_opt/Makefile +++ /dev/null @@ -1,106 +0,0 @@ -# $Header$ -EMHOME = ../../.. -INSTALL = $(EMHOME)/modules/install -COMPARE = $(EMHOME)/modules/compare -LIBOPT = libopt.a - -# set HOWMUCH to head -20 to limit number of patterns used -#HOWMUCH = head -20 -HOWMUCH = cat - -LEXLIB = -ll -INCLDIR = -I$(EMHOME)/h -I$(EMHOME)/modules/h -I$(EMHOME)/modules/pkg -PREFLAGS = $(INCLDIR) -DPRIVATE=static -# Enable the next line to produce a version that output's the line number -# from the patterns file each time an optimization is performed. -#PREFLAG = $(PREFLAGS) -DSTATS -PROFFLAG = -O -CFLAGS = $(PREFLAGS) $(PROFFLAG) -LLOPT = -CMD = '$(CC) -c $(CFLAGS)' - -.SUFFIXES: .d .r - -.r.d:; CMD=$(CMD); export CMD; awk -f makefuns.awk $*.r | sh - touch $@ - -CSRC = nopt.c aux.c mkcalls.c outputdfa.c outcalls.c\ - findworst.c initlex.c - -SRCS = Makefile nopt.h parser.h parser.g syntax.l pseudo.r patterns $(CSRC) - -NOFILES = nopt.o dfa.o trans.o aux.o mkcalls.o - -POFILES = parser.o syntax.o outputdfa.o outcalls.o findworst.o initlex.o Lpars.o - -GENFILES = Lpars.h Lpars.c parserdummy parser.c syntax.c dfadummy\ - dfa.c dfa.c.save trans.c trans.c.save incalls.d incalls.r\ - incalls.r.save pseudo.d - -all: $(LIBOPT) - -install: all - $(INSTALL) lib/$(LIBOPT) - -cmp: all - $(COMPARE) lib/$(LIBOPT) - -pr: - @pr $(SRCS) - -opr: - make pr | opr - -clean: - rm -f C_*.o - rm -f C_*.c - rm -f $(NOFILES) $(POFILES) $(GENFILES) parser libopt.a - -$(LIBOPT): dfadummy $(NOFILES) pseudo.d incalls.d - rm -f $(LIBOPT) - ar rc $(LIBOPT) C_*.o $(NOFILES) - -sh -c 'ranlib $(LIBOPT)' - -dfadummy: patterns parser - -mv dfa.c dfa.c.save - -mv trans.c trans.c.save - -mv incalls.r incalls.r.save - -/lib/cpp patterns | $(HOWMUCH) >/tmp/patts - parser > (8*OO_WSIZE-amount))&lowmask)); -} - -OO_signsame(a,b) - int a, b; -{ - return( (a ^ b) >= 0); -} - -OO_sfit(val,nbits) - int val, nbits; -{ - long mask = 0; - int i; - for(i=nbits-1;i<8*sizeof(mask);i++) - mask |= (1<argtype != a2->argtype) return(0); - switch(a1->argtype) { - case cst_ptyp: - return(a1->acst == a2->acst); - case sof_ptyp: - if(a1->asoff != a2->asoff) return(0); - return(strcmp(a1->adnam,a2->adnam)==0); - case nof_ptyp: - if(a1->anoff != a2->anoff) return(0); - return(a1->adlb == a2->adlb); - default: - fatal("illegal type (%d) to sameext!",a1->argtype); - } -} - -OO_namsame(a1,a2) - struct instr *a1, *a2; -{ - if(a1->argtype != a2->argtype) return(0); - switch(a1->argtype) { - case cst_ptyp: - return(1); - case sof_ptyp: - return(strcmp(a1->adnam,a2->adnam)==0); - case nof_ptyp: - return(a1->adlb == a2->adlb); - default: - fatal("illegal type (%d) to samenam!",a1->argtype); - } -} - -OO_offset(a) - struct instr *a; -{ - switch(a->argtype) { - case cst_ptyp: - return(a->acst); - case sof_ptyp: - return(a->asoff); - case nof_ptyp: - return(a->anoff); - default: - fatal("illegal type (%d) to offset!",a->argtype); - } -} diff --git a/modules/src/em_opt/doc.t b/modules/src/em_opt/doc.t deleted file mode 100644 index 92aea7df0..000000000 --- a/modules/src/em_opt/doc.t +++ /dev/null @@ -1,434 +0,0 @@ -.TL -A Tour of the Peephole Optimizer Library -.AU -B. J. McKenzie -.NH -Introduction -.LP -The peephole optimizer consists of three major parts: -.IP a) -the table describing the optimization to be performed -.IP b) -a program to parse these tables and build input and output routines to -interface to the library and a dfa based routine to recognize patterns and -make the requested replacements. -.IP c) -common routines for the library that are independent of the table of a) -.LP -The library conforms to the -.I EM_CODE(3) -module interface with entry points with names like -.I C_xxx. -The library module results in calls to a module with an identical interface -but with calls to routines with names of the form -.I O_xxx. - -.LP -We shall now describe each of these in turn in some detail. - -.NH -The optimization table -.LP -The file -.I patterns -contains the patterns of EM instructions to be recognized by the optimizer -and the EM instructions to replace them. Each pattern may have an -optional restriction that must be satisfied before the replacement is made. -The syntax of the table will be described using extended BNF notation -used by -.I LLGen -where: -.DS -.I - [...] - are used to group items - | - is used to separate alternatives - ; - terminates a rule - ? - indicates item is optional - * - indicates item is repeated zero or more times - + - indicates item is repeated one or more times -.R -.DE -The format of each rule in the table is: -.DS -.I - rule : pattern global_restriction? ':' replacement - ; -.R -.DE -Each rule must be on a single line except that it may be broken after the -colon if the next line begins with a tab character. -The pattern has the syntax: -.DS -.I - pattern : [ EM_mnem [ local_restriction ]? ]+ - ; - EM-mnem : "An EM instruction mnemonic" - | 'lab' - ; -.R -.DE -and consists of a sequence of one or more EM instructions or -.I lab -which stands for a defined instruction label. Each EM-mnem may optionally be -followed by a local restriction on the argument of the mnemonic and take -one of the following forms depending on the type of the EM instruction it -follows: -.DS -.I - local_restriction : normal_restriction - | opt_arg_restriction - | ext_arg_restriction - ; -.R -.DE -A normal restriction is used after all types of EM instruction except for -those that allow an optional argument, (such as -.I adi -) or those involving external names, (such as -.I lae -) -and takes the form: -.DS -.I - normal_restriction : [ rel_op ]? expression - ; - rel_op : '==' - | '!=' - | '<=' - | '<' - | '>=' - | '>' - ; -.R -.DE -If the rel_op is missing, the equality -.I == -operator is assumed. The general form of expression is defined later but -basically it involves simple constants, references to EM_mnem arguments -that appear earlier in the pattern and expressions similar to those used -in C expressions. - -The form of the restriction after those EM instructions like -.I adi -whose arguments are optional takes the form: -.DS -.I - opt_arg_restriction : normal_restriction - | 'defined' - | 'undefined' - ; -.R -.DE -The -.I defined -and -.I undefined -indicate that the argument is present -or absent respectively. The normal restriction form implies that the -argument is present and satisfies the restriction. - -The form of the restriction after those EM instructions like -.I lae -whose arguments refer to external object take the form: -.DS -.I - ext_arg_restriction : patarg offset_part? - ; - offset_part : [ '+' | '-' ] expression - ; -.R -.DE -Such an argument has one of three forms: a offset with no name, an -offset form a name or an offset from a label. With no offset part -the restriction requires the argument to be identical to a previous -external argument. With an offset part it requires an identical name -part, (either empty, same name or same label) and supplies a relationship -among the offset parts. It is possible to refer to test for the same -external argument, the same name or to obtain the offset part of an external -argument using the -.I sameext -, -.I samenam -and -.I offset -functions given below. -.LP -The general form of an expression is: -.DS -.I - expression : expression binop expression - | unaryop expression - | '(' expression ')' - | bin_function '(' expression ',' expression ')' - | ext_function '(' patarg ',' patarg ')' - | 'offset' '(' patarg ')' - | patarg - | 'p' - | 'w' - | INTEGER - ; -.R -.DE -.DS -.I - bin_function : 'sfit' - | 'ufit' - | 'samesign' - | 'rotate' - ; -.R -.DE -.DS -.I - ext_function : 'samenam' - | 'sameext' - ; - patarg : '$' INTEGER - ; - binop : "As for C language" - unaryop : "As for C language" -.R -.DE -The INTEGER in the -.I patarg -refers to the first, second, etc. argument in the pattern and it is -required to refer to a pattern that appears earlier in the pattern -The -.I w -and -.I p -refer to the word size and pointer size (in bytes) respectively. The -various function test for: -.IP sfit 10 -the first argument fits as a signed value of -the number of bit specified by the second argument. -.IP ufit 10 -as for sfit but for unsigned values. -.IP samesign 10 -the first argument has the same sign as the second. -.IP rotate 10 -the value of the first argument rotated by the number of bit specified -by the second argument. -.IP samenam 10 -both arguments refer to externals and have either no name, the same name -or same label. -.IP sameext 10 -both arguments refer to the same external. -.IP offset 10 -the argument is an external and this yields it offset part. - -.LP -The global restriction takes the form: -.DS -.I - global_restriction : '?' expression - ; -.R -.DE -and is used to express restrictions that cannot be expressed as simple -restrictions on a single argument or are can be expressed in a more -readable fashion as a global restriction. An example of such a rule is: -.DS -.I - dup w ldl stf ? p==2*w : ldl $2 stf $3 ldl $2 lof $3 -.R -.DE -which says that this rule only applies if the pointer size is twice the -word size. - -.NH -Incompatibilities with Previous Optimizer -.LP -The current table format is not compatible with previous versions of the -peephole optimizer tables. In particular the previous table had no provision -for local restrictions and only the equivalent of the global restriction. -This meant that our -.I '?' -character that announces the presence of the optional global restriction was -not required. The previous optimizer performed a number of other tasks that -were unrelated to optimization that were possible because the old optimizer -read the EM code for a complete procedure at a time. This included task such -as register variable reference counting and moving the information regarding -the number of bytes of local storage required by a procedure from it -.I end -pseudo instruction to it's -.I pro -pseudo instruction. These tasks are no longer done. If there are required -then the must be performed by some other program in the pipeline. - -.NH -The Parser -.LP -The program to parse the tables and build the pattern table dependent dfa -routines is built from the files: -.IP parser.h 15 -header file -.IP parser.g 15 -LLGen source file defining syntax of table -.IP syntax.l 15 -Lex sources file defining form of tokens in table. -.IP initlex.c 15 -Uses the data in the library -.I em_data.a -to initialize the lexical analyser to recognize EM instruction mnemonics. -.IP outputdfa.c 15 -Routines to output dfa when it has been constructed. -.IP outcalls.c 15 -Routines to output the file -.I incalls.c -defined in section 4. -.IP findworst.c 15 -Routines to analyze patterns to find how to continue matching after a -successful replacement or failed match. - -.LP -The parser checks that the tables conform to the syntax outlined in the -previous section and also mades a number of semantic checks on their -validity. Further versions could make further checks such as looking for -cycles in the rules or checking that each replacement leaves the same -number of bytes on the stack as the pattern it replaces. The parser -builds an internal dfa representation of the rules by combining rules with -common prefixes. All local and global restrictions are combined into a single -test to be performed are a complete pattern has been detected in the input. -The idea is to build a structure so that each of the patterns can be matched -and then the corresponding tests made and the first that succeeds is replaced. -If two rules have the same pattern and both their tests also succeed the one -that appears first in the tables file will be done. Somewhat less obvious -is that id one pattern is a proper prefix of a longer pattern and its test -succeeds then the second pattern will not be checked for. - -A major task of the parser if to decide on the action to take when a rule has -been partially matched or when a pattern has been completely matched but its -test does not succeed. This requires a search of all patterns to see if any -part of the part matched could be part of some other pattern. for example -given the two patterns: -.DS -.I - loc adi w loc adi w : loc $1+$3 adi w - loc adi w loc sbi w : loc $1-$3 adi w -.R -.DE -If the first pattern fails after seeing the input: -.DS -.I - loc adi loc -.R -.DE -the parser will still need to check whether the second pattern matches. -This requires a decision on how to fix up any internal data structures in -the dfa matcher, such as moving some instructions from the pattern to the -output queue and moving the pattern along and then deciding what state -it should continue from. Similar decisions are requires after a pattern -has been replaced. For example if the replacement is empty it is necessary -to backup -.I n-1 -instructions where -.I n -is the length of the longest pattern in the tables. - -.NH -Structure of the Resulting Library - -.LP -The major data structures maintained by the library consist of three queues; -an -.I output -queue of instructions awaiting output, a -.I pattern -queue containing instructions that match the current prefix, and a -.I backup -queue of instructions that have been backed up over and need to be reparsed -for further pattern matches. - -.LP -If no errors are detected by the parser in the tables it output the following -files: -.IP dfa.c 10 -this consists of a large switch statement that maintains the current state of -the dfa and makes a transition to the next state if the next input instruction -matches. -.IP incalls.r 10 -this contains an entry for every EM instruction (plus -.I lab -) giving information on how to build a routine with the name -.I C_xxx -that conforms to the -.I EM_CODE(3) -modules interface. If the EM instruction does not appear in the tables -patterns at all then the dfa routine is called to flush any current queued -output and the the output -.I O_xxx -routine is called. If the EM instruction does appear in a pattern then the instruction is added onto the end of the pattern queue and the dfa routines called -to attempted to make a transition. This file is input to the -.I awk -program -.I makefuns.awk -to produce individual C files with names like -.I C_xxx.c -each containing a single function definition. This enables the loader to -only load those routines that are actually needed when the library is loaded. -.IP trans.c 10 -this contains a routine that is called after each transition to a state that -contains restrictions and replacements. The restrictions a converted to -C expressions and the replacements coded as calls to output instructions -into the output queue. - -.LP -The following files contain code that is independent of the pattern tables: -.IP nopt.c 10 -general routines to initialize, and maintain the data structures. -.IP aux.c 10 -routines to implement the functions used in the rules. -.IP mkcalls.c 10 -code to convert the internal data structures to calls on the output -.I O_xxx -routines when the output queue is flushed. - -.NH -Miscellaneous Issues -.LP -The size of the output and backup queues are fixed in size according to the -values of -.I MAXOUTPUT -and -.I MAXBACKUP -defined in the file -.I nopt.h. -The size of the pattern queue is set to the length of the maximum pattern -length by the tables output by the parser. The queues are implemented as -arrays of pointers to structures containing the instruction and its arguments. -The space for the structures are initially obtained by calls to -.I Malloc -(from the -.I alloc(3) -module), -and freed when the output queue or patterns queue is cleared. These freed -structures are collected on a free list and reused to avoid the overheads -of repeated calls to -.I malloc -and -.I free. - -.LP -The fixed size of the output and pattern queues causes no difficulty in -practice and can only result in some potential optimizations being missed. -When the output queue fills it is simply prematurely flushed and backups -when the backup queue is fill are simply ignored. A possible improvement -would be to flush only part of the output queue when it fills. It should -be noted that it is not possible to statically determine the maximum possible -size for these queues as they need to be unbounded in the worst case. A -study of the rule -.DS -.I - inc dec : -.R -.DE -with the input consisting of -.I N -.I inc -and then -.I N -.I dec -instructions requires an output queue length of -.I N-1 -to find all possible replacements. diff --git a/modules/src/em_opt/findworst.c b/modules/src/em_opt/findworst.c deleted file mode 100644 index 065e73a89..000000000 --- a/modules/src/em_opt/findworst.c +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef NORCSID -static char rcsid[] = "$Header$"; -#endif - -#include "parser.h" - -#define UPDATEWORST(backups) if(backups>mostbackups) mostbackups = backups; - -findworst(repl) - struct mnems repl; -{ - /* - /* Find the pattern that requires the most backup of output queue. - /* Let repl be r1 r2 ... rn. All these are already on the output queue. - /* Possibilities in order of most backup first are: - /* a) pattern of form: p1 .... pb r1 r2 .... rn pc ... pd - /* i.e. completely in pattern. - /* requires a backup of b+n instructions - /* and a goto to state 0. - /* b) pattern of form: p1 .... pb r1 r2 .... ri - /* i.e. a prefix of ends a pattern. - /* requires a backup of b+n instructions - /* and a goto to state 0. - /* c) pattern of form: ri ri+1 ... rn pc ... pd - /* i.e. a suffix of starts a pattern. - /* requires a backup of n-i+1 instructions and a goto to state 0. - */ - int n = repl.m_len; - int first,i,j; - int s; - int mostbackups = 0; - if(n==0) { - fprint(ofile,"\t\t\tOO_backup(%d);\n", longestpattern-1); - return; - } - for(s=1;s<=higheststate;s++) { - /* only match complete patterns */ - if(actions[s]==(struct action *)NULL) - continue; - /* look for case a */ - if(first=rightmatch(patterns[s],repl,1,n)) { - UPDATEWORST(first-1+n); - } - /* look for case b */ - for(i=n-1;i;i--) { - if((first=rightmatch(patterns[s],repl,1,i)) && - (first+i-1==patterns[s].m_len)) { - UPDATEWORST(first-1+n); - } - } - /* look for case c */ - for(i=2;i<=n;i++) { - if((first=leftmatch(patterns[s],repl,i,n)) && - (first==1)) { - UPDATEWORST(n-i+1); - } - } - } - if(mostbackups) - fprint(ofile,"\t\t\tOO_backup(%d);\n",mostbackups); -} - -findfail(state) - int state; -{ - /* - /* If pattern matching fails in 'state', how many outputs and how many - /* push backs are requires. If pattern is of the form p1 p2 .... pn - /* look for patterns of the form p2 p3 ... pn; then p3 p4 ... pn; etc. - /* The first such match of the form pi pi+1 ... pn requires an output - /* of p1 p2 ... pi-1 and a push back of pn pn-1 ... pi. - */ - int s,i,j; - struct state *p; - int istrans; - int n = patterns[state].m_len; - for(i=2;i<=n;i++) { - for(s=1;s<=higheststate;s++) { - /* exclude those on transitions from this state */ - istrans = 0; - for(p=states[state];p!=(struct state *)NULL;p=p->next) - if(s==p->goto_state) - istrans++; - if(istrans) - continue; - if((leftmatch(patterns[s],patterns[state],i,n)==1)&& - patterns[s].m_len==(n-i+1)) { - fprint(ofile,"\t{%d,%d,%d},",i-1,n-i+1,s); - return; - } - } - } - fprint(ofile,"\t{%d,0,0},",n); -} - -PRIVATE int -leftmatch(patt,repl,i,j) - struct mnems patt,repl; - int i,j; -{ - /* - /* Return the first complete match of the mnems of - /* 'repl' in the mnems of 'patt'. Find the leftmost match. - /* Return 0 if fails. - */ - int lenrij = j-i+1; - int lastpos = patt.m_len - lenrij + 1; - int k,n; - for(k=1;k<=lastpos;k++) { - for(n=1;n<=lenrij;n++) { - if(patt.m_elems[(k+n-1)-1]->op_code != repl.m_elems[(i+n-1)-1]->op_code) - break; - } - if(n>lenrij) { - return(k); - } - } - return(0); -} - -PRIVATE int -rightmatch(patt,repl,i,j) - struct mnems patt,repl; - int i,j; -{ - /* - /* Return the first complete match of the mnems of - /* 'repl' in the mnems of 'patt'. Find the rightmost match. - /* Return 0 if fails. - */ - int lenrij = j-i+1; - int lastpos = patt.m_len - lenrij + 1; - int k,n; - for(k=lastpos;k>=1;k--) { - for(n=1;n<=lenrij;n++) { - if(patt.m_elems[(k+n-1)-1]->op_code != repl.m_elems[(i+n-1)-1]->op_code) - break; - } - if(n>lenrij) { - return(k); - } - } - return(0); -} diff --git a/modules/src/em_opt/initlex.c b/modules/src/em_opt/initlex.c deleted file mode 100644 index ef05d206b..000000000 --- a/modules/src/em_opt/initlex.c +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef NORCSID -static char rcsid[] = "$Header$"; -#endif - -#include -#include -#include -#include "parser.h" -#define op_lab 255 - -#include - -extern char em_flag[]; -extern char em_mnem[][4]; - -initlex() -{ - register int i,j; - init_idf(); - idinit("lab",op_lab,DEFILB); - for(i=sp_fmnem;i<=sp_lmnem;i++) { - j=i-sp_fmnem; - switch(em_flag[j] & EM_PAR) { - case PAR_NO: - idinit(em_mnem[j],i,NOARG); break; - case PAR_C: - case PAR_D: - case PAR_F: - case PAR_L: - case PAR_N: - case PAR_O: - case PAR_R: - case PAR_S: - case PAR_Z: - idinit(em_mnem[j],i,CST); break; - case PAR_W: - idinit(em_mnem[j],i,CSTOPT); break; - case PAR_P: - idinit(em_mnem[j],i,PNAM); break; - case PAR_B: - idinit(em_mnem[j],i,LAB); break; - case PAR_G: - idinit(em_mnem[j],i,EXT); break; - } - } -} - -PRIVATE -idinit(tag,opcode,argfmt) - char *tag; - int opcode; - int argfmt; -{ - struct idf *p; - p = str2idf(tag,0); - p->id_nextidf = ops; /* chain into all ops */ - ops = p; - p->id_used = 0; - p->id_startpatt = 0; - p->id_opcode = opcode; - p->id_argfmt = argfmt; -} diff --git a/modules/src/em_opt/makefuns.awk b/modules/src/em_opt/makefuns.awk deleted file mode 100644 index e140fdaf4..000000000 --- a/modules/src/em_opt/makefuns.awk +++ /dev/null @@ -1,59 +0,0 @@ -BEGIN { - FS = "|"; - seenproc = 0; - CC="${CMD}" - } -/^%/ {} -/^$/ {} -/^[a-z]/ && $3 !~ /.*NOTIMPLEMENTED.*/ { - if(seenproc) { - print "}" - print "--EOF--" - printf "if %s C_%s.c\n",CC,nam - printf "then :\nelse exit 1\nfi\n" - printf "rm -f C_%s.c\n",nam - } - seenproc = 1 - $1 = substr($1,1,index($1,"\t")-1); - nam = $1 - printf "cat > C_%s.c << '--EOF--'\n",$1 - print "#include \"nopt.h\"" - printf "C_%s(",$1 - nparms = split($2,parms,":"); - for(p=1;popcode) { - case op_aar: - O_aar(p->acst); break; - case op_adf: - O_adf(p->acst); break; - case op_adi: - O_adi(p->acst); break; - case op_adp: - O_adp(p->acst); break; - case op_ads: - O_ads(p->acst); break; - case op_adu: - O_adu(p->acst); break; - case op_and: - O_and(p->acst); break; - case op_asp: - O_asp(p->acst); break; - case op_ass: - O_ass(p->acst); break; - case op_beq: - O_beq((label)p->acst); break; - case op_bge: - O_bge((label)p->acst); break; - case op_bgt: - O_bgt((label)p->acst); break; - case op_ble: - O_ble((label)p->acst); break; - case op_blm: - O_blm(p->acst); break; - case op_bls: - O_bls(p->acst); break; - case op_blt: - O_blt((label)p->acst); break; - case op_bne: - O_bne((label)p->acst); break; - case op_bra: - O_bra((label)p->acst); break; - case op_cai: - O_cai(); break; - case op_cal: - O_cal(p->apnam); break; - case op_cff: - O_cff(); break; - case op_cfi: - O_cfi(); break; - case op_cfu: - O_cfu(); break; - case op_cif: - O_cif(); break; - case op_cii: - O_cii(); break; - case op_ciu: - O_ciu(); break; - case op_cmf: - O_cmf(p->acst); break; - case op_cmi: - O_cmi(p->acst); break; - case op_cmp: - O_cmp(); break; - case op_cms: - O_cms(p->acst); break; - case op_cmu: - O_cmu(p->acst); break; - case op_com: - O_com(p->acst); break; - case op_csa: - O_csa(p->acst); break; - case op_csb: - O_csb(p->acst); break; - case op_cuf: - O_cuf(); break; - case op_cui: - O_cui(); break; - case op_cuu: - O_cuu(); break; - case op_dch: - O_dch(); break; - case op_dec: - O_dec(); break; - case op_dee: - if(p->argtype==nof_ptyp) O_dee_dlb(p->adlb, p->anoff); - else O_dee_dnam(p->adnam, p->asoff); break; - case op_del: - O_del(p->acst); break; - case op_dup: - O_dup(p->acst); break; - case op_dus: - O_dus(p->acst); break; - case op_dvf: - O_dvf(p->acst); break; - case op_dvi: - O_dvi(p->acst); break; - case op_dvu: - O_dvu(p->acst); break; - case op_exg: - O_exg(p->acst); break; - case op_fef: - O_fef(p->acst); break; - case op_fif: - O_fif(p->acst); break; - case op_fil: - Linenumber = 0; - if(p->argtype==nof_ptyp) O_fil_dlb(p->adlb, p->anoff); - else O_fil_dnam(p->adnam, p->asoff); break; - case op_gto: - if(p->argtype==nof_ptyp) O_gto_dlb(p->adlb, p->anoff); - else O_gto_dnam(p->adnam, p->asoff); break; - case op_inc: - O_inc(); break; - case op_ine: - if(p->argtype==nof_ptyp) O_ine_dlb(p->adlb, p->anoff); - else O_ine_dnam(p->adnam, p->asoff); break; - case op_inl: - O_inl(p->acst); break; - case op_inn: - O_inn(p->acst); break; - case op_ior: - O_ior(p->acst); break; - case op_lab: - Linenumber = 0; - O_df_ilb(p->alab); break; - case op_lae: - if(p->argtype==nof_ptyp) O_lae_dlb(p->adlb, p->anoff); - else O_lae_dnam(p->adnam, p->asoff); break; - case op_lal: - O_lal(p->acst); break; - case op_lar: - O_lar(p->acst); break; - case op_ldc: - O_ldc(p->acst); break; - case op_lde: - if(p->argtype==nof_ptyp) O_lde_dlb(p->adlb, p->anoff); - else O_lde_dnam(p->adnam, p->asoff); break; - case op_ldf: - O_ldf(p->acst); break; - case op_ldl: - O_ldl(p->acst); break; - case op_lfr: - O_lfr(p->acst); break; - case op_lil: - O_lil(p->acst); break; - case op_lim: - O_lim(); break; - case op_lin: - if(Linenumber && p->acst == ++Linenumber) { - O_lni(); - } - else { - O_lin(p->acst); - Linenumber = p->acst; - } - break; - case op_lni: - O_lni(); - Linenumber++; - break; - case op_loc: - O_loc(p->acst); break; - case op_loe: - if(p->argtype==nof_ptyp) O_loe_dlb(p->adlb, p->anoff); - else O_loe_dnam(p->adnam, p->asoff); break; - case op_lof: - O_lof(p->acst); break; - case op_loi: - O_loi(p->acst); break; - case op_lol: - O_lol(p->acst); break; - case op_lor: - O_lor(p->acst); break; - case op_los: - O_los(p->acst); break; - case op_lpb: - O_lpb(); break; - case op_lpi: - O_lpi(p->apnam); break; - case op_lxa: - O_lxa(p->acst); break; - case op_lxl: - O_lxl(p->acst); break; - case op_mlf: - O_mlf(p->acst); break; - case op_mli: - O_mli(p->acst); break; - case op_mlu: - O_mlu(p->acst); break; - case op_mon: - O_mon(); break; - case op_ngf: - O_ngf(p->acst); break; - case op_ngi: - O_ngi(p->acst); break; - case op_nop: - O_nop(); break; - case op_rck: - O_rck(p->acst); break; - case op_ret: - O_ret(p->acst); break; - case op_rmi: - O_rmi(p->acst); break; - case op_rmu: - O_rmu(p->acst); break; - case op_rol: - O_rol(p->acst); break; - case op_ror: - O_ror(p->acst); break; - case op_rtt: - O_rtt(); break; - case op_sar: - O_sar(p->acst); break; - case op_sbf: - O_sbf(p->acst); break; - case op_sbi: - O_sbi(p->acst); break; - case op_sbs: - O_sbs(p->acst); break; - case op_sbu: - O_sbu(p->acst); break; - case op_sde: - if(p->argtype==nof_ptyp) O_sde_dlb(p->adlb, p->anoff); - else O_sde_dnam(p->adnam, p->asoff); break; - case op_sdf: - O_sdf(p->acst); break; - case op_sdl: - O_sdl(p->acst); break; - case op_set: - O_set(p->acst); break; - case op_sig: - O_sig(); break; - case op_sil: - O_sil(p->acst); break; - case op_sim: - O_sim(); break; - case op_sli: - O_sli(p->acst); break; - case op_slu: - O_slu(p->acst); break; - case op_sri: - O_sri(p->acst); break; - case op_sru: - O_sru(p->acst); break; - case op_ste: - if(p->argtype==nof_ptyp) O_ste_dlb(p->adlb, p->anoff); - else O_ste_dnam(p->adnam, p->asoff); break; - case op_stf: - O_stf(p->acst); break; - case op_sti: - O_sti(p->acst); break; - case op_stl: - O_stl(p->acst); break; - case op_str: - O_str(p->acst); break; - case op_sts: - O_sts(p->acst); break; - case op_teq: - O_teq(); break; - case op_tge: - O_tge(); break; - case op_tgt: - O_tgt(); break; - case op_tle: - O_tle(); break; - case op_tlt: - O_tlt(); break; - case op_tne: - O_tne(); break; - case op_trp: - O_trp(); break; - case op_xor: - O_xor(p->acst); break; - case op_zeq: - O_zeq((label)p->acst); break; - case op_zer: - O_zer(p->acst); break; - case op_zge: - O_zge((label)p->acst); break; - case op_zgt: - O_zgt((label)p->acst); break; - case op_zle: - O_zle((label)p->acst); break; - case op_zlt: - O_zlt((label)p->acst); break; - case op_zne: - O_zne((label)p->acst); break; - case op_zre: - if(p->argtype==nof_ptyp) O_zre_dlb(p->adlb, p->anoff); - else O_zre_dnam(p->adnam, p->asoff); break; - case op_zrf: - O_zrf(p->acst); break; - case op_zrl: - O_zrl(p->acst); break; - } -} diff --git a/modules/src/em_opt/nopt.c b/modules/src/em_opt/nopt.c deleted file mode 100644 index 636d3a297..000000000 --- a/modules/src/em_opt/nopt.c +++ /dev/null @@ -1,419 +0,0 @@ -#ifndef NORCSID -static char rcsid[] = "$Header$"; -#endif - -#include "nopt.h" -extern int maxpattern; /* Initialized from patterns in dfa.c */ -#define MAXBACKUP 50 -#define MAXOUTPUT 200 -#define MAXFREEI 200 -#define MAXSTRING 1000 - -#define GETINSTR() (nextifree>freeiqueue)?*(--nextifree):\ - ((struct instr *)Malloc(sizeof(struct instr))) - -extern char em_mnem[][4]; - -struct instr **OO_patternqueue; -struct instr **OO_nxtpatt; -struct instr **OO_bkupqueue; -struct instr **OO_nxtbackup; - -static char *filename; -static struct instr **lastbackup; -static struct instr **outputqueue; -static struct instr **nextoutput; -static struct instr **lastoutput; -static struct instr **freeiqueue; -static struct instr **nextifree; -static struct instr **lastifree; -static char *strqueue; -static char *nextstr; -static char *laststr; - -int OO_noutput; /* number of instructions in output queue */ -int OO_WSIZE; /* wordlength */ -int OO_PSIZE; /* pointer length */ - -#ifdef STATS -int OO_wrstats = 1; /* pattern statistics output */ -#endif - -C_init(wsize,psize) - arith wsize, psize; -{ - allocmem(); - O_init(wsize,psize); - OO_WSIZE = wsize; - OO_PSIZE = psize; -} - -C_open(fname) - char *fname; -{ - filename = fname; - return(O_open(fname)); -} - -C_magic() -{ - O_magic(); -} - -C_close() -{ - O_close(); -} - -PRIVATE -fatal(s,a) - char *s; - int a; -{ - fprint(STDERR, "%s: ", filename ? filename : "standard input"); - fprint(STDERR,s,a); - fprint(STDERR,"\n"); - sys_stop(S_EXIT); -} - -PRIVATE -allocmem() -{ - /* Allocate memory for queues on heap */ - OO_nxtpatt = OO_patternqueue = - (struct instr **)Malloc(maxpattern*sizeof(struct instr *)); - OO_nxtbackup = OO_bkupqueue = - (struct instr **)Malloc(MAXBACKUP*sizeof(struct instr *)); - lastbackup = OO_bkupqueue + MAXBACKUP - 1; - nextoutput = outputqueue = - (struct instr **)Malloc(MAXOUTPUT*sizeof(struct instr *)); - lastoutput = outputqueue + MAXOUTPUT - 1; - OO_noutput = 0; - nextifree = freeiqueue = - (struct instr **)Malloc(MAXFREEI*sizeof(struct instr *)); - lastifree = freeiqueue + MAXFREEI - 1; - nextstr = strqueue = - (char *)Malloc(MAXSTRING*sizeof(char)); - laststr = strqueue + MAXSTRING - 1; -} - -OO_free(p) - struct instr *p; -{ - if(nextifree > lastifree) { -#ifdef DEBUG - fprint(STDERR,"Warning: Overflow of free intr. queue.\n"); - fprint(STDERR,"Ignored free of "); - prtinst(p); - fprint(STDERR,"\n"); - printstate("Freea overflow"); -#endif - return; - } - *nextifree++ = p; -} - -PRIVATE char * -freestr(s) - char *s; -{ - char *res = nextstr; - while(*nextstr++ = *s++); - if(nextstr > laststr) { - fprint(STDERR,"string space overflowed!\n"); - sys_stop(S_EXIT); - } - return(res); -} - -OO_flush() -{ - /* - /* Output all instructions waiting in the output queue and free their - /* storage including the saved strings. - */ - struct instr **p; -#ifdef DEBUG - printstate("Flush"); -#endif - if(OO_noutput) { - for(p=outputqueue;popcode = opcode; - p->argtype = none_ptyp; - OO_out(p); -} - -OO_inop(opcode) - int opcode; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = none_ptyp; - *OO_nxtpatt++ = p; -} - -OO_outcst(opcode,cst) - int opcode,cst; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = cst_ptyp; - p->acst = cst; - OO_out(p); -} - -OO_incst(opcode,cst) - int opcode,cst; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = cst_ptyp; - p->acst = cst; - *OO_nxtpatt++ = p; -} - -OO_outlab(opcode,lab) - int opcode,lab; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = cst_ptyp; - p->acst = lab; - OO_out(p); -} - -OO_inlab(opcode,lab) - int opcode,lab; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = cst_ptyp; - p->acst = lab; - *OO_nxtpatt++ = p; -} - -OO_outpnam(opcode,pnam) - int opcode; - char *pnam; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = pro_ptyp; - p->apnam = pnam; - OO_out(p); -} - -OO_inpnam(opcode,pnam) - int opcode; - char *pnam; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = pro_ptyp; - p->apnam = freestr(pnam); - *OO_nxtpatt++ = p; -} - -OO_outdefilb(opcode,deflb) - int opcode; - label deflb; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = lab_ptyp; - p->alab = deflb; - OO_out(p); -} - -OO_indefilb(opcode,deflb) - int opcode; - label deflb; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = lab_ptyp; - p->alab = deflb; - *OO_nxtpatt++ = p; -} - -OO_outext(opcode,arg,soff) - int opcode; - struct instr *arg; - int soff; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - switch(p->argtype = arg->argtype) { - case cst_ptyp: - p->acst = soff; - break; - case sof_ptyp: - p->adnam = arg->adnam; - p->asoff = soff; - break; - case nof_ptyp: - p->adlb = arg->adlb; - p->anoff = soff; - break; - default: - fatal("Unexpected type %d in outext",arg->argtype); - } - OO_out(p); -} - -OO_indnam(opcode,name,off) - int opcode; - char *name; - int off; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = sof_ptyp; - p->adnam = freestr(name); - p->asoff = off; - *OO_nxtpatt++ = p; -} - -OO_indlb(opcode,lab,off) - int opcode; - label lab; - int off; -{ - register struct instr *p = GETINSTR(); - p->opcode = opcode; - p->argtype = nof_ptyp; - p->adlb = lab; - p->anoff = off; - *OO_nxtpatt++ = p; -} - -OO_out(p) - struct instr *p; -{ - /* Put the instruction p on the output queue */ - if(nextoutput > lastoutput) { -#ifdef DEBUG - fprint(STDERR,"Warning: Overflow of outputqueue - output flushed\n"); -#endif - OO_flush(); - } - OO_noutput++; - *nextoutput++ = p; -} - -OO_pushback(p) - struct instr *p; -{ - /* push instr. p onto bkupqueue */ - if(OO_nxtbackup > lastbackup) { -#ifdef DEBUG - fprint(STDERR,"Warning: Overflow of bkupqueue-backup ignored\n"); - printstate("Backup overflow"); -#endif - return; - } - *OO_nxtbackup++ = p; -} - -OO_backup(n) - int n; -{ - /* copy (up to) n instructions from output to backup queues */ - while(n-- && nextoutput>outputqueue) { - OO_pushback(*(--nextoutput)); - OO_noutput--; - } -} - -OO_dodefault(numout, numcopy) - int numout, numcopy; -{ - register struct instr **p,**q; - q = (p = OO_patternqueue) + numout; - while(numcopy--) { - if(numout) { - numout--; - OO_out(*p); - } - *p++ = *q++; - } - OO_nxtpatt = p; - while(numout--) OO_out(*p++); -} - -#ifdef DEBUG -PRIVATE -printstate(mess) - char *mess; -{ - struct instr **p; - fprint(STDERR,"%s - state: ",mess); - p = outputqueue; - while(popcode) { - default: - fprint(STDERR,"%s",em_mnem[p->opcode-sp_fmnem]); - break; - case OTHER: - fprint(STDERR,"OTHER"); - break; - case op_lab: - break; - } - switch(p->argtype) { - case none_ptyp: - fprint(STDERR," "); - break; - case cst_ptyp: - fprint(STDERR," %d ",p->acst); - break; - case lab_ptyp: - fprint(STDERR,"%d: ",p->alab); - break; - case nof_ptyp: - fprint(STDERR," .%d+%d ",p->adlb,p->asoff); - break; - case sof_ptyp: - fprint(STDERR," %s+%d ",p->adnam,p->asoff); - break; - case ilb_ptyp: - fprint(STDERR," *%d ",p->alab); - break; - case pro_ptyp: - fprint(STDERR," $%s ",p->apnam); - break; - default: - fatal(" prtinst - Unregognized arg %d ",p->argtype); - } -} -#endif diff --git a/modules/src/em_opt/nopt.h b/modules/src/em_opt/nopt.h deleted file mode 100644 index a7c2b7dc4..000000000 --- a/modules/src/em_opt/nopt.h +++ /dev/null @@ -1,69 +0,0 @@ -/* $Header$ */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define NULL 0 -#define FLUSHDFA() if(OO_state) { OO_inop(OTHER); OO_dfa(OTHER); } \ - else if(OO_noutput) OO_flush(); -#define NEXTEM() ((OO_nxtbackup>OO_bkupqueue)?\ - ((*OO_nxtpatt++ = *(--OO_nxtbackup))->opcode):\ - 0) - -#define op_lab 255 -#define OTHER 254 -#define none_ptyp 0 - - -struct e_instr *EM_getinstr(); - -struct instr { - int opcode; - int argtype; - union { - arith cst; - label lab; - char *pnam; - struct { - label dlb; - arith noff; - } ndlb; - struct { - char *dnam; - arith soff; - } sdlb; - } val; -#define acst val.cst -#define alab val.lab -#define apnam val.pnam -#define adlb val.ndlb.dlb -#define anoff val.ndlb.noff -#define adnam val.sdlb.dnam -#define asoff val.sdlb.soff -}; - -extern struct instr **OO_patternqueue; -extern struct instr **OO_nxtpatt; -extern struct instr **OO_bkupqueue; -extern struct instr **OO_nxtbackup; -extern int OO_state; -extern int OO_noutput; /* number of instructions in output queue */ -extern int OO_WSIZE; /* wordlength */ -extern int OO_PSIZE; /* pointer length */ -#ifdef STATS -extern int OO_wrstats; /* statistics output */ -#endif - -#define CST(p) (p->acst) -#define PNAM(p) (p->apnam) -#define LAB(p) (p->alab) -#define DEFILB(p) (p->alab) diff --git a/modules/src/em_opt/outcalls.c b/modules/src/em_opt/outcalls.c deleted file mode 100644 index 30830dde2..000000000 --- a/modules/src/em_opt/outcalls.c +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef NORCSID -static char rcsid[] = "$Header$"; -#endif - -#include "parser.h" - -outputincalls() -{ - struct idf *op; - int opcode; - char *s; - if(!sys_open("incalls.r",OP_WRITE,&ofile)) { - fprint(STDERR,"Fatal Error: cannot open output file incalls.r\n"); - sys_stop(S_EXIT); - } - for(op=ops;op!=(struct idf *)NULL;op=op->id_nextidf) { - opcode = op->id_opcode; - s = op->id_text; - switch(op->id_argfmt) { - case NOARG: - fprint(ofile,"%s\t|\t|\n",s); - if(op->id_used) { - fprint(ofile,"\tOO_inop(op_%s);\n",s); - fprint(ofile,"\tOO_dfa(op_%s);\n",s); - } - else { - fprint(ofile,"\tFLUSHDFA();\n"); - fprint(ofile,"\tO_%s();\n",s); - } - break; - case CSTOPT: - fprint(ofile,"%s_narg\t|\t|\n",s); - if(op->id_used) { - fprint(ofile,"\tOO_inop(op_%s);\n",s); - fprint(ofile,"\tOO_dfa(op_%s);\n",s); - } - else { - fprint(ofile,"\tFLUSHDFA();\n"); - fprint(ofile,"\tO_%s_narg();\n",s); - } - /* fall thru */ - case CST: - fprint(ofile,"%s\t| int:n\t|\n",s); - if(op->id_used) { - fprint(ofile,"\tOO_incst(op_%s,n);\n",s); - fprint(ofile,"\tOO_dfa(op_%s);\n",s); - } - else { - fprint(ofile,"\tFLUSHDFA();\n"); - fprint(ofile,"\tO_%s(n);\n",s); - } - break; - case DEFILB: - fprint(ofile,"df_ilb\t| label:l\t|\n"); - if(op->id_used) { - fprint(ofile,"\tOO_indefilb(op_%s,l);\n",s); - fprint(ofile,"\tOO_dfa(op_%s);\n",s); - } - else { - fprint(ofile,"\tFLUSHDFA();\n"); - fprint(ofile,"\tO_df_ilb(l);\n",s); - } - break; - case PNAM: - fprint(ofile,"%s\t| char *:s\t|\n",s); - if(op->id_used) { - fprint(ofile,"\tOO_inpnam(op_%s,s);\n",s); - fprint(ofile,"\tOO_dfa(op_%s);\n",s); - } - else { - fprint(ofile,"\tFLUSHDFA();\n"); - fprint(ofile,"\tO_%s(s);\n",s); - } - break; - case LAB: - fprint(ofile,"%s\t| label:l\t|\n",s); - if(op->id_used) { - fprint(ofile,"\tOO_inlab(op_%s,l);\n",s); - fprint(ofile,"\tOO_dfa(op_%s);\n",s); - } - else { - fprint(ofile,"\tFLUSHDFA();\n"); - fprint(ofile,"\tO_%s(l);\n",s); - } - break; - case EXT: - fprint(ofile,"%s\t| int:n\t|\n",s); - if(op->id_used) { - fprint(ofile,"\tOO_incst(op_%s,n);\n",s); - fprint(ofile,"\tOO_dfa(op_%s);\n",s); - } - else { - fprint(ofile,"\tFLUSHDFA();\n"); - fprint(ofile,"\tO_%s(n);\n",s); - } - fprint(ofile,"%s_dnam\t| char *:s int:n\t|\n",s); - if(op->id_used) { - fprint(ofile,"\tOO_indnam(op_%s,s,n);\n",s); - fprint(ofile,"\tOO_dfa(op_%s);\n",s); - } - else { - fprint(ofile,"\tFLUSHDFA();\n"); - fprint(ofile,"\tO_%s_dnam(s,n);\n",s); - } - fprint(ofile,"%s_dlb\t| label:l int:n\t|\n",s); - if(op->id_used) { - fprint(ofile,"\tOO_indlb(op_%s,l,n);\n",s); - fprint(ofile,"\tOO_dfa(op_%s);\n",s); - } - else { - fprint(ofile,"\tFLUSHDFA();\n"); - fprint(ofile,"\tO_%s_dlb(l,n);\n",s); - } - break; - } - } -} diff --git a/modules/src/em_opt/outputdfa.c b/modules/src/em_opt/outputdfa.c deleted file mode 100644 index b5efa62d1..000000000 --- a/modules/src/em_opt/outputdfa.c +++ /dev/null @@ -1,390 +0,0 @@ -#ifndef NORCSID -static char rcsid[] = "$Header$"; -#endif - -#include "parser.h" -#include "Lpars.h" - -File *ofile; - -outputnopt() -{ - if(!sys_open("dfa.c",OP_WRITE,&ofile)) { - fprint(STDERR,"Couldn't open dfa.c for output\n"); - sys_stop(S_EXIT); - } - outheaders(); - outtables(); - outdfa(); - outdodefault(); - outdotrans(); - outputincalls(); -} - -PRIVATE -outheaders() -{ - fprint(ofile,"#include \"nopt.h\"\n"); - fprint(ofile,"\n"); - fprint(ofile,"int maxpattern = %d;\n", longestpattern); - fprint(ofile,"\n"); -} - -PRIVATE -outtables() -{ - int s; - fprint(ofile,"static struct defact {\n"); - fprint(ofile,"\tint numoutput;\n"); - fprint(ofile,"\tint numcopy;\n"); - fprint(ofile,"\tint nextstate;\n"); - fprint(ofile,"} defaultactions[] = {\n"); - for(s=0;s<=higheststate;s++) { - findfail(s); - if(s%4==3) - fprint(ofile,"\n"); - } - fprint(ofile,"};\n"); - fprint(ofile,"\n"); -} - -PRIVATE -outdfa() -{ - int s; - struct idf *op; - struct state *p; - fprint(ofile,"int OO_state = 0;\n"); - fprint(ofile,"\n"); - fprint(ofile,"OO_dfa(last) int last; {\n"); - fprint(ofile,"\twhile(last) {\n"); - fprint(ofile,"\t\tswitch(last) {\n"); - for(op=ops;op!=(struct idf *)NULL;op=op->id_nextidf) { - if(!op->id_used) - continue; - fprint(ofile,"\t\tcase op_%s:\n",op->id_text); - fprint(ofile,"\t\t\tswitch(OO_state) {\n"); - if(!op->id_startpatt) { - fprint(ofile,"\t\t\tcase 0: "); - fprint(ofile,"OO_out(*--OO_nxtpatt); "); - fprint(ofile,"break;\n"); - } - for(s=0;s<=higheststate;s++) - for(p=states[s];p!=(struct state *)NULL;p=p->next) { - if(p->op==op) { - fprint(ofile,"\t\t\tcase %d: ",s); - if(actions[p->goto_state]==(struct action *)NULL) - fprint(ofile,"OO_state = %d; ",p->goto_state); - else fprint(ofile,"OO_dotrans(%d); ",p->goto_state); - fprint(ofile,"break;\n"); - } - } - fprint(ofile,"\t\t\tdefault: dodefaultaction(); break;\n"); - fprint(ofile,"\t\t\t}\n"); - fprint(ofile,"\t\t\tbreak;\n"); - } - fprint(ofile,"\t\tdefault:\n"); - fprint(ofile,"\t\t\tif(OO_state) dodefaultaction();\n"); - fprint(ofile,"\t\t\telse {\n"); - fprint(ofile,"\t\t\t\tOO_flush();\n"); - fprint(ofile,"\t\t\t\tOO_mkcalls(*--OO_nxtpatt);\n"); - fprint(ofile,"\t\t\t\tOO_free(*OO_nxtpatt);\n"); - fprint(ofile,"\t\t\t}\n"); - fprint(ofile,"\t\t\tbreak;\n"); - fprint(ofile,"\t\tcase OTHER:\n"); - fprint(ofile,"\t\t\tif(OO_state) dodefaultaction();\n"); - fprint(ofile,"\t\t\telse {\n"); - fprint(ofile,"\t\t\t\tOO_flush();\n"); - fprint(ofile,"\t\t\t\tOO_free(*--OO_nxtpatt);\n"); - fprint(ofile,"\t\t\t}\n"); - fprint(ofile,"\t\t\tbreak;\n"); - fprint(ofile,"\t\t}\n"); - fprint(ofile,"\tlast = NEXTEM();\n"); - fprint(ofile,"\t}\n"); - fprint(ofile,"}\n"); -} - -PRIVATE -outmnems(l) - struct mnems l; -{ - int i; - for(i=1;i<=l.m_len;i++) - fprint(ofile,"%s ",l.m_elems[i-1]->op_code->id_text); -} - -PRIVATE -outdotrans() -{ - int s; - int i; - struct state *p; - struct action *a; - int seennontested; - if(!sys_open("trans.c",OP_WRITE,&ofile)) { - fprint(STDERR,"Fatal Error: cannot open output file trans.c\n"); - sys_stop(S_EXIT); - } - fprint(ofile,"#include \"nopt.h\"\n\n"); - fprint(ofile,"\nOO_dotrans(s) int s; {\n"); - fprint(ofile,"\tregister struct instr **patt = OO_patternqueue;\n"); - fprint(ofile,"\tswitch(OO_state=s) {\n"); - fprint(ofile,"\tdefault: return;\n"); - for(s=0;s<=higheststate;s++) - if(actions[s]!=(struct action *)NULL) { - fprint(ofile,"\tcase %d: /*",s); - outmnems(patterns[s]); - fprint(ofile," */\n"); - seennontested=0; - for(a=actions[s];a!=(struct action *)NULL;a=a->next) { - if(a->test!=(struct exp_node *)NULL) { - fprint(ofile,"\t\tif("); - outexp(a->test,s); - fprint(ofile,") {\n"); - outoneaction(s,a); - fprint(ofile,"\t\t\tgoto free%d;\n",patterns[s].m_len); - fprint(ofile,"\t\t}\n"); - } - else { - if(seennontested) { - fprint(STDERR,"parser: more than one untested action on state %d\n",s); - nerrors++; - } - seennontested++; - outoneaction(s,a); - fprint(ofile,"\t\t\tgoto free%d;\n",patterns[s].m_len); - } - } - if(!seennontested) - fprint(ofile,"\t\treturn;\n"); - } - fprint(ofile,"\t}\n"); - for(i=longestpattern;i>0;i--) - fprint(ofile," free%d: OO_free(*--OO_nxtpatt);\n",i); - fprint(ofile," free0: ;\n"); - fprint(ofile,"\tOO_state=0;\n"); - fprint(ofile,"}\n"); - fprint(ofile,"\n"); -} - -PRIVATE -outdodefault() -{ - fprint(ofile,"\nstatic dodefaultaction() {\n"); - fprint(ofile,"\tregister struct defact *p = &defaultactions[OO_state];\n"); - fprint(ofile,"\tOO_pushback(*--OO_nxtpatt);\n"); - fprint(ofile,"\tOO_dodefault(p->numoutput,p->numcopy);\n"); - fprint(ofile,"\tOO_dotrans(p->nextstate);\n"); - fprint(ofile,"}\n"); -} - -PRIVATE -outoneaction(s,a) - int s; - struct action *a; -{ - fprint(ofile,"\t\t/* "); - fprint(ofile," -> "); - outmnems(a->replacement); - fprint(ofile," */\n"); - fprint(ofile,"#ifdef STATS\n"); - fprint(ofile,"\t\t\tif(OO_wrstats) fprint(STDERR,\"%d\\n\");\n",a->linenum); - fprint(ofile,"#endif\n"); - outrepl(s,patterns[s],a->replacement); - findworst(a->replacement); -} - -PRIVATE -outrepl(state,patt,repl) - int state; - struct mnems patt,repl; -{ - /* - /* Contruct =r1 r2 ... rn and put on output queue. - */ - int n = repl.m_len; - int m = patt.m_len; - int i,j,count; - for(i=1;i<=n;i++) { - struct mnem_elem *ri = repl.m_elems[i-1]; - char *mnem = ri->op_code->id_text; - switch(ri->op_code->id_argfmt) { - case NOARG: - fprint(ofile,"\t\t\tOO_outop(op_%s);\n",mnem); - break; - case CST: - case CSTOPT: - fprint(ofile,"\t\t\tOO_outcst(op_%s,",mnem); - outexp(ri->arg,state); - fprint(ofile,");\n"); - break; - case LAB: - fprint(ofile,"\t\t\tOO_outlab(op_%s,",mnem); - outexp(ri->arg,state); - fprint(ofile,");\n"); - break; - case DEFILB: - fprint(ofile,"\t\t\tOO_outdefilb(op_%s,",mnem); - outexp(ri->arg,state); - fprint(ofile,");\n"); - break; - case PNAM: - fprint(ofile,"\t\t\tOO_outpnam(op_%s,",mnem); - outexp(ri->arg,state); - fprint(ofile,");\n"); - break; - case EXT: - fprint(ofile,"\t\t\tOO_outext(op_%s,",mnem); - outexp(ri->arg,state); - fprint(ofile,");\n"); - break; - } - } -} - -PRIVATE -outexp(e,state) - struct exp_node *e; - int state; -{ - switch(e->node_type) { - case LOGAND: - case LOGOR: - case BITAND: - case BITOR: - case XOR: - case MINUS: - case PLUS: - case TIMES: - case DIV: - case MOD: - case EQ: - case NE: - case LT: - case LE: - case GT: - case GE: - case LSHIFT: - case RSHIFT: - fprint(ofile,"("); - outexp(e->exp_left,state); - outop(e->node_type); - outexp(e->exp_right,state); - fprint(ofile,")"); - break; - case NOT: - case COMP: - case UPLUS: - case UMINUS: - fprint(ofile,"("); - outop(e->node_type); - outexp(e->exp_left,state); - fprint(ofile,")"); - break; - case DEFINED: - fprint(ofile,"(patt[%d]->argtype!=none_ptyp)",e->leaf_val-1); - break; - case UNDEFINED: - fprint(ofile,"(patt[%d]->argtype==none_ptyp)",e->leaf_val-1); - break; - case COMMA: - outext(e->exp_left); - fprint(ofile,","); outexp(e->exp_right,state); - break; - case SAMESIGN: - case SFIT: - case UFIT: - case ROTATE: - outop(e->node_type); - outexp(e->exp_left,state); - fprint(ofile,","); - outexp(e->exp_right,state); - fprint(ofile,")"); - break; - case SAMEEXT: - case SAMENAM: - outop(e->node_type); - outext(e->exp_left); - fprint(ofile,","); - outext(e->exp_right,state); - fprint(ofile,")"); - break; - case PATARG: - switch(patterns[state].m_elems[e->leaf_val-1]->op_code->id_argfmt) { - case NOARG: - fprint(STDERR,"error: mnem %d has no argument\n",e->leaf_val); - nerrors++; - break; - case CST: - case CSTOPT: - fprint(ofile,"CST(patt[%d])",e->leaf_val-1); - break; - case LAB: - fprint(ofile,"LAB(patt[%d])",e->leaf_val-1); - break; - case DEFILB: - fprint(ofile,"DEFILB(patt[%d])",e->leaf_val-1); - break; - case PNAM: - fprint(ofile,"PNAM(patt[%d])",e->leaf_val-1); - break; - case EXT: - fprint(ofile,"OO_offset(patt[%d])",e->leaf_val-1); - break; - } - break; - case PSIZE: - fprint(ofile,"OO_PSIZE"); break; - case WSIZE: - fprint(ofile,"OO_WSIZE"); break; - case INT: - fprint(ofile,"%d",e->leaf_val); break; - } -} - -PRIVATE -outext(e) - struct exp_node *e; -{ - if(e->node_type!=PATARG) { - fprint(STDERR,"Internal error in outext of parser\n"); - nerrors++; - } - fprint(ofile,"patt[%d]",e->leaf_val-1); -} - -PRIVATE -outop(op) - int op; -{ - switch(op) { - case LOGAND: fprint(ofile,"&&"); break; - case LOGOR: fprint(ofile,"||"); break; - case BITAND: fprint(ofile,"&"); break; - case BITOR: fprint(ofile,"|"); break; - case XOR: fprint(ofile,"^"); break; - case MINUS: fprint(ofile,"-"); break; - case PLUS: fprint(ofile,"+"); break; - case TIMES: fprint(ofile,"*"); break; - case DIV: fprint(ofile,"/"); break; - case MOD: fprint(ofile,"%%"); break; - case EQ: fprint(ofile,"=="); break; - case NE: fprint(ofile,"!="); break; - case LT: fprint(ofile,"<"); break; - case LE: fprint(ofile,"<="); break; - case GT: fprint(ofile,">"); break; - case GE: fprint(ofile,">="); break; - case LSHIFT: fprint(ofile,"<<"); break; - case RSHIFT: fprint(ofile,">>"); break; - case NOT: fprint(ofile,"!"); break; - case COMP: fprint(ofile,"~"); break; - case UPLUS: fprint(ofile,"+"); break; - case UMINUS: fprint(ofile,"-"); break; - case SAMESIGN: fprint(ofile,"OO_signsame("); break; - case SFIT: fprint(ofile,"OO_sfit("); break; - case UFIT: fprint(ofile,"OO_ufit("); break; - case ROTATE: fprint(ofile,"OO_rotate("); break; - case SAMEEXT: fprint(ofile,"OO_extsame("); break; - case SAMENAM: fprint(ofile,"OO_namsame("); break; - } -} diff --git a/modules/src/em_opt/parser.g b/modules/src/em_opt/parser.g deleted file mode 100644 index 8573236ca..000000000 --- a/modules/src/em_opt/parser.g +++ /dev/null @@ -1,496 +0,0 @@ -/* $Header$ */ -/* Parser to read optimization patterns of the form: - op1 op2 ... test : action - or - op1 op2 ... : action - and build a program to recognize then */ - -%token SFIT, UFIT, ROTATE, PSIZE, WSIZE, DEFINED, UNDEFINED, SAMESIGN; -%token SAMEEXT, SAMENAM, OFFSET, LOGAND, LOGOR, BITAND, BITOR, XOR; -%token MINUS, PLUS, TIMES, DIV, MOD, EQ, NE, LT, LE, GT, GE, NOT, COMP; -%token LSHIFT, RSHIFT, COMMA, OPCODE, INT, UPLUS, UMINUS, PATARG; - -%start parser, input; - -{ -#include "parser.h" - -#define MAXPRIO 11 - -struct state *states[MAXSTATES]; -struct action *actions[MAXSTATES]; -struct mnems patterns[MAXSTATES]; -int higheststate = 0; /* Highest state yet allocated */ -struct idf *ops; /* Chained list of all ops */ -int longestpattern = 0; -int nerrors = 0; - -static int lencurrpatt; -static int lenthisrepl; -static int currentstate; /* Current state of dfa */ -} - -input : /* empty */ - | optimization input - ; - -optimization - { - int startline; - struct exp_node *restrictions; - struct exp_node *finaltest; - struct mnem_list *repllist; - } - : - { - startline=linenum; currentstate=0; - lencurrpatt=0; lenthisrepl=0; - } - patterns(&restrictions) - { finaltest = (struct exp_node *)NULL; } - [ - '?' - exp(1,&finaltest) - ]? - ':' - action(&repllist) - { - addaction(startline,currentstate,restrictions, - finaltest,repllist); - } - '\n' - ; - -patterns(struct exp_node **tests;) - { struct mnem_list *list; - struct exp_node *pair1, *pair2; - struct exp_node *onetest; int argtype; } - : - { - list = (struct mnem_list *)NULL; - *tests = (struct exp_node *)NULL; - } - [ - OPCODE - { - if(++lencurrpatt>longestpattern) - longestpattern=lencurrpatt; - list = addelem(list,opval, (struct exp_node *)NULL); - opval->id_used=1; - if(lencurrpatt==1) - opval->id_startpatt=1; - currentstate=dotransition(currentstate,opval,list,lencurrpatt); - } - [ - restriction(opval->id_argfmt,&onetest) - { - *tests = combinetests(*tests,onetest); - } - ]? - ]+ - ; - -restriction(int argtype; struct exp_node **test;) - { - struct exp_node *test1,*test2; - int relop; - int offsetop; - } - : - [ %if(argtype==CSTOPT) - [ optrelop(&relop) exp(1,test) - { - *test = mknode(relop,mkleaf(PATARG,lencurrpatt),*test); - *test = mknode(LOGAND, - mkleaf(DEFINED,lencurrpatt), - *test); - } - | DEFINED - { - *test = mkleaf(DEFINED,lencurrpatt); - } - | UNDEFINED - { - *test = mkleaf(UNDEFINED,lencurrpatt); - } - ] - | %if(argtype==EXT) - patarg(&test1) - { - *test=mknode(SAMEEXT, - mkleaf(PATARG,lencurrpatt), - test1); - } - [ - [ PLUS - { offsetop = PLUS; } - | MINUS - { offsetop = MINUS; } - ] - exp(1,&test2) - { - test2 = mknode(offsetop, test1, test2); - test2 = mknode(EQ, mkleaf(PATARG,lencurrpatt), test2); - *test = combinetests( - mknode(SAMENAM, - mkleaf(PATARG,lencurrpatt), - test1), - test2); - } - ]? - | - optrelop(&relop) exp(1,test) - { - *test = mknode(relop,mkleaf(PATARG,lencurrpatt),*test); - } - ] - ; - -optrelop(int *op;) - : - {*op = EQ;} - [ EQ {*op = EQ;} - | NE {*op = NE;} - | LT {*op = LT;} - | LE {*op = LE;} - | GT {*op = GT;} - | GE {*op = GE;} - ]? - ; -action(struct mnem_list **list;) - { - struct exp_node *test, *test2; - struct idf *keepopval; - int offsetop; - } - : - { *list = (struct mnem_list *)NULL; } - [ - OPCODE - { - lenthisrepl++; - test= (struct exp_node *)NULL; - keepopval = opval; - } - [ %if(keepopval->id_argfmt==EXT) - patarg(&test) - { - test2 = test; - } - [ - [ PLUS - { offsetop = PLUS; } - | MINUS - { offsetop = MINUS; } - ] - exp(1,&test2) - { - test2 = mknode(offsetop,test,test2); - } - - ]? - { - test = mknode(COMMA,test,test2); - } - | exp(1,&test) - ]? - { - *list = addelem(*list,keepopval,test); - } - ]* - ; - -exp(int level; struct exp_node **result;) - { struct exp_node *res1, *res2; - int operator, intval; } - : - %if(level <= MAXPRIO) - exp(MAXPRIO+1,&res1) - [ %while (priority(LLsymb) >= level) - binop - { - operator=LLsymb; - } - exp(priority(operator)+1,&res2) - { - res1 = mknode(operator,res1,res2); - } - ]* - { - *result = res1; - } - | '(' exp(1,result) ')' - | unaryop(&operator) exp(priority(operator)+1,&res1) - { - *result = mknode(operator,res1,(struct exp_node *)NULL); - } - | SAMESIGN '(' exp(1,&res1) COMMA exp(1,&res2) ')' - { - *result = mknode(SAMESIGN,res1,res2); - } - | SFIT '(' exp(1,&res1) COMMA exp(1,&res2) ')' - { - *result = mknode(SFIT,res1,res2); - } - | UFIT '(' exp(1,&res1) COMMA exp(1,&res2) ')' - { - *result = mknode(UFIT,res1,res2); - } - | ROTATE '(' exp(1,&res1) COMMA exp(1,&res2) ')' - { - *result = mknode(ROTATE,res1,res2); - } - | SAMEEXT '(' patarg(&res1) COMMA patarg(&res2) ')' - { - *result = mknode(SAMEEXT,res1,res2); - } - | SAMENAM '(' patarg(&res1) COMMA patarg(&res2) ')' - { - *result = mknode(SAMENAM,res1,res2); - } - | OFFSET '(' patarg(&res1) ')' - { - *result = res1; - } - | patarg(result) - | PSIZE - { - *result = mkleaf(PSIZE,0); - } - | WSIZE - { - *result = mkleaf(WSIZE,0); - } - | INT - { - *result = mkleaf(INT,lastintval); - } - ; - -patarg(struct exp_node **result;) - { int intval; } - : PATARG argno(&intval) - { - *result = mkleaf(PATARG,intval); - } - ; - -argno(int *val;) - : INT - { - *val = lastintval; - if(lastintval<0 || (lastintval>lencurrpatt)) { - fprint(STDERR ,"Illegal $%d on line %d\n", - lastintval,linenum); - nerrors++; - } - } - ; - -unaryop(int *operator;) - : PLUS { *operator = UPLUS; } - | MINUS { *operator = UMINUS; } - | NOT { *operator = NOT; } - | COMP { *operator = COMP; } - ; - -binop : LOGAND - | LOGOR - | BITAND - | BITOR - | XOR - | MINUS - | PLUS - | TIMES - | DIV - | MOD - | EQ - | NE - | LT - | LE - | GT - | GE - | LSHIFT - | RSHIFT - ; - -%lexical yylex; - -{ -addaction(startline, state, restrictions, finaltest, repllist) - int startline; - int state; - struct exp_node *restrictions, *finaltest; - struct mnem_list *repllist; -{ - struct action *p, *q; - p=(struct action *)Malloc(sizeof(struct action)); - p->next = (struct action *)NULL; - p->linenum = startline; - p->test = combinetests(restrictions,finaltest); - p->replacement.m_len = lenthisrepl; - p->replacement.m_elems = constructlist(repllist,lenthisrepl); - /* chain new action to END of action chain */ - if((q = actions[currentstate])==(struct action *)NULL) - actions[currentstate] = p; - else { - while(q->next != (struct action *)NULL) - q = q->next; - q->next = p; - } -} - -struct mnem_elem ** -constructlist(list,len) - struct mnem_list *list; - int len; -{ - struct mnem_elem **p; - int i; - p = (struct mnem_elem **)Malloc(len*sizeof(struct mnem_elem *)); - while(len--) { - p[len] = list->elem; - list = list->next; - } - return(p); -} - -struct mnem_list * -addelem(oldlist, mnem, test) - struct mnem_list *oldlist; - struct idf *mnem; - struct exp_node *test; -{ - struct mnem_list *reslist; - struct mnem_elem *element; - element = (struct mnem_elem *)Malloc(sizeof(struct mnem_elem)); - element->op_code = mnem; - element->arg = test; - reslist = (struct mnem_list *)Malloc(sizeof(struct mnem_list)); - reslist->elem = element; - reslist->next = oldlist; - return(reslist); -} - -int -dotransition(state, mnem, mnem_list, lenlist) - int state; - struct idf *mnem; - struct mnem_list *mnem_list; - int lenlist; -{ - struct state *p; - /* look for existing transition */ - for(p=states[state]; - (p!=((struct state *)NULL)) && ((p->op)!=mnem); - p = p->next - ); - if(p==(struct state *)NULL) { - /* none found so add a new state to dfa */ - p=(struct state *)Malloc(sizeof(struct state)); - p->op=mnem; - if(++higheststate>MAXSTATES) { - fprint("Parser: More than %s states\n",MAXSTATES); - sys_stop(S_EXIT); - } - p->goto_state= higheststate; - p->next=states[currentstate]; - states[currentstate]=p; - states[higheststate] = (struct state *)NULL; - actions[higheststate] = (struct action *)NULL; - patterns[higheststate].m_len = lencurrpatt; - patterns[higheststate].m_elems = - constructlist(mnem_list,lenlist); - return(higheststate); - } - else return(p->goto_state); /* already exists */ -} - -struct exp_node * -combinetests(test1, test2) - struct exp_node *test1, *test2; -{ - if(test1==(struct exp_node *)NULL) - return(test2); - else if(test2==(struct exp_node *)NULL) - return(test1); - else - return(mknode(LOGAND,test1,test2)); -} - -priority(op) int op; { - switch (op) { - case LOGOR: return(1); - case LOGAND: return(2); - case BITOR: return(3); - case XOR: return(4); - case BITAND: return(5); - case EQ: - case NE: return(6); - case LT: - case LE: - case GT: - case GE: return(7); - case LSHIFT: - case RSHIFT: return(8); - case MINUS: - case PLUS: return(9); - case TIMES: - case DIV: - case MOD: return(10); - case NOT: - case COMP: - case UPLUS: - case UMINUS: return(11); - } -} - -struct exp_node * -mknode(op,left,right) - int op; - struct exp_node *left,*right; -{ - struct exp_node *p; - p = (struct exp_node *)Malloc(sizeof(struct exp_node)); - p->node_type = op; - p->exp_left = left; - p->exp_right = right; - return(p); -} - -struct exp_node * -mkleaf(op,val) - int op,val; -{ - struct exp_node *p; - p = (struct exp_node *)Malloc(sizeof(struct exp_node)); - p->node_type = op; - p->leaf_val = val; - return(p); -} - -LLmessage(insertedtok) - int insertedtok; -{ - nerrors++; - fprint(STDERR,"parser: syntax error on line %d: ",linenum); - if(insertedtok) { - fprint(STDERR,"Inserted token %d\n",insertedtok); - yyless(0); - } - else fprint(STDERR,"Deleted token %d\n",LLsymb); -} - -main() { - initlex(); - states[0] = (struct state *)NULL; - patterns[0].m_len = 0; - parser(); - if(nerrors) { - fprint(STDERR,"%d errors detected\n",nerrors); - sys_stop(S_EXIT); - } - outputnopt(); - sys_stop(S_END); -} -} diff --git a/modules/src/em_opt/parser.h b/modules/src/em_opt/parser.h deleted file mode 100644 index 6df6ef325..000000000 --- a/modules/src/em_opt/parser.h +++ /dev/null @@ -1,96 +0,0 @@ -/* $Header$ */ -#include - -#define NULL 0 - -/* type of arguments expected by each instruction */ -#define NOARG 1 -#define CST 2 -#define CSTOPT 3 -#define LAB 4 -#define DEFILB 5 -#define PNAM 6 -#define EXT 7 - -#define IDF_TYPE struct id_info -struct id_info { - struct idf *nextidf; /* chain all opcodes together */ - int used; /* is this op used? */ - int startpatt; /* does it start a pattern? */ - int opcode; /* opcode of operator */ - int argfmt; /* how to access pattern argument */ -#define id_nextidf id_user.nextidf -#define id_used id_user.used -#define id_startpatt id_user.startpatt -#define id_opcode id_user.opcode -#define id_argfmt id_user.argfmt -}; -#include - -struct exp_node { - int node_type; - union { - struct { - struct exp_node *left; - struct exp_node *right; - } interior; - int val; - } node_args; -#define exp_left node_args.interior.left -#define exp_right node_args.interior.right -#define leaf_val node_args.val -}; - -struct mnem_elem { - struct idf *op_code; - struct exp_node *arg; /* optional arg expression if replacement */ -}; - -struct mnem_list { - struct mnem_list *next; /* cdr of list */ - struct mnem_elem *elem; /* car of list */ -}; - -struct mnems { - int m_len; /* number of mnem's in pattern */ - struct mnem_elem **m_elems; /* array of mnem's */ -}; - -struct action { - struct action *next; /* chain all actions for same state together */ - int linenum; /* line number in patterns */ - struct exp_node *test; /* test expression (if any) */ - struct mnems replacement; /* replacement pattern */ -}; - -struct state { - struct state *next; /* chain to next entry for this state */ - struct idf *op; /* transition on op to.. */ - int goto_state; /* state 'goto_state' */ -}; - -#define MAXSTATES 2000 -#define MAXPATTERN 20 - -/* Parser globals */ -extern struct state *states[MAXSTATES]; -extern struct action *actions[MAXSTATES]; -extern struct mnems patterns[MAXSTATES]; -extern int higheststate; /* Highest state yet allocated */ -extern struct idf *ops; /* Chained list of all ops */ -extern int longestpattern; -extern int nerrors; -extern File *ofile; - -/* Lexical analyser globals */ -extern struct idf *opval; /* opcode of returned OPCODE*/ -extern int lastintval; /* value of last integer seen */ -extern int linenum; /*line number of input file*/ - -/* Functions not returning int */ -char *Malloc(); -struct exp_node *mknode(); -struct exp_node *mkleaf(); -struct exp_node *combinetests(); -struct mnem_list *addelem(); -struct mnem_elem **constructlist(); diff --git a/modules/src/em_opt/patterns b/modules/src/em_opt/patterns deleted file mode 100644 index c2f62f813..000000000 --- a/modules/src/em_opt/patterns +++ /dev/null @@ -1,569 +0,0 @@ -/* $Header$ */ -loc adi w loc sbi w : loc $1-$3 adi w -inc dec: -inc loc adi w : loc $2+1 adi w -inc loc sbi w : loc $2-1 sbi w -dec loc adi w : loc $2-1 adi w -dec loc sbi w : loc $2+1 sbi w -ldc adi 2*w ldc sbi 2*w : ldc $1-$3 adi 2*w -loc adi w loc adi w : loc $1+$3 adi w -ldc adi 2*w ldc adi 2*w : ldc $1+$3 adi 2*w -loc adi w loc mli w : loc $3 mli w loc $1*$3 adi w -loc adi w loc 1 sli w : loc $3 sli w loc 2*$1 adi w -adp 0 : -adp adp : adp $1+$2 -adp lof : lof $1+$2 -adp ldf : ldf $1+$2 -adp !=0 loi w : lof $1 -adp !=0 loi 2*w : ldf $1 -adp stf : stf $1+$2 -adp sdf : sdf $1+$2 -adp !=0 sti w : stf $1 -adp !=0 sti 2*w : sdf $1 -asp 0 : -asp asp : asp $1+$2 -blm 0 : asp 2*p -cmi w zeq : beq $2 -cmi w zge : bge $2 -cmi w zgt : bgt $2 -cmi w zle : ble $2 -cmi w zlt : blt $2 -cmi w zne : bne $2 -cmu w zeq : beq $2 -cmu w zne : bne $2 -dvi ngi $1 : ngi $1 dvi $1 -lae adp : lae $1+$2 -lae blm w : loi w ste $1 -lae blm 2*w : loi 2*w sde $1 -lae ldf : lde $1+$2 -lae lof : loe $1+$2 -lae loi w : loe $1 -lae loi 2*w : lde $1 -#ifdef INT -lae loi loe $1-w ? $2%w==0: lae $3 loi $2+w -lae loi lde $1-2*w ? $2%w==0: lae $3 loi $2+2*w -lae $3+$4 loi lae loi ? $2%w==0 && $4%w==0: lae $3 loi $2+$4 -lae sti ste $1+$2 : lae $1 sti $2+w -lae sti sde $1+$2 : lae $1 sti $2+2*w -lae sti loc ste $1-w : loc $3 lae $4 sti $2+w -lae sti lol ste $1-w : lol $3 lae $4 sti $2+w -#endif -lae lae blm loe $1+$3 ste $2+$3 : lae $1 lae $2 blm $3+w -lae lae blm lde $1+$3 sde $2+$3 : lae $1 lae $2 blm $3+2*w -lae lae blm lae $1+$3 lae $2+$3 blm : lae $1 lae $2 blm $3+$6 -lae lal blm lae $1+$3 lal $2+$3 blm ? samesign($2,$5): - lae $1 lal $2 blm $3+$6 -lal lae blm lal $1+$3 lae $2+$3 blm ? samesign($1,$4): - lal $1 lae $2 blm $3+$6 -lal lal blm lal $1+$3 lal $2+$3 blm ? samesign($1,$4) && samesign($2,$5): - lal $1 lal $2 blm $3+$6 -lal lal sbs w ? samesign($1,$2): loc $1-$2 -lae sdf : sde $1+$2 -lae stf : ste $1+$2 -lae sti w : ste $1 -lae sti 2*w : sde $1 -lal adp ? samesign($1,$1+$2): lal $1+$2 -lal blm w : loi w stl $1 -lal blm 2*w : loi 2*w sdl $1 -#ifdef INT -/*lal sti loc stl $1-w ? notreg($4) && samesign($1,$4): */ -/* loc $3 lal $4 sti $2+w */ -/*lal sti loe stl $1-w ? notreg($4) && samesign($1,$4): */ -/* loe $3 lal $4 sti $2+w */ -#endif -lal ldf ? samesign($1,$1+$2): ldl $1+$2 -lal lof ? samesign($1,$1+$2): lol $1+$2 -lal loi w : lol $1 -lal loi 2*w : ldl $1 -#ifdef INT -/*lal loi lol $1-w ? notreg($3) && samesign($1,$3) && $2%w==0: */ -/* lal $3 loi $2+w */ -/*lal loi ldl $1-2*w ? notreg($3) && samesign($1,$3) && $2%w==0: */ -/* lal $3 loi $2+2*w */ -lal loi lal loi $1-$3 ? samesign($1,$3) && $2%w==0 && $4%w==0: - lal $3 loi $2+$4 -/*lal sti stl $1+$2 ? notreg($3) && samesign($1,$3): lal $1 sti $2+w */ -/*lal sti sdl $1+$2 ? notreg($3) && samesign($1,$3): lal $1 sti $2+2*w*/ -#endif -lal sdf ? samesign($1,$1+$2): sdl $1+$2 -lal stf ? samesign($1,$1+$2): stl $1+$2 -lal sti w : stl $1 -lal sti 2*w : sdl $1 -#ifdef INT -lde lde $1-2*w : lae $2 loi 4*w -lde loe $1-w : lae $2 loi 3*w -#endif -lde sde $1 : -lde sde lde $1+2*w sde $2+2*w : lae $1 lae $2 blm 4*w -#ifdef INT -/*ldl ldl $1-2*w ? notreg($1) && notreg($2) && samesign($1,$2):*/ -/* lal $2 loi 4*w */ -/*ldl lol $1-w ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* lal $2 loi 3*w */ -#endif -ldl sdl $1: -lxa loi lxa $1 sti $2 : -lxa lof lxa $1 stf $2 : -lxa ldf lxa $1 sdf $2 : -lxa >1 stf lxa $1 lof $2 : dup w lxa $1 stf $2 -lxa >1 sdf lxa $1 ldf $2 : dup 2*w lxa $1 sdf $2 -lxl lof lxl $1 stf $2 : -lxl ldf lxl $1 sdf $2 : -lxl >1 stf lxl $1 lof $2 : dup w lxl $1 stf $2 -lxl >1 sdf lxl $1 ldf $2 : dup 2*w lxl $1 sdf $2 -lxa >1 sti lxa $1 loi $2 ? $2%w==0: dup $2 lxa $1 sti $2 -loc -1 adi w : dec -loc dec ? sfit($1-1,8*w) : loc $1-1 -loc -1 bgt : zge $2 -loc -1 ble : zlt $2 -loc -1 dvi w : ngi w -ldc -1 dvi 2*w : ngi 2*w -loc -1 loe adi w : loe $2 dec -loc -1 lol adi w : lol $2 dec -loc -1 mli w : ngi w -ldc -1 mli 2*w : ngi 2*w -loc -1 sbi w : inc -loc inc ? sfit($1+1,8*w) : loc $1+1 -loc 0 adi w : -ldc 0 adi 2*w : -loc 0 ads w : -ldc 0 ads 2*w : -zer adi $1 : -loc 0 beq : zeq $2 -loc 0 bge : zge $2 -loc 0 bgt : zgt $2 -loc 0 ble : zle $2 -loc 0 blt : zlt $2 -loc 0 bne : zne $2 -loc 0 cmi w teq : teq -loc 0 cmi w tge : tge -loc 0 cmi w tgt : tgt -loc 0 cmi w tle : tle -loc 0 cmi w tlt : tlt -loc 0 cmi w tne : tne -loc 0 cmu w teq : teq -loc 0 cmu w tne : tne -loc 0 cmu w zeq : zeq $3 -loc 0 cmu w zne : zne $3 -loc 0 ior w : -ldc 0 ior 2*w : -zer ior $1 : -loc 0 ste : zre $2 -loc 0 stl : zrl $2 -loc 0 sbi w : -ldc 0 sbi 2*w : -zer sbi $1 : -loc 0 xor w : -ldc 0 xor 2*w : -zer xor $1 : -loc 1 adi w : inc -loc 1 bge : zgt $2 -loc 1 blt : zle $2 -loc 1 dvi w : -ldc 1 dvi 2*w : -loc 1 dvu w : -loc 1 dvu 2*w : -loc 1 loe adi w : loe $2 inc -loc 1 lol adi w : lol $2 inc -loc 0 mli w : asp w loc 0 -ldc 0 mli 2*w : asp 2*w ldc 0 -loc 0 mlu w : asp w loc 0 -ldc 0 mlu 2*w : asp 2*w ldc 0 -loc 1 mli w : -ldc 1 mli 2*w : -loc 1 mlu w : -ldc 1 mlu 2*w : -loc 1 sbi w : dec -loc loe mli w : loe $2 loc $1 mli w -loc loe adi w loc : loe $2 loc $1 adi w loc $4 -loc loe adi w inc : loe $2 loc $1 adi w inc -loc loe adi w dec : loe $2 loc $1 adi w dec -loc lol mli w : lol $2 loc $1 mli w -loc lol adi w loc : lol $2 loc $1 adi w loc $4 -loc lol adi w inc : lol $2 loc $1 adi w dec -loc lol adi w dec : lol $2 loc $1 adi w dec -ldc lde mli 2*w : lde $2 ldc $1 mli 2*w -ldc lde adi 2*w : lde $2 ldc $1 adi 2*w -ldc ldl mli 2*w : ldl $2 ldc $1 mli 2*w -ldc ldl adi 2*w : ldl $2 ldc $1 adi 2*w -loc 2 mli w : loc 1 sli w -loc 4 mli w : loc 2 sli w -loc 8 mli w : loc 3 sli w -loc 16 mli w : loc 4 sli w -loc 32 mli w : loc 5 sli w -loc 64 mli w : loc 6 sli w -loc 128 mli w : loc 7 sli w -loc 256 mli w : loc 8 sli w -loc 2 mlu w : loc 1 slu w -loc 4 mlu w : loc 2 slu w -loc 8 mlu w : loc 3 slu w -loc 16 mlu w : loc 4 slu w -loc 32 mlu w : loc 5 slu w -loc 64 mlu w : loc 6 slu w -loc 128 mlu w : loc 7 slu w -loc 256 mlu w : loc 8 slu w -loc adi undefined : adi $1 -loc sbi undefined : sbi $1 -loc mli undefined : mli $1 -loc dvi undefined : dvi $1 -loc rmi undefined : rmi $1 -loc ngi undefined : ngi $1 -loc sli undefined : sli $1 -loc sri undefined : sri $1 -loc adu undefined : adu $1 -loc sbu undefined : sbu $1 -loc mlu undefined : mlu $1 -loc dvu undefined : dvu $1 -loc rmu undefined : rmu $1 -loc slu undefined : slu $1 -loc sru undefined : sru $1 -loc adf undefined : adf $1 -loc sbf undefined : sbf $1 -loc mlf undefined : mlf $1 -loc dvf undefined : dvf $1 -loc ngf undefined : ngf $1 -loc fif undefined : fif $1 -loc fef undefined : fef $1 -loc zer undefined : zer $1 -loc zrf undefined : zrf $1 -loc los w : loi $1 -loc sts w : sti $1 -loc ads w : adp $1 -ldc ads 2*w ? sfit($1,8*w): adp $1 -loc ass w : asp $1 -loc bls w : blm $1 -loc dus w : dup $1 -loc loc $1 cii : -loc loc $1 cuu : -loc loc $1 cff : -loc and undefined : and $1 -loc ior undefined : ior $1 -loc xor undefined : xor $1 -loc com undefined : com $1 -loc rol undefined : rol $1 -loc 0 rol : -loc ror undefined : ror $1 -loc 0 ror : -loc inn undefined : inn $1 -loc set undefined : set $1 -loc cmi undefined : cmi $1 -loc cmu undefined : cmu $1 -loc cmf undefined : cmf $1 -loe dec ste $1: dee $1 -loe inc ste $1: ine $1 -loe loc 0 mli w : loc 0 -#ifdef INT -loe loe $1-w : lde $2 -loe loe $1+w beq : lde $1 beq $3 -loe loe $1+w bge : lde $1 ble $3 -loe loe $1+w bgt : lde $1 blt $3 -loe loe $1+w ble : lde $1 bge $3 -loe loe $1+w blt : lde $1 bgt $3 -loe loe $1+w bne : lde $1 bne $3 -loe loe $1+w cmi w : lde $1 cmi w ngi w -#endif -ngi w teq : teq -ngi w tge : tle -ngi w tgt : tlt -ngi w tle : tge -ngi w tlt : tgt -ngi w tne : tne -#ifdef INT -loe loe $1+w mli w : lde $1 mli w -loe loe $1+w adi w : lde $1 adi w -loe loe $1 : loe $1 dup w -#endif -loe ste $1 : -lol blm w ? p==w : loi w sil $1 -ldl blm w ? p==2*w : loi w sil $1 -lol dec stl $1 : del $1 -lol inc stl $1 : inl $1 -lol loc 0 mli w : loc 0 -lol loi w ? w==p : lil $1 -ldl loi w ? p==2*w : lil $1 -#ifdef INT -/*lol lol $1-w ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $2 */ -/*lol lol $1+w beq ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $1 beq $3 */ -/*lol lol $1+w bge ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $1 ble $3 */ -/*lol lol $1+w bgt ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $1 blt $3 */ -/*lol lol $1+w ble ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $1 bge $3 */ -/*lol lol $1+w blt ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $1 bgt $3 */ -/*lol lol $1+w bne ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $1 bne $3 */ -/*lol lol $1+w cmi w ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $1 cmi w ngi w */ -/*lol lol $1+w mli w ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $1 mli w */ -/*lol lol $1+w adi w ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* ldl $1 adi w */ -lol lol $1 : lol $1 dup w -#endif -lol stl $1: -lol sti w ? p==w : sil $1 -ldl sti w ? p==2*w : sil $1 -mli ngi $1: ngi $1 mli $1 -ngi adi $1: sbi $1 -ngf adf $1: sbf $1 -ngi sbi $1: adi $1 -ngf sbf $1: adf $1 -ngi ngi $1: -ngf ngf $1: -#ifdef INT -sde sde $1+2*w : lae $1 sti 4*w -sde ste $1+2*w : lae $1 sti 3*w -sde loc ste $1-w : loc $2 lae $3 sti 3*w -sde lol ste $1-w : lol $2 lae $3 sti 3*w -sde lde $1 : dup 2*w sde $1 -#endif -sdf 0 : sti 2*w -#ifdef INT -/*sdl sdl $1+2*w ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* lal $1 sti 4*w */ -/*sdl stl $1+2*w ? notreg($1) && notreg($2) && samesign($1,$2): */ -/* lal $1 sti 3*w */ -/*sdl loc stl $1-w ? notreg($1) && notreg($3) && samesign($1,$3): */ -/* loc $2 lal $3 sti 3*w */ -/*sdl loe stl $1-w ? notreg($1) && notreg($3) && samesign($1,$3): */ -/* loe $2 lal $3 sti 3*w */ -sdl ldl $1 : dup 2*w sdl $1 -ste loe $1 : dup w ste $1 -ste ste $1-w : sde $2 -ste loc ste $1-w : loc $2 sde $3 -ste lol ste $1-w : lol $2 sde $3 -stl lol $1 : dup w stl $1 -#endif -stf 0 : sti w -sdl ldl $1 ret 2*w : ret 2*w -#ifdef INT -/*stl stl $1+w ? notreg($1) && notreg($2) && samesign($1,$2): sdl $1 */ -/*stl loc stl $1-w ? notreg($1) && notreg($3) && samesign($1,$3): */ -/* loc $2 sdl $3 */ -/*stl loe stl $1-w ? notreg($1) && notreg($3) && samesign($1,$3): */ -/* loe $2 sdl $3 */ -#endif -stl lol $1 ret w : ret w -lal sti lal $1 loi $2 ret $2 : ret $2 -loc sbi w loc sbi w : loc $1+$3 sbi w -ldc sbi 2*w ldc sbi 2*w : ldc $1+$3 sbi 2*w -loc sbi w loc adi w : loc $1-$3 sbi w -ldc sbi 2*w ldc adi 2*w : ldc $1-$3 sbi 2*w -loc sbi w loc mli w : loc $3 mli w loc $1*$3 sbi w -loc sbi w loc 1 sli w : loc $3 sli w loc 2*$1 sbi w -teq teq : tne -teq tne : teq -teq zne : zeq $2 -teq zeq : zne $2 -tge teq : tlt -tge tne : tge -tge zeq : zlt $2 -tge zne : zge $2 -tgt teq : tle -tgt tne : tgt -tgt zeq : zle $2 -tgt zne : zgt $2 -tle teq : tgt -tle tne : tle -tle zeq : zgt $2 -tle zne : zle $2 -tlt teq : tge -tlt tne : tlt -tlt zeq : zge $2 -tlt zne : zlt $2 -tne teq : teq -tne tne : tne -tne zeq : zeq $2 -tne zne : zne $2 -#ifdef INT -loc 0 loc 0 loc 0 : zer 3*w -zer defined loc 0 : zer $1+w -#endif -loi 1 loc and w ? ($2&255)==255: loi 1 -loi =0&&$5<128 : loi 1 loc $5 cmi w zeq $7 -loi 1 loc 1 loc w cii loc cmi w zne ? $5>=0&&$5<128 : loi 1 loc $5 cmi w zne $7 -loi 1 loc 1 loc w cii loc w loc w ciu loc 255 and w: loi 1 -cmp teq : cms p teq -cmp tne : cms p tne -cmu defined teq : cms $1 teq -cmu defined tne : cms $1 tne -cms w zeq : beq $2 -cms w zne : bne $2 -lol lae aar w adp : adp $4 lol $1 lae $2 aar w -loe lae aar w adp : adp $4 loe $1 lae $2 aar w -cmi defined zeq : cms $1 zeq $2 -cmi defined zne : cms $1 zne $2 -#ifdef INT -loe $4 inc dup w ste : ine $1 loe $1 -loe $4 dec dup w ste : dee $1 loe $1 -lol $4 inc dup w stl : inl $1 lol $1 -lol $4 dec dup w stl : del $1 lol $1 -adp dup p ste adp -$1 ? p==w : dup p adp $1 ste $3 -adp dup p sde adp -$1 ? p==2*w : dup p adp $1 sde $3 -adp dup p stl adp -$1 ? p==w : dup p adp $1 stl $3 -adp dup p sdl adp -$1 ? p==2*w : dup p adp $1 sdl $3 -inc dup w ste dec : dup w inc ste $3 -inc dup w stl dec : dup w inc stl $3 -#endif -zeq bra lab $1 : zne $2 lab $1 -zge bra lab $1: zlt $2 lab $1 -zgt bra lab $1 : zle $2 lab $1 -zlt bra lab $1 : zge $2 lab $1 -zle bra lab $1 : zgt $2 lab $1 -zne bra lab $1 : zeq $2 lab $1 -beq bra lab $1 : bne $2 lab $1 -bge bra lab $1 : blt $2 lab $1 -bgt bra lab $1 : ble $2 lab $1 -blt bra lab $1 : bge $2 lab $1 -ble bra lab $1 : bgt $2 lab $1 -bne bra lab $1 : beq $2 lab $1 -lin lin : lin $2 -lin lab lin : lab $2 lin $3 -lin ret : ret $2 -lin bra : bra $2 -#ifdef INT -dup p stl loi w ? p==w : stl $2 lil $2 -dup p sdl loi w ? p==2*w : sdl $2 lil $2 -dup p stl sti w ? p==w : stl $2 sil $2 -dup p sdl sti w ? p==2*w : sdl $2 sil $2 -#endif -loc 0 cms w : tne -zer w : loc 0 -loc loc adi w ? sfit($1+$2,8*w) : loc $1+$2 -loc loc sbi w ? sfit($1-$2,8*w) : loc $1-$2 -loc loc mli w ? sfit($1*$2,8*w) : loc $1*$2 -loc loc !=0 dvi w : loc $1/$2 -loc loc and w : loc $1&$2 -loc loc ior w : loc $1|$2 -loc 0 loc 0 ior 2*w : -loc loc xor w : loc $1^$2 -loc 0 loc 0 xor 2*w : -loc loc rol w : loc rotate($1,$2) -loc loc ror w : loc rotate($1,8*w-$2) -loc ngi w ? sfit(-$1,8*w) : loc -$1 -loc com w : loc ~$1 -ldc ngi 2*w : ldc -$1 -/*loc lae aar w ? $1>=rom(2,0) && $1 <= rom(2,0)+rom(2,1) : */ -/* adp ($1-rom(2,0))*rom(2,2) */ -/*loc lae lar w ? $1>=rom(2,0) && $1 <= rom(2,0)+rom(2,1) : */ -/* adp ($1-rom(2,0))*rom(2,2) loi rom(2,2) */ -/*loc lae sar w ? $1>=rom(2,0) && $1 <= rom(2,0)+rom(2,1) : */ -/* adp ($1-rom(2,0))*rom(2,2) sti rom(2,2) */ -loc teq : loc $1==0 -loc tne : loc $1!=0 -loc tge : loc $1>=0 -loc tle : loc $1<=0 -loc tgt : loc $1>0 -loc tlt : loc $1<0 -loc 0 zeq : bra $2 -loc zeq : -loc !=0 zne : bra $2 -loc zne : -loc >=0 zge : bra $2 -loc zge : -loc <=0 zle : bra $2 -loc zle : -loc >0 zgt : bra $2 -loc zgt : -loc <0 zlt : bra $2 -loc zlt : -loc loc $1 beq : bra $3 -loc loc beq : -loc loc !=$1 bne : bra $3 -loc loc bne : -loc loc bge ? $1>=$2 : bra $3 -loc loc bge : -loc loc ble ? $1<=$2 : bra $3 -loc loc ble : -loc loc bgt ? $1>$2 : bra $3 -loc loc bgt : -loc loc blt ? $1<$2 : bra $3 -loc loc blt : -lae loi >4*w lal sti $2 : lae $1 lal $3 blm $2 -lal loi >4*w lae sti $2 : lal $1 lae $3 blm $2 -lal loi >4*w lal sti $2 ? ( $3<=$1-$2 || $3>=$1+$2 ) : - lal $1 lal $3 blm $2 -lae loi >4*w lae sti $2 ? ($3<=$1-$2 || $3>=$1+$2) : - lae $1 lae $3 blm $2 -loc 0 loc w loc cif : zrf $3 -loc >=0 loc w loc 2*w ciu : ldc $1 -loc loc w loc 2*w cii : ldc $1 -loi loc >=0 inn $1 ? $2<$1*8 : - lof ($2/(8*w))*w loc $2&(8*w-1) inn w -ldl loc >=0 inn 2*w ? $2<16*w : - lol $1+($2/(8*w))*w loc $2&(8*w-1) inn w -lde loc >=0 inn 2*w ? $2<16*w : - loe $1+($2/(8*w))*w loc $2&(8*w-1) inn w -ldf loc >=0 inn 2*w ? $2<16*w : - lof $1+($2/(8*w))*w loc $2&(8*w-1) inn w -loc inn ? $1<0 || $1>=8*$2 : asp $2 loc 0 -lol loc adi w stl $1 : loc $2 lol $1 adi w stl $4 -lol loe adi w stl $1 : loe $2 lol $1 adi w stl $4 -lol lol !=$1 adi w stl $1 : lol $2 lol $1 adi w stl $4 -loe loc adi w ste $1 : loc $2 loe $1 adi w ste $4 -loe loe !=$1 adi w ste $1 : loe $2 loe $1 adi w ste $4 -loe lol adi w ste $1 : lol $2 loe $1 adi w ste $4 -lol loc ior w stl $1 : loc $2 lol $1 ior w stl $4 -lol loe ior w stl $1 : loe $2 lol $1 ior w stl $4 -lol lol !=$1 ior w stl $1 : lol $2 lol $1 ior w stl $4 -loe loc ior w ste $1 : loc $2 loe $1 ior w ste $4 -loe loe !=$1 ior w ste $1 : loe $2 loe $1 ior w ste $4 -loe lol ior w ste $1 : lol $2 loe $1 ior w ste $4 -lol loc and w stl $1 : loc $2 lol $1 and w stl $4 -lol loe and w stl $1 : loe $2 lol $1 and w stl $4 -lol lol !=$1 and w stl $1 : lol $2 lol $1 and w stl $4 -loe loc and w ste $1 : loc $2 loe $1 and w ste $4 -loe loe !=$1 and w ste $1 : loe $2 loe $1 and w ste $4 -loe lol and w ste $1 : lol $2 loe $1 and w ste $4 -loi asp $1 : asp p -lal loi 4*w loc loc loc loc ior 4*w ? ($3==0)+($4==0)+($5==0)+($6==0)>2 : - lol $1+3*w loc $3 ior w lol $1+2*w loc $4 ior w lol $1+w loc $5 ior w lol $1 loc $6 ior w -loc dup 2 stl loc dup 2 stl : - loc $1 stl $3 loc $4 stl $6 loc $1 loc $4 -/*LLP LLP adp SLP $2 sti ? (!notreg($2) || $5!=p): */ -/* LLP $1 sti $5 LLP $2 adp $3 SLP $4 */ -loe loe adp ste $2 sti !=p ? p==w : loe $1 sti $5 loe $2 adp $3 ste $4 -lde lde adp sde $2 sti !=p ? p==2*w : lde $1 sti $5 lde $2 adp $3 sde $4 -#ifndef INT -dup w stl : stl $2 lol $2 -dup w ste : ste $2 loe $2 -dup w sil : sil $2 lil $2 -dup w loe sti w ? p==w : loe $2 sti w loe $2 loi w -dup w lde sti w ? p==2*w : lde $2 sti w lde $2 loi w -dup w lol stf ? p==w : lol $2 stf $3 lol $2 lof $3 -dup w ldl stf ? p==2*w : ldl $2 stf $3 ldl $2 lof $3 -dup w loe stf ? p==w : loe $2 stf $3 loe $2 lof $3 -dup w lde stf ? p==2*w : lde $2 stf $3 lde $2 lof $3 -dup 2*w sdl : sdl $2 ldl $2 -dup 2*w sde : sde $2 lde $2 -dup 2*w lol sti 2*w ? p==w : lol $2 sti 2*w lol $2 loi 2*w -dup 2*w ldl sti 2*w ? p==2*w : ldl $2 sti 2*w ldl $2 loi 2*w -dup 2*w loe sti 2*w ? p==w : loe $2 sti 2*w loe $2 loi 2*w -dup 2*w lde sti 2*w ? p==2*w : lde $2 sti 2*w lde $2 loi 2*w -dup 2*w lol sdf ? p==w : lol $2 sdf $3 lol $2 ldf $3 -dup 2*w ldl sdf ? p==2*w : ldl $2 sdf $3 ldl $2 ldf $3 -dup 2*w loe sdf ? p==w : loe $2 sdf $3 loe $2 ldf $3 -dup 2*w lde sdf ? p==2*w : lde $2 sdf $3 lde $2 ldf $3 -lol dup w : lol $1 lol $1 -loe dup w : loe $1 loe $1 -lil dup w : lil $1 lil $1 -loe loi w dup 2 ? p==w : loe $1 loi w loe $1 loi w -lde loi w dup 2 ? p==2*w : lde $1 loi w lde $1 loi w -ldl dup 2*w : ldl $1 ldl $1 -lde dup 2*w : lde $1 lde $1 -#endif -adp stl lol $2 adp -$1 ? p==w : dup p adp $1 stl $2 -adp sdl ldl $2 adp -$1 ? p==2*w : dup p adp $1 sdl $2 -adp ste loe $2 adp -$1 ? p==w : dup p adp $1 ste $2 -adp sde lde $2 adp -$1 ? p==2*w : dup p adp $1 sde $2 -adp sil lil $2 adp -$1 ? p==w : dup p adp $1 sil $2 -adp lol sti p lol $2 loi p adp -$1 ? p==w : dup p adp $1 lol $2 sti p -adp ldl sti p ldl $2 loi p adp -$1 ? p==2*w : dup p adp $1 ldl $2 sti p -adp loe sti p loe $2 loi p adp -$1 ? p==w : dup p adp $1 loe $2 sti p -adp lde sti p lde $2 loi p adp -$1 ? p==2*w : dup p adp $1 lde $2 sti p diff --git a/modules/src/em_opt/pseudo.r b/modules/src/em_opt/pseudo.r deleted file mode 100644 index a758cb4b7..000000000 --- a/modules/src/em_opt/pseudo.r +++ /dev/null @@ -1,174 +0,0 @@ -df_dlb | label:l | - FLUSHDFA(); - O_df_dlb(l); -df_dnam | char *:s | - FLUSHDFA(); - O_df_dnam(s); -pro | char *:s arith:l | - FLUSHDFA(); - O_pro(s,l); -pro_narg | char *:s | - FLUSHDFA(); - O_pro_narg(s); -end | arith:l | - FLUSHDFA(); - O_end(l); -end_narg | | - FLUSHDFA(); - O_end_narg(); -exa_dnam | char *:s | - FLUSHDFA(); - O_exa_dnam(s); -exa_dlb | label:l | - FLUSHDFA(); - O_exa_dlb(l); -exp | char *:s | - FLUSHDFA(); - O_exp(s); -ina_dnam | char *:s | - FLUSHDFA(); - O_ina_dnam(s); -ina_dlb | label:l | - FLUSHDFA(); - O_ina_dlb(l); -inp | char *:s | - FLUSHDFA(); - O_inp(s); -bss_cst | arith:n arith:w int:i | - FLUSHDFA(); - O_bss_cst(n,w,i); -bss_icon | arith:n char *:s arith:sz int:i | - FLUSHDFA(); - O_bss_icon(n,s,sz,i); -bss_ucon | arith:n char *:s arith:sz int:i | - FLUSHDFA(); - O_bss_ucon(n,s,sz,i); -bss_fcon | arith:n char *:s arith:sz int:i | - FLUSHDFA(); - O_bss_fcon(n,s,sz,i); -bss_dnam | arith:n char *:s arith:offs int:i | - FLUSHDFA(); - O_bss_dnam(n,s,offs,i); -bss_dlb | arith:n label:l arith:offs int:i | - FLUSHDFA(); - O_bss_dlb(n,l,offs,i); -bss_ilb | arith:n label:l int:i | - FLUSHDFA(); - O_bss_ilb(n,l,i); -bss_pnam | arith:n char *:s int:i | - FLUSHDFA(); - O_bss_pnam(n,s,i); -hol_cst | arith:n arith:w int:i | - FLUSHDFA(); - O_hol_cst(n,w,i); -hol_icon | arith:n char *:s arith:sz int:i | - FLUSHDFA(); - O_hol_icon(n,s,sz,i); -hol_ucon | arith:n char *:s arith:sz int:i | - FLUSHDFA(); - O_hol_ucon(n,s,sz,i); -hol_fcon | arith:n char *:s arith:sz int:i | - FLUSHDFA(); - O_hol_fcon(n,s,sz,i); -hol_dnam | arith:n char *:s arith:offs int:i | - FLUSHDFA(); - O_hol_dnam(n,s,offs,i); -hol_dlb | arith:n label:l arith:offs int:i | - FLUSHDFA(); - O_hol_dlb(n,l,offs,i); -hol_ilb | arith:n label:l int:i | - FLUSHDFA(); - O_hol_ilb(n,l,i); -hol_pnam | arith:n char *:s int:i | - FLUSHDFA(); - O_hol_pnam(n,s,i); -con_cst | arith:l | - FLUSHDFA(); - O_con_cst(l); -con_icon | char *:val arith:siz | - FLUSHDFA(); - O_con_icon(val,siz); -con_ucon | char *:val arith:siz | - FLUSHDFA(); - O_con_ucon(val,siz); -con_fcon | char *:val arith:siz | - FLUSHDFA(); - O_con_fcon(val,siz); -con_scon | char *:str arith:siz | - FLUSHDFA(); - O_con_scon(str,siz); -con_dnam | char *:str arith:val | - FLUSHDFA(); - O_con_dnam(str,val); -con_dlb | label:l arith:val | - FLUSHDFA(); - O_con_dlb(l,val); -con_ilb | label:l | - FLUSHDFA(); - O_con_ilb(l); -con_pnam | char *:str | - FLUSHDFA(); - O_con_pnam(str); -rom_cst | arith:l | - FLUSHDFA(); - O_rom_cst(l); -rom_icon | char *:val arith:siz | - FLUSHDFA(); - O_rom_icon(val,siz); -rom_ucon | char *:val arith:siz | - FLUSHDFA(); - O_rom_ucon(val,siz); -rom_fcon | char *:val arith:siz | - FLUSHDFA(); - O_rom_fcon(val,siz); -rom_scon | char *:str arith:siz | - FLUSHDFA(); - O_rom_scon(str,siz); -rom_dnam | char *:str arith:val | - FLUSHDFA(); - O_rom_dnam(str,val); -rom_dlb | label:l arith:val | - FLUSHDFA(); - O_rom_dlb(l,val); -rom_ilb | label:l | - FLUSHDFA(); - O_rom_ilb(l); -rom_pnam | char *:str | - FLUSHDFA(); - O_rom_pnam(str); -cst | arith:l | - FLUSHDFA(); - O_cst(l); -icon | char *:val arith:siz | - FLUSHDFA(); - O_icon(val,siz); -ucon | char *:val arith:siz | - FLUSHDFA(); - O_ucon(val,siz); -fcon | char *:val arith:siz | - FLUSHDFA(); - O_fcon(val,siz); -scon | char *:str arith:siz | - FLUSHDFA(); - O_scon(str,siz); -dnam | char *:str arith:val | - FLUSHDFA(); - O_dnam(str,val); -dlb | label:l arith:val | - FLUSHDFA(); - O_dlb(l,val); -ilb | label:l | - FLUSHDFA(); - O_ilb(l); -pnam | char *:str | - FLUSHDFA(); - O_pnam(str); -mes_begin | int:ms | - FLUSHDFA(); - O_mes_begin(ms); -mes_end | | - FLUSHDFA(); - O_mes_end(); -exc | arith:c1 arith:c2 | - FLUSHDFA(); - O_exc(c1,c2); diff --git a/modules/src/em_opt/syntax.l b/modules/src/em_opt/syntax.l deleted file mode 100644 index be7dcbce2..000000000 --- a/modules/src/em_opt/syntax.l +++ /dev/null @@ -1,59 +0,0 @@ -%{ -/* $Header$ */ -#include "Lpars.h" -#include "parser.h" - -struct idf *opval; /* opcode of returned OPCODE*/ -int lastintval; /* value of last integer seen */ -int linenum = 1; /*current line number of input file*/ -%} -%% -sfit return(SFIT); -ufit return(UFIT); -rotate return(ROTATE); -p return(PSIZE); -w return(WSIZE); -defined return(DEFINED); -undefined return(UNDEFINED); -samesign return(SAMESIGN); -sameext return(SAMEEXT); -samenam return(SAMENAM); -offset return(OFFSET); -[a-z]* { - opval = str2idf(yytext,0); - return(OPCODE); - } -[0-9]+ { - lastintval = atoi(yytext); - return(INT); - } -"$" return(PATARG); -"&&" return(LOGAND); -"||" return(LOGOR); -"&" return(BITAND); -"|" return(BITOR); -"^" return(XOR); -"-" return(MINUS); -"+" return(PLUS); -"*" return(TIMES); -"/" return(DIV); -"%" return(MOD); -"==" return(EQ); -"!=" return(NE); -"<" return(LT); -"<=" return(LE); -">" return(GT); -">=" return(GE); -"<<" return(LSHIFT); -">>" return(RSHIFT); -"!" return(NOT); -"~" return(COMP); -"," return(COMMA); -:[ \t]*\n[ \t]+ { linenum++; return(':'); } -^"# "[0-9]+.*\n { linenum=atoi(yytext+2); } -^\#.*\n { linenum++; } -^\n { linenum++; } -[ \t] ; -\n { linenum++; return(yytext[0]);} -. return(yytext[0]); -%% diff --git a/modules/src/string/Makefile b/modules/src/string/Makefile new file mode 100644 index 000000000..5d66e62df --- /dev/null +++ b/modules/src/string/Makefile @@ -0,0 +1,36 @@ +EMHOME = ../../.. +MODULES = $(EMHOME)/modules +INSTALL = $(MODULES)/install +COMPARE = $(MODULES)/compare + +CFLAGS = -O + +SRC = bts2str.c btscat.c btscmp.c btscpy.c btszero.c long2str.c \ + str2bts.c str2long.c strcat.c strcmp.c strcpy.c strindex.c \ + strlen.c strncat.c strncmp.c strncpy.c strrindex.c strzero.c +OBJ = bts2str.o btscat.o btscmp.o btscpy.o btszero.o long2str.o \ + str2bts.o str2long.o strcat.o strcmp.o strcpy.o strindex.o \ + strlen.o strncat.o strncmp.o strncpy.o strrindex.o strzero.o + +all: libstring.a + +libstring.a: $(OBJ) Makefile + ar r libstring.a $(OBJ) + -sh -c 'ranlib libstring.a' + +install: all + $(INSTALL) lib/libstring.a + $(INSTALL) man/string.3 + +cmp: all + $(COMPARE) lib/libstring.a + $(COMPARE) man/string.3 + +pr: + @pr Makefile $(SRC) + +opr: + make pr | opr + +clean: + rm -f *.[oa] diff --git a/modules/src/system/exit.c b/modules/src/system/exit.c deleted file mode 100644 index bcad6e8e1..000000000 --- a/modules/src/system/exit.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands. - * See the copyright notice in the ACK home directory, in the file "Copyright". - */ -/* $Header$ */ -/* called by /lib/crt0.o; needed to suppress the loading of the - standard exit() which performs unnecessary cleanup actions -*/ - -exit(n) -{ - _exit(n); -} diff --git a/util/.distr b/util/.distr new file mode 100644 index 000000000..1dd113b42 --- /dev/null +++ b/util/.distr @@ -0,0 +1,16 @@ +LLgen +ack +amisc +arch +ass +cgg +cmisc +cpp +data +ego +led +misc +ncgg +opt +shf +topgen diff --git a/util/LLgen/src/tunable.h b/util/LLgen/src/tunable.h deleted file mode 100644 index 9714f410a..000000000 --- a/util/LLgen/src/tunable.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. - * - * This product is part of the Amsterdam Compiler Kit. - * - * Permission to use, sell, duplicate or disclose this software must be - * obtained in writing. Requests for such permissions may be sent to - * - * Dr. Andrew S. Tanenbaum - * Wiskundig Seminarium - * Vrije Universiteit - * Postbox 7161 - * 1007 MC Amsterdam - * The Netherlands - * - */ - -/* - * L L G E N - * - * An Extended LL(1) Parser Generator - * - * Author : Ceriel J.H. Jacobs - */ - -/* - * tunable.h $Header$ - * Tunable constants - */ - -# define NNONTERMS 150 /* size of nonterminal array */ -# define NTERMINALS 150 /* size of terminal array */ -# define NAMESZ 3000 /* size of name table */ -# define LTEXTSZ 51 /* size of token */ -# define ENTSIZ 900 /* size of entry table, max 8191 */ diff --git a/util/ack/malloc.c b/util/ack/malloc.c deleted file mode 100644 index 87a4bce50..000000000 --- a/util/ack/malloc.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. - * - * This product is part of the Amsterdam Compiler Kit. - * - * Permission to use, sell, duplicate or disclose this software must be - * obtained in writing. Requests for such permissions may be sent to - * - * Dr. Andrew S. Tanenbaum - * Wiskundig Seminarium - * Vrije Universiteit - * Postbox 7161 - * 1007 MC Amsterdam - * The Netherlands - * - */ - - -#include "ack.h" -#ifdef DEBUG -#define ASSERT(p) if(!(p))botch("p");else -botch(s) -char *s; -{ - printf("malloc/free botched: %s\n",s); - abort(); -} -#else -#define ASSERT(p) -#endif - -#ifndef NORCSID -static char rcs_id[] = "$Header$" ; -#endif - -/* avoid break bug */ -#ifdef pdp11 -#define GRANULE 64 -#else -#define GRANULE 0 -#endif -/* C storage allocator - * circular first-fit strategy - * works with noncontiguous, but monotonically linked, arena - * each block is preceded by a ptr to the (pointer of) - * the next following block - * blocks are exact number of words long - * aligned to the data type requirements of ALIGN - * pointers to blocks must have BUSY bit 0 - * bit in ptr is 1 for busy, 0 for idle - * gaps in arena are merely noted as busy blocks - * last block of arena (pointed to by alloct) is empty and - * has a pointer to first - * idle blocks are coalesced during space search - * - * a different implementation may need to redefine - * ALIGN, NALIGN, BLOCK, BUSY, INT - * where INT is integer type to which a pointer can be cast -*/ -#define INT int -#define ALIGN int -#define NALIGN 1 -#define WORD sizeof(union store) -#define BLOCK 1024 /* a multiple of WORD*/ -#define BUSY 1 -#define NULL 0 -#define testbusy(p) ((INT)(p)&BUSY) -#define setbusy(p) (union store *)((INT)(p)|BUSY) -#define clearbusy(p) (union store *)((INT)(p)&~BUSY) - -union store { union store *ptr; - ALIGN dummy[NALIGN]; - int calloc; /*calloc clears an array of integers*/ -}; - -static union store allocs[2]; /*initial arena*/ -static union store *allocp; /*search ptr*/ -static union store *alloct; /*arena top*/ -static union store *allocx; /*for benefit of realloc*/ -char *sbrk(); - -char * -malloc(nbytes) -unsigned nbytes; -{ - register union store *p, *q; - register nw; - static temp; /*coroutines assume no auto*/ - - if(allocs[0].ptr==0) { /*first time*/ - allocs[0].ptr = setbusy(&allocs[1]); - allocs[1].ptr = setbusy(&allocs[0]); - alloct = &allocs[1]; - allocp = &allocs[0]; - } - nw = (nbytes+WORD+WORD-1)/WORD; - ASSERT(allocp>=allocs && allocp<=alloct); - ASSERT(allock()); - for(p=allocp; ; ) { - for(temp=0; ; ) { - if(!testbusy(p->ptr)) { - while(!testbusy((q=p->ptr)->ptr)) { - ASSERT(q>p&&qptr = q->ptr; - } - if(q>=p+nw && p+nw>=p) - goto found; - } - q = p; - p = clearbusy(p->ptr); - if(p>q) - ASSERT(p<=alloct); - else if(q!=alloct || p!=allocs) { - ASSERT(q==alloct&&p==allocs); - return(NULL); - } else if(++temp>1) - break; - } - temp = ((nw+BLOCK/WORD)/(BLOCK/WORD))*(BLOCK/WORD); - q = (union store *)sbrk(0); - if(q+temp+GRANULE < q) { - return(NULL); - } - q = (union store *)sbrk(temp*WORD); - if((INT)q == -1) { - return(NULL); - } - ASSERT(q>alloct); - alloct->ptr = q; - if(q!=alloct+1) - alloct->ptr = setbusy(alloct->ptr); - alloct = q->ptr = q+temp-1; - alloct->ptr = setbusy(allocs); - } -found: - allocp = p + nw; - ASSERT(allocp<=alloct); - if(q>allocp) { - allocx = allocp->ptr; - allocp->ptr = p->ptr; - } - p->ptr = setbusy(allocp); - return((char *)(p+1)); -} - -/* freeing strategy tuned for LIFO allocation -*/ -free(ap) -register char *ap; -{ - register union store *p = (union store *)ap; - - ASSERT(p>clearbusy(allocs[1].ptr)&&p<=alloct); - ASSERT(allock()); - allocp = --p; - ASSERT(testbusy(p->ptr)); - p->ptr = clearbusy(p->ptr); - ASSERT(p->ptr > allocp && p->ptr <= alloct); -} - -/* realloc(p, nbytes) reallocates a block obtained from malloc() - * and freed since last call of malloc() - * to have new size nbytes, and old content - * returns new location, or 0 on failure -*/ - -char * -realloc(p, nbytes) -register union store *p; -unsigned nbytes; -{ - register union store *q; - union store *s, *t; - register unsigned nw; - unsigned onw; - - if(testbusy(p[-1].ptr)) - free((char *)p); - onw = p[-1].ptr - p; - q = (union store *)malloc(nbytes); - if(q==NULL || q==p) - return((char *)q); - s = p; - t = q; - nw = (nbytes+WORD-1)/WORD; - if(nw=p) - (q+(q+nw-p))->ptr = allocx; - return((char *)q); -} - -#ifdef DEBUG -allock() -{ -#ifdef DEBUG - register union store *p; - int x; - x = 0; - for(p= &allocs[0]; clearbusy(p->ptr) > p; p=clearbusy(p->ptr)) { - if(p==allocp) - x++; - } - ASSERT(p==alloct); - return(x==1|p==allocp); -#else - return(1); -#endif -} -#endif diff --git a/util/ack/pc/em_pc.c b/util/ack/pc/em_pc.c index 11a87ceae..6b75a9996 100644 --- a/util/ack/pc/em_pc.c +++ b/util/ack/pc/em_pc.c @@ -31,6 +31,7 @@ int toterr; int parent; char *eeflag; +char *vvflag = "-V"; int no_pemflag = 0 ; char *pemflag[MAX_FLAG]; char *eflag; @@ -145,7 +146,7 @@ char *flag(f) char *f; { wflag = f; break; case 'V': - initsizes(f+2); + vvflag = f; return(0); case '{': if ( no_pemflag>=MAX_FLAG ) { @@ -168,10 +169,11 @@ char *flag(f) char *f; { return(0); } -initsizes(vvflag) char *vvflag; { +initsizes(f) FILE *f; { register c, i; - register char *p = vvflag; + register char *p; + p = vvflag + 2; while (c = *p++) { i = atoi(p); while (*p >= '0' && *p <= '9') @@ -194,6 +196,10 @@ initsizes(vvflag) char *vvflag; { (sz_long != 4)) { fatal("bad V-flag %s",vvflag); } + if (sz_head == 0) + sz_head = 6*sz_word + 2*sz_addr; + for (i = 0; i <= sz_last; i++) + fprintf(f, "%d\n",sizes[i]); } /* ------------------ calling sequences -------------------- */ @@ -208,10 +214,7 @@ pem(p,q) char *p,*q; { d = tempfile('d'); if ((erfil = fopen(d,"w")) == NULL) syserr(d); - if (sz_head == 0) - sz_head = 6*sz_word + 2*sz_addr; - for (i = 0; i <= sz_last; i++) - fprintf(erfil, "%d\n",sizes[i]); + initsizes(erfil); fprintf(erfil,"%s\n",basename(source)); for ( i=0 ; i ../../../lib/ego/${m}descr -done diff --git a/util/ego/descr/vax2.descr b/util/ego/descr/vax2.descr deleted file mode 100644 index 8dfc9ace3..000000000 --- a/util/ego/descr/vax2.descr +++ /dev/null @@ -1,117 +0,0 @@ -wordsize: 2 -pointersize: 4 -%%RA -general registers: 3 -address registers: 4 -floating point registers: 0 - -register score parameters: - local variable: - (2 cases) - pointer,pointer - (2 sizes) - fitbyte -> (5,2) - default -> (4,3) - general,general - (2 sizes) - fitbyte -> (3,1) - default -> (2,2) - address of local variable: - (2 cases) - pointer,pointer - (2 sizes) - fitbyte -> (0,1) - default -> (0,2) - general,pointer - (2 sizes) - fitbyte -> (0,1) - default -> (0,2) - constant: - (3 sizes) - in_0_63 -> (0,0) - fitbyte -> (0,1) - default -> (1,2) - double constant: - (1 size) - default -> (-1,-1) - address of global variable: - (1 size) - default -> (2,4) - address of procedure: - (1 size) - default -> (2,4) - -opening cost parameters: - local variable: - (2 cases) - pointer - (2 sizes) - fitbyte -> (10,4) - default -> (9,5) - general - (2 sizes) - fitbyte -> (8,4) - default -> (7,5) - address of local variable: - (2 cases) - pointer - (2 sizes) - fitbyte -> (0,4) - default -> (0,5) - general - (2 sizes) - fitbyte -> (0,4) - general -> (0,5) - constant: - (3 sizes) - in_0_63 -> (4,2) - fitbyte -> (5,3) - default -> (6,4) - double constant: - (1 size) - default -> (1000,1000) - address of global variable: - (1 size) - default -> (6,7) - address of procedure: - (1 size) - default -> (6,7) - -register save costs: - (9 cases) - 0 -> (0,0) - 1 -> (1,0) - 2 -> (2,0) - 3 -> (3,0) - 4 -> (4,0) - 5 -> (5,0) - 6 -> (6,0) - 7 -> (7,0) - 0 -> (0,0) -%%UD -access costs of global variables: - (1 size) - default -> (7,4) -access costs of local variables: - (2 sizes) - fitbyte -> (3,1) - default -> (2,2) -%%SR -overflow harmful?: no -array bound harmful?: no - -%%CS -#include "../../../h/em_mnem.h" -first time then space: -addressing modes: op_adp op_lof op_ldf op_loi op_dch op_lpb -1 - op_adp op_lof op_ldf op_loi op_dch op_lpb -1 -cheap operations: op_cii op_cui op_cfi op_ciu op_cff op_cuu op_cif - op_cmi op_cmf op_cmu op_cms op_cmp -1 - op_cii op_cui op_cfi op_ciu op_cff op_cuu op_cif - op_cmi op_cmf op_cmu op_cms op_cmp -1 -lexical tresholds: 1 1 -indirection limit: 8 -do sli if index?: no no -forbidden operators: -1 -1 -%%SP -global stack pollution allowed?: yes diff --git a/util/led/READ_ME b/util/led/READ_ME deleted file mode 100644 index e612fa34b..000000000 --- a/util/led/READ_ME +++ /dev/null @@ -1,600 +0,0 @@ -You may want to change mach.c in this directory. - -Archives MUST have a table of contents. Arch in subdirectory arch -automatically makes one when you change an archive. - -Several changes in the assembler were needed to have it generate the -necessary output. -A contextual diff follows. You can apply them as follows: -patch -d /usr/em/philips/mach/68000/as < READ_ME - -*** comm0.h.old Thu Dec 6 16:18:39 1984 ---- comm0.h Thu Dec 6 17:49:51 1984 -*************** -*** 213,218 - - /* - * extra type bits out of S_ETC, internal use only - * S_COM: - * - symbols declared by .comm - * S_VAR: - ---- 213,219 ----- - - /* - * extra type bits out of S_ETC, internal use only -+ #ifndef DUK - * S_COM: - * - symbols declared by .comm - #endif DUK -*************** -*** 215,220 - * extra type bits out of S_ETC, internal use only - * S_COM: - * - symbols declared by .comm - * S_VAR: - * - type not known at end of PASS_1 (S_VAR|S_UND) - * - value not known at end of PASS_2 (S_VAR|S_ABS) - ---- 216,222 ----- - #ifndef DUK - * S_COM: - * - symbols declared by .comm -+ #endif DUK - * S_VAR: - * - type not known at end of PASS_1 (S_VAR|S_UND) - * - value not known at end of PASS_2 (S_VAR|S_ABS) -*************** -*** 221,226 - * S_DOT: - * - dot expression - */ - #define S_COM 0x0100 - #define S_VAR 0x0200 - #define S_DOT 0x0400 - ---- 223,229 ----- - * S_DOT: - * - dot expression - */ -+ #ifndef DUK - #define S_COM 0x0100 - #endif DUK - #define S_VAR 0x0200 -*************** -*** 222,227 - * - dot expression - */ - #define S_COM 0x0100 - #define S_VAR 0x0200 - #define S_DOT 0x0400 - /* should be tested by preprocessor - ---- 225,231 ----- - */ - #ifndef DUK - #define S_COM 0x0100 -+ #endif DUK - #define S_VAR 0x0200 - #define S_DOT 0x0400 - /* should be tested by preprocessor -*** comm2.y.old Thu Dec 6 16:19:07 1984 ---- comm2.y Thu Dec 6 16:02:19 1984 -*************** -*** 229,234 - { - #ifdef RELOCATION - if (rflag != 0 && PASS_RELO) - newrelo($1.typ, (int)$0); - #endif - emitx($1.val, (int)$0); - ---- 229,239 ----- - { - #ifdef RELOCATION - if (rflag != 0 && PASS_RELO) -+ #ifdef DUK -+ newrelo($1.typ, -+ (int)$0 | RELBR | RELWR -+ ); -+ #else DUK - newrelo($1.typ, (int)$0); - #endif DUK - #endif -*************** -*** 230,235 - #ifdef RELOCATION - if (rflag != 0 && PASS_RELO) - newrelo($1.typ, (int)$0); - #endif - emitx($1.val, (int)$0); - } - ---- 235,241 ----- - ); - #else DUK - newrelo($1.typ, (int)$0); -+ #endif DUK - #endif - emitx($1.val, (int)$0); - } -*************** -*** 237,242 - { - #ifdef RELOCATION - if (rflag != 0 && PASS_RELO) - newrelo($3.typ, (int)$0); - #endif - emitx($3.val, (int)$0); - ---- 243,253 ----- - { - #ifdef RELOCATION - if (rflag != 0 && PASS_RELO) -+ #ifdef DUK -+ newrelo($3.typ, -+ (int)$0 | RELBR | RELWR -+ ); -+ #else DUK - newrelo($3.typ, (int)$0); - #endif DUK - #endif -*************** -*** 238,243 - #ifdef RELOCATION - if (rflag != 0 && PASS_RELO) - newrelo($3.typ, (int)$0); - #endif - emitx($3.val, (int)$0); - } - ---- 249,255 ----- - ); - #else DUK - newrelo($3.typ, (int)$0); -+ #endif DUK - #endif - emitx($3.val, (int)$0); - } -*** comm3.c.old Wed Jul 11 09:22:24 1984 ---- comm3.c Fri Dec 7 13:06:26 1984 -*************** -*** 11,16 - - struct outhead outhead = { - O_MAGIC, O_STAMP, 0 - #ifdef BYTES_REVERSED - | HF_BREV - #endif - ---- 11,17 ----- - - struct outhead outhead = { - O_MAGIC, O_STAMP, 0 -+ #ifndef DUK - #ifdef BYTES_REVERSED - | HF_BREV - #endif -*************** -*** 17,22 - #ifdef WORDS_REVERSED - | HF_WREV - #endif - }; - - #include "y.tab.h" - ---- 18,24 ----- - #ifdef WORDS_REVERSED - | HF_WREV - #endif -+ #endif DUK - }; - - #include "y.tab.h" -*** comm5.c.old Thu Dec 6 16:19:40 1984 ---- comm5.c Thu Oct 11 14:03:27 1984 -*************** -*** 162,167 - #endif - case STRING: - p = stringbuf; - *p++ = n = getc(tempfile); break; - case OP_EQ: - case OP_NE: - ---- 162,172 ----- - #endif - case STRING: - p = stringbuf; -+ #ifdef DUK -+ *p++ = n = getc(tempfile); -+ p[n] = '\0'; -+ break; -+ #else DUK - *p++ = n = getc(tempfile); break; - #endif DUK - case OP_EQ: -*************** -*** 163,168 - case STRING: - p = stringbuf; - *p++ = n = getc(tempfile); break; - case OP_EQ: - case OP_NE: - case OP_LE: - ---- 168,174 ----- - break; - #else DUK - *p++ = n = getc(tempfile); break; -+ #endif DUK - case OP_EQ: - case OP_NE: - case OP_LE: -*************** -*** 354,359 - break; - if (c == '\\') - c = inescape(); - if (p >= &stringbuf[STRINGMAX]) - fatal("string buffer overflow"); - *p++ = c; - ---- 360,368 ----- - break; - if (c == '\\') - c = inescape(); -+ #ifdef DUK -+ if (p >= &stringbuf[STRINGMAX - 1]) -+ #else DUK - if (p >= &stringbuf[STRINGMAX]) - #endif DUK - fatal("string buffer overflow"); -*************** -*** 355,360 - if (c == '\\') - c = inescape(); - if (p >= &stringbuf[STRINGMAX]) - fatal("string buffer overflow"); - *p++ = c; - } - ---- 364,370 ----- - if (p >= &stringbuf[STRINGMAX - 1]) - #else DUK - if (p >= &stringbuf[STRINGMAX]) -+ #endif DUK - fatal("string buffer overflow"); - *p++ = c; - } -*************** -*** 359,364 - *p++ = c; - } - stringbuf[0] = p - stringbuf - 1; - return(STRING); - } - - ---- 369,377 ----- - *p++ = c; - } - stringbuf[0] = p - stringbuf - 1; -+ #ifdef DUK -+ *p = '\0'; -+ #endif DUK - return(STRING); - } - -*** comm6.c.old Thu Dec 6 16:20:22 1984 ---- comm6.c Wed Oct 3 15:59:31 1984 -*************** -*** 106,111 - sp = §[typ - S_MIN]; - sp->s_item = ip; - sp->s_lign = ALIGNSECT; - ip->i_type = typ | S_EXT; - ip->i_valu = 0; - } else if (typ >= S_MIN) { - ---- 106,114 ----- - sp = §[typ - S_MIN]; - sp->s_item = ip; - sp->s_lign = ALIGNSECT; -+ #ifdef DUK -+ ip->i_type = typ; -+ #else DUK - ip->i_type = typ | S_EXT; - #endif DUK - ip->i_valu = 0; -*************** -*** 107,112 - sp->s_item = ip; - sp->s_lign = ALIGNSECT; - ip->i_type = typ | S_EXT; - ip->i_valu = 0; - } else if (typ >= S_MIN) { - sp = §[typ - S_MIN]; - ---- 110,116 ----- - ip->i_type = typ; - #else DUK - ip->i_type = typ | S_EXT; -+ #endif DUK - ip->i_valu = 0; - } else if (typ >= S_MIN) { - sp = §[typ - S_MIN]; -*************** -*** 180,185 - * for possible relocation - */ - ip->i_valu = outhead.oh_nname; - newsymb(ip->i_name, S_EXT|DOTTYP, (short)0, val); - #endif - } - ---- 184,192 ----- - * for possible relocation - */ - ip->i_valu = outhead.oh_nname; -+ #ifdef DUK -+ newsymb(ip->i_name, S_COM|S_EXT|DOTTYP, (short)0, val); -+ #else DUK - newsymb(ip->i_name, S_EXT|DOTTYP, (short)0, val); - #endif DUK - #endif -*************** -*** 181,186 - */ - ip->i_valu = outhead.oh_nname; - newsymb(ip->i_name, S_EXT|DOTTYP, (short)0, val); - #endif - } - - ---- 188,194 ----- - newsymb(ip->i_name, S_COM|S_EXT|DOTTYP, (short)0, val); - #else DUK - newsymb(ip->i_name, S_EXT|DOTTYP, (short)0, val); -+ #endif DUK - #endif - } - -*************** -*** 255,260 - short s; - { - struct outrelo outrelo; - - if (rflag == 0) - return; - ---- 263,271 ----- - short s; - { - struct outrelo outrelo; -+ #ifdef DUK -+ int iscomm; -+ #endif DUK - - if (rflag == 0) - return; -*************** -*** 272,277 - * b=a - * a: .data2 0 - */ - s &= ~S_COM; - if ((n & RELPC) == 0 && s == S_ABS) - return; - ---- 283,291 ----- - * b=a - * a: .data2 0 - */ -+ #ifdef DUK -+ iscomm = s & S_COM; -+ #endif DUK - s &= ~S_COM; - if ((n & RELPC) == 0 && s == S_ABS) - return; -*************** -*** 285,290 - outrelo.or_type = (char)n; - outrelo.or_sect = (char)DOTTYP; - #ifndef ASLD - if (s == S_UND) { - assert(relonami != 0); - outrelo.or_nami = relonami-1; - ---- 299,307 ----- - outrelo.or_type = (char)n; - outrelo.or_sect = (char)DOTTYP; - #ifndef ASLD -+ #ifdef DUK -+ if (s == S_UND || iscomm) { -+ #else DUK - if (s == S_UND) { - #endif DUK - assert(relonami != 0); -*************** -*** 286,291 - outrelo.or_sect = (char)DOTTYP; - #ifndef ASLD - if (s == S_UND) { - assert(relonami != 0); - outrelo.or_nami = relonami-1; - relonami = 0; - ---- 303,309 ----- - if (s == S_UND || iscomm) { - #else DUK - if (s == S_UND) { -+ #endif DUK - assert(relonami != 0); - outrelo.or_nami = relonami-1; - relonami = 0; -*** comm7.c.old Thu Dec 6 16:20:50 1984 ---- comm7.c Wed Oct 3 16:35:31 1984 -*************** -*** 19,24 - return(ip->i_valu); - return(ip->i_valu + sect[typ].s_base); - #else - if ((ip->i_type & S_TYP) == S_UND) { - if (pass == PASS_3) { - if (relonami != 0) - ---- 19,27 ----- - return(ip->i_valu); - return(ip->i_valu + sect[typ].s_base); - #else -+ #ifdef DUK -+ if ((ip->i_type & S_TYP) == S_UND || (ip->i_type & S_COM)) { -+ #else DUK - if ((ip->i_type & S_TYP) == S_UND) { - #endif DUK - if (pass == PASS_3) { -*************** -*** 20,25 - return(ip->i_valu + sect[typ].s_base); - #else - if ((ip->i_type & S_TYP) == S_UND) { - if (pass == PASS_3) { - if (relonami != 0) - serror("relocation error"); - ---- 23,29 ----- - if ((ip->i_type & S_TYP) == S_UND || (ip->i_type & S_COM)) { - #else DUK - if ((ip->i_type & S_TYP) == S_UND) { -+ #endif DUK - if (pass == PASS_3) { - if (relonami != 0) - serror("relocation error"); -*** mach0.c.old Thu Dec 6 16:21:11 1984 ---- mach0.c Fri Sep 14 14:15:54 1984 -*************** -*** 1,3 - /* @(#)mach0.c 1.5 */ - /* - * Motorola 68000/68010 options - ---- 1,4 ----- -+ #define DUK - /* @(#)mach0.c 1.5 */ - /* - * Motorola 68000/68010 options -*** mach4.c.old Thu Dec 6 16:21:30 1984 ---- mach4.c Thu Dec 6 16:05:00 1984 -*************** -*** 21,26 - fit(fitw($4.val)); - emit2($1 | $2); - #ifdef RELOCATION - newrelo($4.typ, RELPC|RELO2); - #endif - emit2(loww($4.val)); - ---- 21,29 ----- - fit(fitw($4.val)); - emit2($1 | $2); - #ifdef RELOCATION -+ #ifdef DUK -+ newrelo($4.typ, RELPC|RELO2|RELBR|RELWR); -+ #else DUK - newrelo($4.typ, RELPC|RELO2); - #endif DUK - #endif -*************** -*** 22,27 - emit2($1 | $2); - #ifdef RELOCATION - newrelo($4.typ, RELPC|RELO2); - #endif - emit2(loww($4.val)); - } - ---- 25,31 ----- - newrelo($4.typ, RELPC|RELO2|RELBR|RELWR); - #else DUK - newrelo($4.typ, RELPC|RELO2); -+ #endif DUK - #endif - emit2(loww($4.val)); - } -*** mach5.c.old Thu Dec 6 16:21:54 1984 ---- mach5.c Thu Dec 6 16:07:05 1984 -*************** -*** 37,42 - #ifdef RELOCATION - RELOMOVE(relonami, rel_1); - if (flag & ~0xFF) - newrelo(exp_1.typ, flag>>8); - #endif - if (flag & PUTL) - ---- 37,45 ----- - #ifdef RELOCATION - RELOMOVE(relonami, rel_1); - if (flag & ~0xFF) -+ #ifdef DUK -+ newrelo(exp_1.typ, (flag>>8) | RELBR | RELWR); -+ #else DUK - newrelo(exp_1.typ, flag>>8); - #endif DUK - #endif -*************** -*** 38,43 - RELOMOVE(relonami, rel_1); - if (flag & ~0xFF) - newrelo(exp_1.typ, flag>>8); - #endif - if (flag & PUTL) - emit4(exp_1.val); - ---- 41,47 ----- - newrelo(exp_1.typ, (flag>>8) | RELBR | RELWR); - #else DUK - newrelo(exp_1.typ, flag>>8); -+ #endif DUK - #endif - if (flag & PUTL) - emit4(exp_1.val); -*************** -*** 357,362 - fit(fitw(exp.val)); - emit2(opc); - #ifdef RELOCATION - newrelo(exp.typ, RELPC|RELO2); - #endif - emit2(loww(exp.val)); - ---- 361,369 ----- - fit(fitw(exp.val)); - emit2(opc); - #ifdef RELOCATION -+ #ifdef DUK -+ newrelo(exp.typ, RELPC|RELO2|RELBR|RELWR); -+ #else DUK - newrelo(exp.typ, RELPC|RELO2); - #endif DUK - #endif -*************** -*** 358,363 - emit2(opc); - #ifdef RELOCATION - newrelo(exp.typ, RELPC|RELO2); - #endif - emit2(loww(exp.val)); - } - ---- 365,371 ----- - newrelo(exp.typ, RELPC|RELO2|RELBR|RELWR); - #else DUK - newrelo(exp.typ, RELPC|RELO2); -+ #endif DUK - #endif - emit2(loww(exp.val)); - } diff --git a/util/led/byte_order.c b/util/led/byte_order.c deleted file mode 100644 index 08120b0bc..000000000 --- a/util/led/byte_order.c +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef lint -static char rcsid[] = "$Header$"; -#endif lint - -#include "const.h" -#include "assert.h" - -bool bytes_reversed = FALSE; -bool words_reversed = FALSE; - -/* - * Determine the byte/word order in shorts/longs, assuming the size of a short - * is 2 chars, and the size of a long is 4 chars. Not all theoretical - * possibilities are tested; only bytes reversed and/or words reversed. - */ -determine_ordering() -{ - short s; - long l; - register char *cp; - register short *sp; - - cp = (char *)&s; - cp[0] = 0x01; cp[1] = 0x02; - if (s != 0x01 + (0x02 << 8)) - bytes_reversed = TRUE; - sp = (short *)&l; - sp[0] = 0x0001; sp[1] = 0x0002; - if (l != 0x0001 + (0x0002L << 16)) - words_reversed = TRUE; -} - -/* - * `Format' is a string of digits indicating how many bytes must be taken - * from `buf' to form an integer of some type. E.g. if the digit is '2', two - * bytes are taken to form a short. - */ -swap(buf, format) - register char *buf; - register char *format; -{ - register char savebyte; - - while (*format) { - switch (*format++) { - case '1': - buf += 1; - break; - case '2': - if (bytes_reversed) { - savebyte = buf[0]; - buf[0] = buf[1]; - buf[1] = savebyte; - } - buf += 2; - break; - case '4': - /* - * Written out to save recursive calls. - */ - if (bytes_reversed && words_reversed) { - savebyte = buf[0]; - buf[0] = buf[3]; - buf[3] = savebyte; - savebyte = buf[1]; - buf[1] = buf[2]; - buf[2] = savebyte; - } else if (bytes_reversed) { - savebyte = buf[0]; - buf[0] = buf[1]; - buf[1] = savebyte; - savebyte = buf[2]; - buf[2] = buf[3]; - buf[3] = savebyte; - } else if (words_reversed) { - savebyte = buf[0]; - buf[0] = buf[2]; - buf[2] = savebyte; - savebyte = buf[1]; - buf[1] = buf[3]; - buf[3] = savebyte; - } - buf += 4; - break; - default: - assert(FALSE); - break; - } - } -} diff --git a/util/misc/decode.c b/util/misc/decode.c deleted file mode 100644 index 559505465..000000000 --- a/util/misc/decode.c +++ /dev/null @@ -1,499 +0,0 @@ -/* - * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. - * - * This product is part of the Amsterdam Compiler Kit. - * - * Permission to use, sell, duplicate or disclose this software must be - * obtained in writing. Requests for such permissions may be sent to - * - * Dr. Andrew S. Tanenbaum - * Wiskundig Seminarium - * Vrije Universiteit - * Postbox 7161 - * 1007 MC Amsterdam - * The Netherlands - * - */ - -#ifndef NORCSID -static char rcsid[] = "$Header$"; -#endif - -/* - * Decode compact EM assembly language - * - * Author: Johan Stevenson, Vrije Universiteit, Amsterdam - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define get8() ((unsigned)getchar()) - -#define check(x) if (!(x)) fail_check() - -#define MAXSTR 256 - -/* - * global variables - */ - -int opcode; -int offtyp; -long argval; -int dlbval; -char string[MAXSTR]; -int strsiz; - -int wsize; -int psize; -int lineno; -int argnum; -int errors; -char *progname; -char *filename; - -long wordmask[] = { /* allowed bits in a word */ - 0x00000000, - 0x000000FF, - 0x0000FFFF, - 0x00000000, - 0xFFFFFFFF -}; - -long sizemask[] = { /* allowed bits in multiples of 'wsize' */ - 0x00000000, - 0x7FFFFFFF, - 0x7FFFFFFE, - 0x00000000, - 0x7FFFFFFC -}; - -/* - * external tables - */ - -extern char em_flag[]; -extern short em_ptyp[]; -extern char em_mnem[][4]; -extern char em_pseu[][4]; - -/* - * routines - */ - -int get16(); -long get32(); - -main(argc,argv) char **argv; { - - progname = argv[0]; - if (argc >= 2) { - filename = argv[1]; - if (freopen(argv[1],"r",stdin) == NULL) - fatal("can't open %s",argv[1]); - } - if (argc >= 3) - if (freopen(argv[2],"w",stdout) == NULL) - fatal("can't create %s",argv[2]); - if (get16() != sp_magic) - fatal("bad magic word"); - /* In System III the array is called _ctype[] without the trailing '_' */ - (_ctype_+1)['_'] = (_ctype_+1)['a']; - while (nextline()) - ; - return(errors ? -1 : 0); -} - -/* ----- copy ----- */ - -int nextline() { - register t; - - lineno++; - argnum = 1; - switch (t = table1()) { - case EOF: - return(0); - case sp_fmnem: - instr(); - break; - case sp_fpseu: - pseudo(); - break; - case sp_ilb1: - case sp_ilb2: - argnum = 0; - putarg(sp_cst2); - break; - case sp_dlb1: - case sp_dlb2: - case sp_dnam: - argnum = 0; - putarg(t); - break; - default: - error("unknown opcode %d",t); - } - putchar('\n'); - return(1); -} - -instr() { - register i,j,t; - register long l; - - i = opcode - sp_fmnem; - printf(" %s",em_mnem[i]); - j = em_flag[i] & EM_PAR; - if (j == PAR_NO) - return; - t = em_ptyp[j]; - t = getarg(t); - /* - * range checking - */ - switch (j) { - case PAR_N: - check(argval >= 0); - break; - case PAR_G: - if (t != sp_cst2 && t != sp_cst4) - break; - check(argval >= 0); - /* fall through */ - case PAR_L: - l = argval >= 0 ? argval : -argval; - check((l & ~wordmask[psize]) == 0); - break; - case PAR_W: - if (t == sp_cend) - break; - check((argval & ~wordmask[wsize]) == 0); - /* fall through */ - case PAR_S: - check(argval != 0); - /* fall through */ - case PAR_Z: - check((argval & ~sizemask[wsize]) == 0); - break; - case PAR_O: - check(argval != 0); - check((argval & ~sizemask[wsize])==0 || (wsize % argval)==0); - break; - case PAR_B: - t = sp_ilb2; - break; - case PAR_R: - check(argval >= 0 && argval <= 2); - break; - } - putarg(t); -} - -pseudo() { - register i,t; - - i = opcode; - printf(" %s",em_pseu[i - sp_fpseu]); - switch (i) { - case ps_bss: - case ps_hol: - putarg(getarg(cst_ptyp)); - putarg(getarg(val_ptyp)); - putarg(getarg(ptyp(sp_cst2))); - check(argval==0 || argval==1); - break; - case ps_rom: - case ps_con: - putarg(getarg(val_ptyp)); - while ((t = getarg(any_ptyp)) != sp_cend) - putarg(t); - break; - case ps_mes: - putarg(getarg(ptyp(sp_cst2))); - if (argval == ms_emx) { - putarg(getarg(ptyp(sp_cst2))); - check(argval > 0 && argval <= 4); - wsize = (int) argval; - putarg(getarg(ptyp(sp_cst2))); - check(argval > 0 && argval <= 4); - psize = (int) argval; - } - while ((t = getarg(any_ptyp)) != sp_cend) - putarg(t); - break; - case ps_exa: - case ps_ina: - putarg(getarg(sym_ptyp)); - break; - case ps_exp: - case ps_inp: - putarg(getarg(ptyp(sp_pnam))); - break; - case ps_exc: - putarg(getarg(ptyp(sp_cst2))); - putarg(getarg(ptyp(sp_cst2))); - break; - case ps_pro: - putarg(getarg(ptyp(sp_pnam))); - putarg(getarg(cst_ptyp|ptyp(sp_cend))); - break; - case ps_end: - putarg(getarg(cst_ptyp|ptyp(sp_cend))); - break; - default: - error("bad pseudo %d",i); - } -} - -/* ----- input ----- */ - -int getarg(typset) { - register t,argtyp; - - argtyp = t = table2(); - if (t == EOF) - fatal("unexpected EOF"); - t -= sp_fspec; - assert(t >= 0 && t < 16); - t = 1 << t; - if ((typset & t) == 0) - error("bad argument type %d",argtyp); - return(argtyp); -} - -int table1() { - register i; - - i = get8(); - if (i < sp_fmnem+sp_nmnem && i >= sp_fmnem) { - opcode = i; - return(sp_fmnem); - } - if (i < sp_fpseu+sp_npseu && i >= sp_fpseu) { - opcode = i; - return(sp_fpseu); - } - if (i < sp_filb0+sp_nilb0 && i >= sp_filb0) { - argval = i - sp_filb0; - return(sp_ilb2); - } - return(table3(i)); -} - -int table2() { - register i; - - i = get8(); - if (i < sp_fcst0+sp_ncst0 && i >= sp_fcst0) { - argval = i - sp_zcst0; - return(sp_cst2); - } - return(table3(i)); -} - -int table3(i) { - long consiz; - - switch(i) { - case sp_ilb1: - argval = get8(); - break; - case sp_dlb1: - dlbval = get8(); - break; - case sp_dlb2: - dlbval = get16(); - if ( dlbval<0 ) { - error("illegal data label .%d",dlbval); - dlbval=0 ; - } - break; - case sp_cst2: - argval = get16(); - break; - case sp_ilb2: - argval = get16(); - if ( argval<0 ) { - error("illegal instruction label %ld",argval); - argval=0 ; - } - break; - case sp_cst4: - argval = get32(); - break; - case sp_dnam: - case sp_pnam: - getstring(1); - break; - case sp_scon: - getstring(0); - break; - case sp_doff: - offtyp = getarg(sym_ptyp); - getarg(cst_ptyp); - break; - case sp_icon: - case sp_ucon: - case sp_fcon: - getarg(cst_ptyp); - consiz = (long) argval; - getstring(0); - argval = consiz; - break; - } - return(i); -} - -int get16() { - register int l_byte, h_byte; - - l_byte = get8(); - h_byte = get8(); - if ( h_byte>=128 ) h_byte -= 256 ; - return l_byte | (h_byte*256) ; -} - -long get32() { - register long l; - register int h_byte; - - l = get8(); l |= (unsigned)get8()*256 ; l |= get8()*256L*256L ; - h_byte = get8() ; - if ( h_byte>=128 ) h_byte -= 256 ; - return l | (h_byte*256L*256*256L) ; -} - -getstring(ident) { - register char *p; - register n; - - getarg(cst_ptyp); - if (argval < 0 || argval > MAXSTR) - fatal("string/identifier too long"); - strsiz = n = argval; - p = string; - while (--n >= 0) - *p++ = get8(); - if (ident) { - if (!isascii(string[0]) || !isalpha(string[0])) { - identerror(); - return; - } - for (n=strsiz,p=string+1;--n>0;p++) - if (!isascii(*p) || !isalnum(*p)) { - identerror(); - return; - } - } -} - -/* ----- output ----- */ - -putarg(t) { - - if (argnum != 0) - putchar(argnum == 1 ? ' ' : ','); - argnum++; - puttyp(t); -} - -puttyp(t) { - - switch (t) { - case sp_ilb1: - case sp_ilb2: - printf("*%d",(int) argval); - break; - case sp_dlb1: - case sp_dlb2: - printf(".%d",dlbval); - break; - case sp_dnam: - putstr(0,0); - break; - case sp_cst2: - case sp_cst4: - printf("%ld",argval); - break; - case sp_doff: - puttyp(offtyp); - if (argval >= 0) putchar('+'); - printf("%ld",argval); - break; - case sp_pnam: - putstr('$',0); - break; - case sp_scon: - putstr('\'','\''); - break; - case sp_icon: - putstr(0,'I'); - printf("%ld",argval); - break; - case sp_ucon: - putstr(0,'U'); - printf("%ld",argval); - break; - case sp_fcon: - putstr(0,'F'); - printf("%ld",argval); - break; - case sp_cend: - putchar('?'); - break; - } -} - -putstr(c,c2) register c; { - register char *p; - - if (c) - putchar(c); - p = string; - while (--strsiz >= 0) { - c = *p++ & 0377; - if (c >= 040 && c < 0177) { - if (c == '\'' || c == '\\') - putchar('\\'); - putchar(c); - } else - printf("\\%03o",c); - } - if (c2) - putchar(c2); -} - -/* ----- error handling ----- */ - -fail_check() { - error("argument range error"); -} - -identerror() { - error("'%s' is not a correct identifier",string); -} - -/* VARARGS */ -error(s,a1,a2,a3,a4) char *s; { - fprintf(stderr, - "%s: line %d: ", - filename ? filename : progname, - lineno); - fprintf(stderr,s,a1,a2,a3,a4); - fprintf(stderr,"\n"); - errors++; -} - -/* VARARGS */ -fatal(s,a1,a2,a3,a4) char *s; { - error(s,a1,a2,a3,a4); - exit(-1); -} diff --git a/util/misc/encode.c b/util/misc/encode.c deleted file mode 100644 index 0aee6277e..000000000 --- a/util/misc/encode.c +++ /dev/null @@ -1,761 +0,0 @@ -/* - * (c) copyright 1983 by the Vrije Universiteit, Amsterdam, The Netherlands. - * - * This product is part of the Amsterdam Compiler Kit. - * - * Permission to use, sell, duplicate or disclose this software must be - * obtained in writing. Requests for such permissions may be sent to - * - * Dr. Andrew S. Tanenbaum - * Wiskundig Seminarium - * Vrije Universiteit - * Postbox 7161 - * 1007 MC Amsterdam - * The Netherlands - * - */ - -#ifndef NORCSID -static char rcsid[] = "$Header$"; -#endif - -/* - * Encode to compact EM assembly language - * - * Author: Johan Stevenson, Vrije Universiteit, Amsterdam - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define put8(x) putchar(x) - -#define check(x) if (!(x)) fail_check() - -#define fit16i(x) ((x) >= 0xFFFF8000 && (x) <= 0x00007FFF) -#define fit8u(x) ((x) >= 0 && (x) <= 0xFF) - -#define MAXSTR 256 -#define HSIZE 256 -#define EMPTY (EOF-1) - -/* - * global variables - */ - -int opcode; -int offtyp; -long argval; -int dlbval; -char string[MAXSTR]; -int strsiz; - -int wsize; -int psize; -int lineno; -int argnum; -int errors; -char *progname; -char *filename = "INPUT"; - -long wordmask[] = { /* allowed bits in a word */ - 0x00000000, - 0x000000FF, - 0x0000FFFF, - 0x00000000, - 0xFFFFFFFF -}; - -long sizemask[] = { /* allowed bits in multiples of 'wsize' */ - 0x00000000, - 0x7FFFFFFF, - 0x7FFFFFFE, - 0x00000000, - 0x7FFFFFFC -}; - -int peekc = EMPTY; -int hashtab[HSIZE]; -jmp_buf recover; - -/* - * external tables - */ - -extern char em_flag[]; -extern short em_ptyp[]; -extern char em_mnem[][4]; -extern char em_pseu[][4]; - -int main(argc,argv) char **argv; { - - progname = argv[0]; - if (argc >= 2) { - filename = argv[1]; - if (freopen(filename,"r",stdin) == NULL) - fatal("can't open %s",filename); - } - if (argc >= 3) - if (freopen(argv[2],"w",stdout) == NULL) - fatal("can't create %s",argv[2]); - init(); - put16(sp_magic); - setjmp(recover); - while (nextline()) - ; - return(errors ? -1 : 0); -} - -/* ----- copy ----- */ - -int nextline() { - register c,i; - - lineno++; - argnum = 1; - c = nextchar(); - if (c == EOF) - return(0); - if (isspace(c) && c != '\n') { - c = nospace(); - if (isalpha(c)) { - inmnem(c); - if (opcode <= sp_lmnem) - instr(); - else - pseudo(); - } else - peekc = c; - } else if (c == '#') { - line_line(); - } else { - peekc = c; - i = gettyp(sym_ptyp | ptyp(sp_cst2) | ptyp(sp_cend)); - switch (i) { - case sp_cst2: - i = (int) argval; - if (i >= 0 && i < sp_nilb0) - put8(i + sp_filb0); - else - putarg(sp_ilb2); - break; - case sp_dlb2: - case sp_dnam: - putarg(i); - break; - case sp_cend: - break; - } - } - if (nospace() != '\n') - syntax("end of line expected"); - return(1); -} - -instr() { - register i,j,t; - register long l; - - i = opcode; - put8(i); - i -= sp_fmnem; - j = em_flag[i] & EM_PAR; - if (j == PAR_NO) - return; - t = em_ptyp[j]; - if (j == PAR_B) - t = ptyp(sp_ilb2); - t = getarg(t); - /* - * range checking - */ - switch (j) { - case PAR_N: - check(argval >= 0); - break; - case PAR_G: - if (t != sp_cst2 && t != sp_cst4) - break; - check(argval >= 0); - /* fall through */ - case PAR_L: - l = argval >= 0 ? argval : -argval; - check((l & ~wordmask[psize]) == 0); - break; - case PAR_W: - if (t == sp_cend) - break; - check((argval & ~wordmask[wsize]) == 0); - /* fall through */ - case PAR_S: - check(argval != 0); - /* fall through */ - case PAR_Z: - check((argval & ~sizemask[wsize]) == 0); - break; - case PAR_O: - check(argval != 0); - check((argval & ~sizemask[wsize])==0 || (wsize % argval)==0); - break; - case PAR_B: - t = sp_cst2; - break; - case PAR_R: - check(argval >= 0 && argval <= 2); - break; - } - putarg(t); -} - -pseudo() { - register i,t; - - i = opcode; - put8(i); - switch (i) { - case ps_bss: - case ps_hol: - putarg(getarg(cst_ptyp)); - putarg(getarg(val_ptyp)); - putarg(getarg(ptyp(sp_cst2))); - check(argval==0 || argval==1); - break; - case ps_rom: - case ps_con: - putarg(getarg(val_ptyp)); - do - putarg(t = getarg(any_ptyp)); - while (t != sp_cend); - break; - case ps_mes: - putarg(getarg(ptyp(sp_cst2))); - if (argval == ms_emx) { - putarg(getarg(ptyp(sp_cst2))); - check(argval > 0 && argval <= 4); - wsize = (int) argval; - putarg(getarg(ptyp(sp_cst2))); - check(argval > 0 && argval <= 4); - psize = (int) argval; - } - do - putarg(t = getarg(any_ptyp)); - while (t != sp_cend); - break; - case ps_exa: - case ps_ina: - putarg(getarg(sym_ptyp)); - break; - case ps_exp: - case ps_inp: - putarg(getarg(ptyp(sp_pnam))); - break; - case ps_exc: - putarg(getarg(ptyp(sp_cst2))); - putarg(getarg(ptyp(sp_cst2))); - break; - case ps_pro: - putarg(getarg(ptyp(sp_pnam))); - putarg(getarg(cst_ptyp|ptyp(sp_cend))); - break; - case ps_end: - putarg(getarg(cst_ptyp|ptyp(sp_cend))); - break; - default: - syntax("bad pseudo %d",i); - } -} - -/* ----- input ----- */ - -int getarg(typset) { - register c; - - if (argnum != 1) { - c = nospace(); - if (c != ',') { - if (c != '\n') - syntax("comma expected"); - peekc = c; - } - } - argnum++; - return(gettyp(typset)); -} - -int gettyp(typset) { - register c,t,sp; - - c = nospace(); - if (c == '\n') { - peekc = c; - sp = sp_cend; - } else if (isdigit(c) || c == '+' || c == '-' || c == '(') { - sp = inexpr1(c); - if (sp == sp_cst4 && fit16i(argval)) - sp = sp_cst2; - } else if (isalpha(c)) { - inname(c); - sp = offsetted(sp_dnam); - } else if (c == '.') { - in15u(); - dlbval = (int) argval; - sp = offsetted(sp_dlb2); - } else if (c == '*') { - in15u(); - sp = sp_ilb2; - } else if (c == '$') { - inname(nextchar()); - sp = sp_pnam; - } else if (c == '"' || c == '\'') { - sp = instring(c); - } else if (c == '?') { - sp = sp_cend; - } else - syntax("operand expected"); - t = sp - sp_fspec; - assert(t >= 0 && t < 16); - t = 1 << t; - if ((typset & t) == 0) - error("bad argument type %d",sp); - return(sp); -} - -int offsetted(sp) { - register c; - - c = nospace(); - if (c == '+' || c == '-') { - gettyp(cst_ptyp); - if (c == '-') - argval = -argval; - offtyp = sp; - return(sp_doff); - } - peekc = c; - return(sp); -} - -inname(c) register c; { - register char *p; - - if (isalpha(c) == 0) - syntax("letter expected"); - p = string; - do { - if (p < &string[MAXSTR-1]) - *p++ = c; - c = nextchar(); - } while (isalnum(c)); - peekc = c; - *p = '\0'; - strsiz = p - string; -} - -int inmnem(c) register c; { - register unsigned h; - register i; - - inname(c); - h = hash(string); - for (;;) { - h++; - h %= HSIZE; - i = hashtab[h]; - if (i == 0) - syntax("bad mnemonic"); - if (i <= sp_lmnem) { - assert(i >= sp_fmnem); - if (strcmp(string,em_mnem[i - sp_fmnem]) != 0) - continue; - return(opcode = i); - } - assert(i <= sp_lpseu && i >= sp_fpseu); - if (strcmp(string,em_pseu[i - sp_fpseu]) != 0) - continue; - return(opcode = i); - } -} - -int inexpr1(c) register c; { - long left; - - if ((c = inexpr2(c)) != sp_cst4) - return(c); - for (;;) { - c = nospace(); - if (c != '+' && c != '-') { - peekc = c; - break; - } - left = argval; - if (inexpr2(nospace()) != sp_cst4) - syntax("term expected"); - if (c == '+') - argval += left; - else - argval = left - argval; - } - return(sp_cst4); -} - -int inexpr2(c) register c; { - long left; - - if ((c = inexpr3(c)) != sp_cst4) - return(c); - for (;;) { - c = nospace(); - if (c != '*' && c != '/' && c != '%') { - peekc = c; - break; - } - left = argval; - if (inexpr3(nospace()) != sp_cst4) - syntax("factor expected"); - if (c == '*') - argval *= left; - else if (c == '/') - argval = left / argval; - else - argval = left % argval; - } - return(sp_cst4); -} - -inexpr3(c) register c; { - - if (c == '(') { - if (inexpr1(nospace()) != sp_cst4) - syntax("expression expected"); - if (nospace() != ')') - syntax("')' expected"); - return(sp_cst4); - } - return(innumber(c)); -} - -int innumber(c) register c; { - register char *p; - register n; - int expsign; - static char numstr[MAXSTR]; - long atol(); - - p = numstr; - expsign = 0; - if (c == '+' || c == '-') { - if (c == '-') - *p++ = c; - c = nextchar(); - } - if (isdigit(c) == 0) - syntax("digit expected"); - n = sp_cst4; - for (;;) { - if (p >= &numstr[MAXSTR-1]) - fatal("number too long"); - *p++ = c; - c = nextchar(); - if (c == '.' || c == 'e' || c == 'E') { - expsign = c != '.'; - n = sp_fcon; - continue; - } - if (expsign) { - expsign = 0; - if (c == '+' || c == '-') - continue; - } - if (isdigit(c) == 0) - break; - } - peekc = c; - *p = '\0'; - c = nospace(); - if (n == sp_fcon && c != 'F') - syntax("'F' expected"); - if (c == 'I' || c == 'U' || c == 'F') - return(incon(numstr,c)); - peekc = c; - argval = atol(numstr); - return(sp_cst4); -} - -in15u() { - - if (innumber(nextchar()) != sp_cst4) - syntax("integer expected"); - check((argval & ~077777) == 0); -} - -int incon(p,c) register char *p; { - register char *q; - - q = string; - while (*q++ = *p++) - ; - strsiz = q - string - 1; - gettyp(cst_ptyp); - return(c == 'I' ? sp_icon : (c == 'U' ? sp_ucon : sp_fcon)); -} - -int instring(termc) { - register char *p; - register c; - - p = string; - for (;;) { - c = nextchar(); - if (c == '\n' || c == EOF) { - peekc = c; - syntax("non-terminated string"); - } - if (c == termc) { - if (termc == '"') - *p++ = '\0'; - break; - } - if (c == '\\') - c = inescape(); - if (p >= &string[MAXSTR-1]) - fatal("string too long"); - *p++ = c; - } - strsiz = p - string; - return(sp_scon); -} - -int inescape() { - register c,j,r; - - c = nextchar(); - if (c >= '0' && c <= '7') { - r = c - '0'; - for (j = 0; j < 2; j++) { - c = nextchar(); - if (c < '0' || c > '7') { - peekc = c; - return(r); - } - r <<= 3; - r += (c - '0'); - } - return(r); - } - switch (c) { - case 'b': return('\b'); - case 'f': return('\f'); - case 'n': return('\n'); - case 'r': return('\r'); - case 't': return('\t'); - } - return(c); -} - -int nospace() { - register c; - - do - c = nextchar(); - while (isspace(c) && c != '\n'); - if (c == ';') - do - c = nextchar(); - while (c != '\n' && c != EOF); - return(c); -} - -int nextchar() { - register c; - - if (peekc != EMPTY) { - c = peekc; - peekc = EMPTY; - return(c); - } - c = getchar(); - if (isascii(c) == 0 && c != EOF) - fatal("non-ascii char"); - return(c); -} - -line_line() { - register char *p,*q; - static char filebuff[MAXSTR+1]; - - gettyp(ptyp(sp_cst2)); - lineno = (int) (argval-1); - gettyp(ptyp(sp_scon)); - p = string; - q = filebuff; - while (--strsiz >= 0) - *q++ = *p++; - *q = '\0'; - filename = filebuff; -} - -init() { - register i; - - for (i = sp_fmnem; i <= sp_lmnem; i++) - pre_hash(i,em_mnem[i - sp_fmnem]); - for (i = sp_fpseu; i <= sp_lpseu; i++) - pre_hash(i,em_pseu[i - sp_fpseu]); - /* treat '_' as letter */ - /* In System III the array is called _ctype[] without the trailing '_' */ - (_ctype_+1)['_'] = (_ctype_+1)['a']; -} - -pre_hash(i,s) char *s; { - register unsigned h; - - assert(i != 0); - h = hash(s); - for (;;) { - h++; - h %= HSIZE; - if (hashtab[h] == 0) { - hashtab[h] = i; - return; - } - } -} - -int hash(s) register char *s; { - register h; - - h = 0; - while (*s) { - h <<= 1; - h += *s++; - } - return(h); -} - -/* ----- output ----- */ - -putarg(sp) register sp; { - register i; - - switch (sp) { - case sp_ilb2: - i = (int) argval; - if (fit8u(i)) { - put8(sp_ilb1); - put8(i); - break; - } - put8(sp); - put16(i); - break; - case sp_dlb2: - i = dlbval; - if (fit8u(i)) { - put8(sp_dlb1); - put8(i); - break; - } - put8(sp); - put16(i); - break; - case sp_cst2: - case sp_cst4: - if (fit16i(argval) == 0) { - put8(sp_cst4); - put32(argval); - break; - } - i = (int) argval; - if (i >= -sp_zcst0 && i < sp_ncst0 - sp_zcst0) { - put8(i + sp_zcst0 + sp_fcst0); - break; - } - put8(sp_cst2); - put16(i); - break; - case sp_doff: - put8(sp); - putarg(offtyp); - putarg(sp_cst4); - break; - case sp_dnam: - case sp_pnam: - case sp_scon: - put8(sp); - putstr(); - break; - case sp_icon: - case sp_ucon: - case sp_fcon: - put8(sp); - putarg(sp_cst4); - putstr(); - break; - case sp_cend: - put8(sp); - break; - } -} - -putstr() { - register char *p; - long consiz; - - consiz = argval; - argval = strsiz; - putarg(sp_cst4); - argval = consiz; - p = string; - while (--strsiz >= 0) - put8(*p++); -} - -put16(w) int w; { - - put8(w); - put8(w >> 8); -} - -put32(f) long f; { - - put16((int) f); - put16((int)(f >> 16)); -} - -/* ----- error handling ----- */ - -fail_check() { - error("argument range error"); -} - -/* VARARGS */ -error(s,a1,a2,a3,a4) char *s; { - fprintf(stderr,"%s: line %d: ", filename, lineno); - fprintf(stderr,s,a1,a2,a3,a4); - fprintf(stderr,"\n"); - errors++; -} - -/* VARARGS */ -fatal(s,a1,a2,a3,a4) char *s; { - error(s,a1,a2,a3,a4); - exit(-1); -} - -/* VARARGS */ -syntax(s,a1,a2,a3,a4) char *s; { - register c; - - error(s,a1,a2,a3,a4); - do - c = nextchar(); - while (c != '\n' && c != EOF); - longjmp(recover); -}