Andrew Gregory's Web Pages
Guilderton Lighthouse 30°20'24"S 115°29'31"E
All the modules are in their own OPL files. To use them in your programs you have three choices:
#include
them into your source code.LOADM
/UNLOADM
them into your
application at runtime.Personally, I would recommend the first option (as that is how I do it). I have organised the OPL source for each of the modules into a directory called \OPL\LIB and then refer to them as #include "\opl\lib\foo.opl" in my source. I know of three pre-processors that would work:
directv%:
procedure
and make the filnam$
variable longer (say 64 characters).Please Note: None of the modules require a pre-processor in order to translate successfully. Where necessary, I have edited the code so it would translate using the standard built-in OPL Translator.
All the preprocessors allow you to include other source code files in your
own. It is called the #include
directive. Take a look at the
following fragment of my DarkLight
program:
APP DarkLght TYPE $1000 ICON "\PIC\DARKLGHT.PIC" ENDA PROC main: REM settings/preferences GLOBAL after%, aftert&, before%, beforet&, twlght%, chkep% REM housekeeping GLOBAL laston&, t1&, t2&, havehlp% GLOBAL origbl% :REM original HwGetBackLight setting mpStart%:( "init", "done" ) ENDP #include "\opl\lib\amsync.opl" #include "\opl\lib\iomngr.opl" #include "\opl\lib\findfil.opl" #include "\opl\lib\ini.opl" #include "\opl\lib\misc.opl" PROC init%:
As you can see, it starts off with the standard
APP
..ENDA
block, followed by the starting procedure
for the program. After that is a bunch of #include
directives.
These cause the preprocessors to insert the contents of those files into the
source code that is sent to the
OPL translator. Think
of it as like a cut-and-paste of those files into your source code right then
and there, except that there is only one central copy of the library source
code.
This is pretty simple. Highlight the source code in the OPL editor and then Bring it into your applications source code. Or do it using the clipboard in Windows. Translate. Presto!
This is also quite simple. Compile each library
OPL source file into a
OPO file. Your
application can then use the LOADM
/UNLOADM
commands to
access the library.
LOADM
'd.