Test Module  -  A relocatable module shell

by Lee Calcraft

This item is designed to accompany the article in this month's RISC User magazine entitled Creating Relocatable Modules. The article describes the principles behind relocatable modules and gives detaild advice on how to create your own simple modules.

The test module provided here is not intended to perform any useful function, but is simply an example of a module which implements two operating system star commands. It can be used as the basis for experimentation by any readers wishing to write their own modules.

Running the item from the RISC User menu system opens a directory viewer containing the module, TestModule, and its source code, TestSource. The source code is a Basic program and is fully commented enabling you to see how the module is constructed. Double-clicking on the TestModule file will install the module. The module implements two star commands, Test and Dummy. To test the module out once installed, press F12 to get to the command line, then enter:
     Help TestModule
You should get a response as follows:
     ==> Help on keyword TestModule
     Module is: Test Module     1.00 (01 Dec 1994)

     Commands provided:
     Test    Dummy

The command Test has no parameters, so you can try this out by simply entering:
     Test
This should result in the following message:
     The response to *Test

The command Dummy expects between one and two parameters (though as this is just an example any values entered into these parameters will have no effect). Thus if you enter simply:
     Dummy
you will see the message:
     Syntax: *Dummy <n> [<m>]
which indicates that you have got the syntax wrong, and the command is expecting at least one and possible two parameters. If you now enter:
     Dummy 123 456
you will see the message:
     The response to *Dummy
which is the normal action performed by the command.

If you are interested in writing modules to implement your own star commands as part of the operating system, it is recommended that you read the article in this month's magazine. In a future article, we will describe how to use a module to implement your own SWI calls.

Copyright  RISC User 1995
