XDS Modula-2 Quick Reference ↩
This document gathers XDS Modula-2 related informations. |
We typically have to deal with one of the following build scenarios :
- we build a Modula-2 application.
- we build a Modula-2 library.
In most cases our program will depend on one or more Modula-2 libraries :
- XDS standard libraries such as
InOut
, - user-defined libraries such as
Terminal2
(see below).
This scenario is the simple one :
- We just need the XDS compiler
xc.exe
. xc.exe
works relative to the current working directory so we definetarget
as our working directory- where we copy resp. generate the input files – e.g. the project file – and
- which we set as the working directory before running
xc.exe
.
Example Hello
has the following directory structure :
> cd F:\examples\Hello > tree /f /a . | findstr /v /b [A-Z] | build.bat | build.sh | Makefile \---src \---main +---mod | hello.mod \---mod-adw hello.mod
The working directory target\
looks as follows after executing the build command :
> tree /f /a target | findstr /v /b [A-Z] | Hello.exe | Hello.obj | Hello.prj | tmp.lnk \---mod hello.mod
- The input files are :
- 1 source file
mod\hello.mod
we simply copy from our source directory. - 1 project file
Hello.prj
we create before invoking the XDS compiler with option=p
<project_file>
. For instance 1 :
> type target\Hello.prj -cpu = 486 -lookup = *.sym = sym;C:\opt\XDS-Modula-2\sym -lookup = *.dll|*.lib = bin;C:\opt\XDS-Modula-2\bin -m2 % -verbose -werr % main module of the program !module mod\Hello.mod
- 1 source file
- The output files are
Hello.obj
andHello.exe
.
Note: See the PDF document
C:\opt\XDS-Modula-2\pdf\xc.pdf
for more details.
This scenario is more involved :
- We need both the XDS compiler
xc.exe
and the XDS library managerxlib.exe
. - Again we define
target
as our build directory- where we copy resp. generate the input files – e.g. the project files – and
- which we set as the working directory before running the XDS tools.
The project directory for the Terminal2
library looks as follows :
> cd F:\examples\Terminal2 > tree /f /a . | findstr /v /b [A-Z] | build.bat | build.sh | Makefile \---src +---main | +---def | | Terminal2.def | +---mod | | Terminal2.mod | \---mod-adw | Terminal2.mod \---test \---mod Terminal2Test.mod
The working directory target\
looks as follows after executing the build command :
> tree /f /a target | findstr /v /b [A-Z] | Terminal2.dll | Terminal2.lib | Terminal2.obj | Terminal2.prj | Terminal2Test.exe | Terminal2Test.obj | Terminal2Test.prj | tmp.lnk +---def | Terminal2.def +---mod | Terminal2.mod +---sym | Terminal2.sym \---test Terminal2Test.mod
- The input files are :
- 3 source files
def\Terminal2.def
,mod\Terminal2.mod
andtest\Terminal2Test.mod
(test module) we simply copy from our source directory. - 2 project files
Terminal2.prj
andTerminal2Test.prj
we create before invoking the XDS compiler with option=p
<project_file>
. For instance 1 :
> type target\Terminal2.prj % write -gendll- to generate an .exe -gendll+ -usedll+ -dllexport+ -implib- -cpu = 486 -lookup = *.sym = sym;C:\opt\XDS-Modula-2\sym -lookup = *.dll|*.lib = bin;C:\opt\XDS-Modula-2\bin -m2 % -verbose -werr % main module of the program !module mod\Terminal2.mod
- 3 source files
- The output files are
Terminal2.dll
,Terminal2.lib
,Terminal2.obj
,Terminal2Text.obj
andTerminal2Text.exe
.
Finally we support 3 ways to build a Modula-2 library, namely with a batch file (build.bat
), a shell script (build.sh
) or a GNU make file (Makefile
). For instance :
> build Usage: build { <option> | <subcommand> } Options: -adw select ADW Modula-2 toolset -debug print commands executed by this script -gm2 select GNU Modula-2 toolset -verbose print progress messages -xds select XDS Modula-2 toolset (default) Subcommands: clean delete generated object files compile compile Modula-2 source files install install library into directory "..\lib\xds" run execute program "Terminal2Test"
We execute the subcommand install
to install the generated files into directory lib\xds\
such that Modula-2 application can refer to them via an IMPORT
clause :
> cd F:\examples\lib > tree /f /a . | findstr /v /b [A-Z] \---xds Liste.dll Liste.lib Liste.obj Liste.sym Terminal2.dll Terminal2.lib Terminal2.sym
Footnotes ▴
[1] Additional MSYS packages ↩
-
The following command prints the full list of compiler options :
> "%XDS_HOME%\bin\xc.exe" =compile =options Options: -ALWAYSINLINE +ASSERT -BSALPHA -BSCLOSURE -BSREDEFINE -CHANGESYM +CHECKDINDEX +CHECKDIV [...]