diff --git a/ReadMe.md b/ReadMe.md index 1330efb6..b5dbdb74 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -32,13 +32,14 @@ with the following simple steps. #### 1. Install prerequisites -| Platform | Packages | -| --------- | ------------ | -| Debian/Ubuntu/Mint ... | `apt-get install git` | -| Fedora/RHEL/CentOS ... | `yum install git gcc glibc-static` | -| FreeBSD/OpenBSD/NetBSD | `pkg install git` | -| Cygwin | use setup-x86[_x64] to add packages git, make and gcc-core | -| Darwin | type 'git' at the command line and accept the prompt to install it. | +| Platform | Packages | +| --------- | ------------ | +| Debian/Ubuntu/Mint ... | `apt-get install git` | +| Fedora/RHEL/CentOS ... | `yum install git gcc glibc-static` (`dnf` instead of `yum` on recent Fedoras) | +| FreeBSD/OpenBSD/NetBSD | `pkg install git` | +| OpenSUSE | `zypper install gcc git-core make glibc-devel-static` | +| Cygwin | use setup-x86[_x64] to add packages git, make, diffutils and gcc-core | +| Darwin | type 'git' at the command line and accept the prompt to install it. | More details, including for MingW and MS C, in [**Installation**](/doc/Installation.md). @@ -50,7 +51,7 @@ More details, including for MingW and MS C, in [**Installation**](/doc/Installat Since 'make full' will install the compiler and libraries, it needs root (unix) or administrator (windows) privileges. -#### 3. Stet your PATH environment variable +#### 3. Set your PATH environment variable Set your path to the installed compiler binary location as reported by make full, e.g. diff --git a/doc/Installation.md b/doc/Installation.md index 64c50555..cbd893ca 100644 --- a/doc/Installation.md +++ b/doc/Installation.md @@ -1,152 +1,154 @@ -#### (Work in progress) +## Building and installation summary + +The Oberon compiler and libraries may be built and installed on Linux based, BSD based or Windows based systems. + +Building on Linux and BSD based systems is reasonably straightforward. First make sure you have he right pre-requites like C compiler and static libraries installed, then clone the repository and run `make full`. + +Full instructions for a Linux/BSD based build follow in the next section. -## TODO - - Organise into summary and per-platfrom sections - - with subsections for linux and BSD variants - - Add pre-requisites. E.g. static library support. +Bulding on Windows is not so simple largely because there is more than one way to do it: -#### Building and installation summary - -1. git clone https://github.com/vishaps/voc -2. cd voc -3. [sudo] make full - -Since 'make full' will install the compiler and libraries, it needs root (unix) or administrator (windows) privileges. - -| System | Install dir | Access required | -| ----------------------- | -------------------------------------- | ------------------------------ | -| Linux | /opt/voc | Needs root except under cygwin | -| BSD | /usr/local/share/voc | Needs root | -| Windows (mingw or Visual C) | %ProgramFiles[(X86)]% | Needs administrator | -| Termux (android) | /data/data/com.termux/files/opt/voc | | + - Install the cygwin project and use Windows from the cygwin bash shell rather like Linux. + With the pre-requisites installed using the cygwin setup.exe gui tool, clone and run make + as on Linux. + This builds a compiler that is dependent on the cygwin environment, and which compiles + Oberon programs to binaries that are themselves dependent on the cygwin environment. + + - Install the cygwin project and the mingw compiler. The Oberon compiler this builds is + still dependent on the cygwin environment, but programs built with this compiler are + Windows binaries dependent only on standard Microsoft APIs and libraries. + + - Use the Windows 10 Bash on Ubuntu on Windows (aka WSL - Windows Subsystem for Linux). + The Oberon compiler can be built in the WSL using exactly the same procedure + as on a normal Ubuntu environment, and the resulting compiler and user programs will run + within the Windows subsystem for Linux. + + - Build with the Microsoft C compiler generating native windows binaries. A make.cmd script + is provided which has been developed for and tested with the free 'Visual C++ build tools' + available at http://landinghub.visualstudio.com/visual-cpp-build-tools. + +For building with Cygwin or native Microsoft C environments see [**Cygwin and MSC Installation**](/doc/Winstallation.md) + +The following sections provide more details for Linux based builds. -#### 32 and 64 bit +### Building the Oberon compiler and libraries on a Linux or BSD based system -The size of compiler built is determined by the C compiler that runs, which is in turn determined by -the shell or command prompt configuration you are running under. +This approach is for + - All Linux based systems + - includes Android (specifically termux on Android) + - includes Windows subsystem for Linux (aka Bash on Ubuntu on Windows) + - All BSD based systems + - includes macOS (Darwin) + +#### 1. Install pre-requisites -The following type sizes follow the built compiler size: +The build process has the following pre-requisites: -| Types | 32 bit builds | 64 bit builds | -| ----- | ------------- | ------------- | -| INTEGER | 16 bit | 32 bit | -| LONGINT, SET | 32 bit | 64 bit | + - gcc (or clang) compiler + - static libraries for the chosen compiler + - git + - make + - diff -Note that many library modules have been written with the assumption that INTEGER -is 16 bit and LONGINT 32 bit, therefore they will only work in 32 bit builds. +Example pre-requisite installation commands: -#### Which compiler? (gcc vs clang) +| Platform | Pre-requisite installation | +| --------- | ------------ | +| Debian/Ubuntu/Mint ... | `apt-get install git` | +| Fedora/RHEL/CentOS ... | `yum install git gcc glibc-static` (`dnf` instead of `yum` on recent Fedoras) | +| FreeBSD/OpenBSD/NetBSD | `pkg install git` | +| OpenSUSE | `zypper install gcc git-core make glibc-devel-static` | -By default make uses the compiler defined in variable CC. This can be overriden by running 'export CC=gcc' or 'export CC=clang' from the command line before running make. +On Mac OS (Darwin) just type the git command. OS/X will tell you that it is not installed and ask if you want to install it (say yes). Note that Darwin builds always use clang, the OS will redirect attempts to use gcc to clang. -*Note*: be sure to run 'make clean' any time you change the value of CC. Otherwise directories will be mixed up. +#### 2. Clone the Oberon compiler repository -*Note*: Darwin (MAC OS/X) redirects gcc to clang, so specifying CC=gcc still builds clang binaries under Darwin. +Create and change to a directory in which to make the compiler and clone with this command: + +`git clone https://github.com/vishaps/voc` + +This will create a subdirectory 'voc' which includes the following files and directories: + +| Name | Content | +| --- | --- | +| src/ | Compiler and library source, build tools and tests. | +| bootstrap/ | Pre-generated C source for the compiler targetting the 5 distinct build models needed. | +| doc/ | Documents (including this one). | +| makefile | Makefile for all BSD- and Linux- like environments. Includes tests. | +| make.cmd | Makefile specifically for native Microsoft C builds. No tests. | + +#### 3. Build and install the Oberon compiler and library -#### Building on Windows +``` +cd voc +[sudo] make full +``` -There are three ways to build on Windows: +The makefile will: -| Type | How to build | Compiled binary uses: | -| ----------- | ------- | --------------------- | -| cygwin | Use 'make' from cygwin bash shell. | cygwin.dll | -| mingw under cygwin | Set CC for mingw then use 'make' from cygwin bash shell. | Win32 API | -| Visual C | Use 'make.cmd' from Visual C command prompt. | Win32 API | + - Compile and run a C program that determines your C compiler and OS's configuration and creates + the files Configuration.Make and Configuration.Mod. + - C Compile the bootstrap C sources to generate an interim Oberon compiler for your configuration. + - Use the interim compiler to compile the src/compiler and src/runtime directories and statically + link the final Oberon compiler. This compiler is then used for the remaining steps. + - Build the .sym file browser command `showdef`. + - Build all the libraries in -O2 mode, and a subset in -OC mode. + - Install the compiler and libraries by copying them to an appropriate location for your OS. + - Run a set of confidence tests. -##### mingw on cygwin +Since installation directories are not generally write accessible to normal users, is is necessary to run +the `make full` command from a root shell, or by using `sudo`. -To use mingw, install the correct sized package and export CC= the compiler name: +The makefile will use either gcc or clang, whichever is installed. If you have both installed you can specify which to use by running either `export CC=gcc` or `export CC=clang` before the `make full` command. - - For 32 bit cygwin - - use setup-x86.exe to add the package mingw64-i686-gcc-core. - - run 'export CC=i686-w64-mingw32-gcc' then 'make full' +#### Installation directories: + +If the makefile succeeds it will end with instructions on how to set your path variable so that the +compiler (voc) is found. + +The installation will be found at: + +| System | Install dir | +| ----------------------- | -------------------------------------- | +| All types of Linux | /opt/voc | +| BSD (including Darwin) | /usr/local/share/voc | +| Termux (android) | /data/data/com.termux/files/opt/voc | | - - For 64 bit cygwin +The installation directory contains: - - use setup-x86\_64.exe to add the package mingw64-x86\_64-gcc-core. - - run 'export CC=x86_64-w64-mingw32-gcc' then 'make full' +| Directory | Content | +| --- | --- | +| bin/ | Compiler and symbol file browser command binaries. | +| lib/ | Static and dynamic link libraries for all (-O2 and -OC) type models. | +| 2/include/ | C compiler header files for -O2 modules | +| 2/sym/ | .sym files for -O2 modules | +| C/include/ | C compiler header files for -OC modules | +| C/sym/ | .sym files for -OC modules | -(*Note*: Don't be put off by the name 'mingw64' in the 32 bit package.) -##### Microsoft Visual C compiler -Use the free command line Visual C++ compiler. At the time of writing it can be -downloaded here: +### 32 and 64 bit - http://landinghub.visualstudio.com/visual-cpp-build-tools +The compiler may be built on both 32 bit and 64 bit systems. -For example (Windows 10): +Oberon programs may be compiled using the -O2 (default) or -OC elementary type models. The elementary +types are as follows: -Start an adminstrator command prompt from the start button as follows: +| Model | 8 bit | 16 bit | 32 bit | 64 bit | +| --- | ---- | --- | --- | --- | +| -O2 (default) | `SHORTINT` | `INTEGER` | `LONGINT` and `SET` | `HUGEINT` | +| -OC | `BYTE` | `SHORTINT` | `INTEGER` | `LONGINT` and `SET` | - Start / All apps / Visual C++ Build Tools +A convention of many Oberon compilers has been that LONGINT is a suitable integer type for +manipulating addresses. However since the size of pointer types is fixed by the OS and we +support both 32 and 64 bit operating systems, LONGINT is not always sufficient for us. -Right click on +Accordingly, the SYSTEM module has been updated to ease the development of platform independent +code, with new types such as `SYSTEM.INT8`, `SYSTEM.INT16`, `SYSTEM.INT32`, `SYSTEM.INT64` +and `SYSTEM.ADDRESS`. - Visual C++ 2015 x86 Native Build Tools Command Prompt - -or - - Visual C++ 2015 x64 Native Build Tools Command Prompt - -And select - - More / Administrative Command Prompt - -#### How make adapts to each platform - -On all platforms other than Visual C on Windows, make runs from a bash shell, -using makefile in the enlistment root, and vishap.make in the src/tools/make -directory. - -For Visual C only, there is a slightly cut down implementation of the same -functionality in the file 'make.cmd' in the enlistment root. - -In all cases src/tools/make/configure.c is executed to determine all -platform dependent parameters: it generates two files: - - - Configuration.Make: a set of environment variables included by the makefile - - Configuration.Mod: An Oberon MODULE containing just configuraton constants. - -The following examples correspond to a 32 bit Ubuntu build using GCC: - -Configuration.Make: - - OLANGDIR=/home/dave/projects/oberon/olang - COMPILER=gcc - OS=ubuntu - VERSION=1.2 - ONAME=voc - DATAMODEL=ILP32 - INTSIZE=2 - ADRSIZE=4 - ALIGNMENT=4 - INSTALLDIR=/opt/voc - PLATFORM=unix - BINEXT= - COMPILE=gcc -fPIC -g - STATICLINK=-static - LDCONFIG=if echo "/opt/voc/lib" >/etc/ld.so.conf.d/libvoc.conf; then ldconfig; fi - -Configuration.Mod: - - MODULE Configuration; - CONST - name* = 'voc'; - versionLong* = '1.2 [2016/06/11] for gcc ILP32 on ubuntu'; - intsize* = 2; - addressSize* = 4; - alignment* = 4; - objext* = '.o'; - objflag* = ' -o '; - linkflags* = ' -L"'; - libspec* = ' -l voc'; - compile* = 'gcc -fPIC -g'; - dataModel* = 'ILP32'; - installdir* = '/opt/voc'; - staticLink* = '-static'; - END Configuration. +For details, see [**Features**](doc/Features.md). diff --git a/doc/Winstallation.md b/doc/Winstallation.md new file mode 100644 index 00000000..b7a1f1b0 --- /dev/null +++ b/doc/Winstallation.md @@ -0,0 +1,253 @@ +### Building the Oberon compiler and libraries on a Windows system + +This approach is for Windows systems using + - Cygwin (with or without mingw) + - Microsoft Visual C + +Building on Bash on Ubuntu on Windows (aka Windows Subsystem for Linux) is the same as building on Ubuntu, +for which see [**Installation**](/doc/Installation.md). + +### Building and installing with Cygwin + +Cygwin comes in 32 bit and 64 bit flavours, and both may be installed on a 64 bit system. On such a dual system, Oberon may be built and installed in both Cygwins. + + +#### 1. Install pre-requisites + +The build process has the following pre-requisites: + + - gcc (or clang) compiler + - static libraries for the chosen compiler + - git + - make + - diff + +To install these, run the Cygwin setup program (setup-x86.exe or setup-x86_64.exe as appropriate), work +your way through the initaial questions until you reach the 'Select packages' page, and make sure the +following packages are selected: + +| Section | Package | +| --- | --- | +| devel | binutils | +| devel | git | +| devel | gcc-core | +| devel | make | +| utils | diffutils | + +Click next and continue to the end of setup. + +#### 2. Clone the Oberon compiler repository + +Create and change to a directory in which to make the compiler and clone with this command: + +`git clone https://github.com/vishaps/voc` + +This will create a subdirectory 'voc' including the following files and directories: + +| Name | Content | +| --- | --- | +| src/ | Compiler and library source, build tools and tests. | +| bootstrap/ | Pre-generated C source for the compiler targetting the 5 distinct build models needed. | +| doc/ | Documents (including this one). | +| makefile | Makefile for all BSD- and Linux- like environments. Includes tests. | +| make.cmd | Makefile specifically for native Microsoft C builds. No tests. | + +#### 3. Build and install the Oberon compiler and library + + +``` +cd voc +[sudo] make full +``` + +The makefile will: + + - Compile and run a C program that determines your C compiler and OS's configuration and creates + the files Configuration.Make and Configuration.Mod. + - C Compile the bootstrap C sources to generate an interim Oberon compiler for your configuration. + - Use the interim compiler to compile the src/compiler and src/runtime directories and statically + link the final Oberon compiler. This compiler is then used for the remaining steps. + - Build the .sym file browser command `showdef`. + - Build all the libraries in -O2 mode, and a subset in -OC mode. + - Install the compiler and libraries by copying them to an appropriate location for your OS. + - Run a set of confidence tests. + + + Since installation directories are not generally write accessible to normal users, is is necessary to run + the `make full` command from a root shell, or by using `sudo`. + + #### Installation directories: + + If it succeeds the makefile will end with instructions on how to set your path variable so that the + compiler (voc) is found. + + The installation will be found at: + +| System | Install dir | +| ----------------------- | -------------------------------------- | +| All types of Linux | /opt/voc | +| BSD (including Darwin) | /usr/local/share/voc | +| Termux (android) | /data/data/com.termux/files/opt/voc | | + +The installation directory contains: + +| Directory | Content | +| --- | --- | +| bin/ | Compiler and symbol file browser command binaries. | +| lib/ | Static and dynamic link libraries for all (-O2 and -OC) type models. | +| 2/include/ | C compiler header files for -O2 modules | +| 2/sym/ | .sym files for -O2 modules | +| C/include/ | C compiler header files for -OC modules | +| C/sym/ | .sym files for -OC modules | + + + +### 32 and 64 bit + +The compiler may be built on both 32 bit and 64 bit systems. + +User Oberon programs may be compiled using the -O2 (default) or -OC elementary type models. The elementary +types are as follows: + +| Model | 8 bit types | 16 bit types | 32 bit types | 64 bit types | +| --- | ---- | --- | --- | --- | +| -O2 (default) | `SHORTINT` | `INTEGER` | `LONGINT` and `SET` | `HUGEINT` | +| -OC | `BYTE` | `SHORTINT` | `INTEGER` | `LONGINT` and `SET` | + +Of course the size of pointer types is fixed by the OS. + +The SYSTEM module has been updated to ease the development of platform independent code, with new +types such as `SYSTEM.INT8`, `SYSTEM.INT16`, `SYSTEM.INT32`, `SYSTEM.INT64` and `SYSTEM.ADDRESS`. + +For more details, see [**Features**](doc/Features.md). + +---- + +---- + +The size of compiler built is determined by the C compiler that runs, which is in turn determined by +the shell or command prompt configuration you are running under. + +The following type sizes follow the built compiler size: + +| Types | 32 bit builds | 64 bit builds | +| ----- | ------------- | ------------- | +| INTEGER | 16 bit | 32 bit | +| LONGINT, SET | 32 bit | 64 bit | + +Note that many library modules have been written with the assumption that INTEGER +is 16 bit and LONGINT 32 bit, therefore they will only work in 32 bit builds. + +#### Which compiler? (gcc vs clang) + +By default make uses the compiler defined in variable CC. This can be overriden by running 'export CC=gcc' or 'export CC=clang' from the command line before running make. + +*Note*: be sure to run 'make clean' any time you change the value of CC. Otherwise directories will be mixed up. + +*Note*: Darwin (MAC OS/X) redirects gcc to clang, so specifying CC=gcc still builds clang binaries under Darwin. + + +#### Building on Windows + +There are three ways to build on Windows: + +| Type | How to build | Compiled binary uses: | +| ----------- | ------- | --------------------- | +| cygwin | Use 'make' from cygwin bash shell. | cygwin.dll | +| mingw under cygwin | Set CC for mingw then use 'make' from cygwin bash shell. | Win32 API | +| Visual C | Use 'make.cmd' from Visual C command prompt. | Win32 API | + +##### mingw on cygwin + +To use mingw, install the correct sized package and export CC= the compiler name: + + - For 32 bit cygwin + + - use setup-x86.exe to add the package mingw64-i686-gcc-core. + - run 'export CC=i686-w64-mingw32-gcc' then 'make full' + + - For 64 bit cygwin + + - use setup-x86\_64.exe to add the package mingw64-x86\_64-gcc-core. + - run 'export CC=x86_64-w64-mingw32-gcc' then 'make full' + +(*Note*: Don't be put off by the name 'mingw64' in the 32 bit package.) + +##### Microsoft Visual C compiler + +Use the free command line Visual C++ compiler. At the time of writing it can be +downloaded here: + + http://landinghub.visualstudio.com/visual-cpp-build-tools + +For example (Windows 10): + +Start an adminstrator command prompt from the start button as follows: + + Start / All apps / Visual C++ Build Tools + +Right click on + + Visual C++ 2015 x86 Native Build Tools Command Prompt + +or + + Visual C++ 2015 x64 Native Build Tools Command Prompt + +And select + + More / Administrative Command Prompt + +#### How make adapts to each platform + +On all platforms other than Visual C on Windows, make runs from a bash shell, +using makefile in the enlistment root, and vishap.make in the src/tools/make +directory. + +For Visual C only, there is a slightly cut down implementation of the same +functionality in the file 'make.cmd' in the enlistment root. + +In all cases src/tools/make/configure.c is executed to determine all +platform dependent parameters: it generates two files: + + - Configuration.Make: a set of environment variables included by the makefile + - Configuration.Mod: An Oberon MODULE containing just configuraton constants. + +The following examples correspond to a 32 bit Ubuntu build using GCC: + +Configuration.Make: + + OLANGDIR=/home/dave/projects/oberon/olang + COMPILER=gcc + OS=ubuntu + VERSION=1.2 + ONAME=voc + DATAMODEL=ILP32 + INTSIZE=2 + ADRSIZE=4 + ALIGNMENT=4 + INSTALLDIR=/opt/voc + PLATFORM=unix + BINEXT= + COMPILE=gcc -fPIC -g + STATICLINK=-static + LDCONFIG=if echo "/opt/voc/lib" >/etc/ld.so.conf.d/libvoc.conf; then ldconfig; fi + +Configuration.Mod: + + MODULE Configuration; + CONST + name* = 'voc'; + versionLong* = '1.2 [2016/06/11] for gcc ILP32 on ubuntu'; + intsize* = 2; + addressSize* = 4; + alignment* = 4; + objext* = '.o'; + objflag* = ' -o '; + linkflags* = ' -L"'; + libspec* = ' -l voc'; + compile* = 'gcc -fPIC -g'; + dataModel* = 'ILP32'; + installdir* = '/opt/voc'; + staticLink* = '-static'; + END Configuration. diff --git a/makefile b/makefile index 39da025f..12924600 100644 --- a/makefile +++ b/makefile @@ -85,15 +85,8 @@ usage: @echo " (Needs root access)" @echo "" @echo "Targets for (re)creating and reverting bootstrap C sources:" - @echo " make bootstrap - Uddate bootstrap C source directories. Always run on 64 bit." + @echo " make bootstrap - Update bootstrap C source directories." @echo " make revertbootstrap - Use git checkout to restore bootstrap C source directories" - @echo "" - @echo "" - @echo "Multi-platform coordinated network build:" - @echo " make coordinator - Start central task to trigger builds and collect logs" - @echo " make auto - Start machine specific build server" - @echo " make autobuild - Trigger all machines running 'make auto' to start a build" - @echo " make autobuild - Terminate 'make auto' on all machines" diff --git a/src/compiler/Compiler.Mod b/src/compiler/Compiler.Mod index 4ec44f03..0a373e7a 100644 --- a/src/compiler/Compiler.Mod +++ b/src/compiler/Compiler.Mod @@ -68,7 +68,6 @@ MODULE Compiler; (* J. Templ 3.2.95 *) OPT.intobj.typ := OPT.inttyp; OPT.lintobj.typ := OPT.linttyp; - (*OPT.settyp.size := OPM.SetSize;*) CASE OPM.LongintSize OF |4: OPT.settyp := OPT.set32typ ELSE OPT.settyp := OPT.set64typ diff --git a/src/compiler/OPM.Mod b/src/compiler/OPM.Mod index c72912a7..fe43393b 100644 --- a/src/compiler/OPM.Mod +++ b/src/compiler/OPM.Mod @@ -92,7 +92,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) GlobalAlignment, Alignment*: INTEGER; GlobalOptions*, Options*: SET; - ShortintSize*, IntegerSize*, LongintSize*, SetSize*: INTEGER; + ShortintSize*, IntegerSize*, LongintSize*: INTEGER; MaxIndex*: SYSTEM.INT64; @@ -214,13 +214,7 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) ASSERT((IntegerSize = 2) OR (IntegerSize = 4)); ASSERT((AddressSize = 4) OR (AddressSize = 8)); ASSERT((Alignment = 4) OR (Alignment = 8)); - IF IntegerSize = 2 THEN - LongintSize := 4; - SetSize := 4; - ELSE - LongintSize := 8; - SetSize := 8; - END; + IF IntegerSize = 2 THEN LongintSize := 4 ELSE LongintSize := 8 END; Files.SetSearchPath("") ELSE LogWStr(" warning: option "); @@ -317,11 +311,11 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) BEGIN LogWLn; LogWStr("Type Size"); LogWLn; - LogWStr("SHORTINT "); LogWNum(ShortintSize, 4); (* LogWNum(SIntAlign, 5); *) LogWLn; - LogWStr("INTEGER "); LogWNum(IntegerSize, 4); (* LogWNum(IntAlign, 5); *) LogWLn; - LogWStr("LONGINT "); LogWNum(LongintSize, 4); (* LogWNum(LIntAlign, 5); *) LogWLn; - LogWStr("SET "); LogWNum(SetSize, 4); (* LogWNum(SetAlign, 5); *) LogWLn; - LogWStr("ADDRESS "); LogWNum(AddressSize, 4); (* LogWNum(PointerAlign, 5); *) LogWLn; + LogWStr("SHORTINT "); LogWNum(ShortintSize, 4); LogWLn; + LogWStr("INTEGER "); LogWNum(IntegerSize, 4); LogWLn; + LogWStr("LONGINT "); LogWNum(LongintSize, 4); LogWLn; + LogWStr("SET "); LogWNum(LongintSize, 4); LogWLn; + LogWStr("ADDRESS "); LogWNum(AddressSize, 4); LogWLn; LogWLn; LogWStr("Alignment: "); LogWNum(Alignment, 4); LogWLn; END VerboseListSizes; @@ -344,10 +338,10 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) MaxIndex := SignedMaximum(AddressSize); CASE Model[0] OF - |'2': ShortintSize := 1; IntegerSize := 2; LongintSize := 4; SetSize := 4 - |'C': ShortintSize := 2; IntegerSize := 4; LongintSize := 8; SetSize := 8 - |'V': ShortintSize := 1; IntegerSize := 4; LongintSize := 8; SetSize := 8 - ELSE ShortintSize := 1; IntegerSize := 2; LongintSize := 4; SetSize := 4 + |'2': ShortintSize := 1; IntegerSize := 2; LongintSize := 4 + |'C': ShortintSize := 2; IntegerSize := 4; LongintSize := 8 + |'V': ShortintSize := 1; IntegerSize := 4; LongintSize := 8 + ELSE ShortintSize := 1; IntegerSize := 2; LongintSize := 4 END; IF verbose IN Options THEN VerboseListSizes END; diff --git a/src/compiler/OPP.Mod b/src/compiler/OPP.Mod index 72b6701d..329d52b4 100644 --- a/src/compiler/OPP.Mod +++ b/src/compiler/OPP.Mod @@ -218,6 +218,12 @@ MODULE OPP; (* NW, RC 6.3.89 / 10.2.94 *) (* object model 4.12.93 *) END END ; CheckSym(OPS.colon); Type(typ, OPT.notyp); + + IF ((typ.comp = OPT.Array) OR (typ.comp = OPT.Record)) + & (typ.strobj = NIL) THEN + err(-309) + END; + IF mode = OPT.Var THEN typ^.pvused := TRUE END ; (* typ^.pbused is set when parameter type name is parsed *) WHILE first # NIL DO first^.typ := typ; first := first^.link END ; diff --git a/src/compiler/OPT.Mod b/src/compiler/OPT.Mod index 75ad6c72..54975745 100644 --- a/src/compiler/OPT.Mod +++ b/src/compiler/OPT.Mod @@ -1327,10 +1327,10 @@ BEGIN topScope := NIL; OpenScope(0, NIL); OPM.errpos := 0; EnterProc("NEW", sysnewfn); EnterProc("MOVE", movefn); + syslink := topScope^.right; universe := topScope; topScope^.right := NIL; - EnterTyp("BOOLEAN", Bool, 1, booltyp); EnterTyp("CHAR", Char, 1, chartyp); EnterTyp("REAL", Real, 4, realtyp); @@ -1338,6 +1338,7 @@ BEGIN topScope := NIL; OpenScope(0, NIL); OPM.errpos := 0; EnterTyp("HUGEINT", Int, 8, hinttyp); EnterTyp("BYTE@", Int, 1, cpbytetyp); (* Component Pascal byte type, enabled in Compiler.PropagateElementaryTypeSize *) + (* Type aliases for standard integer and set types are linked to real types in Compiler.PropagateElementaryTypeSize *) EnterTypeAlias("SHORTINT", sintobj); EnterTypeAlias("INTEGER", intobj); EnterTypeAlias("LONGINT", lintobj); diff --git a/src/runtime/Errors.Txt b/src/runtime/Errors.Txt index a5cea1f1..5e608945 100644 --- a/src/runtime/Errors.Txt +++ b/src/runtime/Errors.Txt @@ -176,6 +176,7 @@ Compiler Warnings 306 inappropriate symbol file ignored 307 no ELSE symbol after CASE statement sequence may lead to trap 308 SYSTEM.VAL result includes memory past end of source variable; use SYSTEM.GET +309 you should name this parameter type, or else no actual parameter will match Run-time Error Messages -1 assertion failed, cf. SYSTEM_assert diff --git a/src/tools/make/configure.c b/src/tools/make/configure.c index 13ea087a..24b7b903 100644 --- a/src/tools/make/configure.c +++ b/src/tools/make/configure.c @@ -11,8 +11,6 @@ #define O_VER 1.95 // Version number to be reported by compiler. #define O_NAME voc // Compiler name used for binary, install dir and references in text. -// #define LARGE // Define this to get 32 bit INTEGER and 64 bit longints even on 32 bit platforms. - #include "SYSTEM.h"