Wimp.Install

New Calls

        *WimpSlot

Installation of applications

One of the most annoying problems associated with using application software on floppy disc is that it can be extremely inconvenient, if not impossible, to transfer the software onto a hard disc, without rewriting the boot code.

With regard to this problem, it is extremely useful if application software can find out where its resource files are, without having to have the directory names 'hard-wired' in, and without having to rely on the position of the 'current directory'.

The best way to achieve this is to put all the application software and associated data files into a single directory, including one file which is used to start the whole thing up. When this file is run, it finds out where it has been run from, and the application continues by assuming that the rest of the files are contained within the same directory as the initial file. In this way the whole application can be installed onto a hard disc (or network, or whatever) simply by copying the entire directory across.

Several features have been further built into Arthur 2.00 to make this approach work:

By creating a !Run file with a filetype of &FEB (Obey) it is possible to automatically invoke the application by double-clicking on its directory icon, and for the Obey command file to do some of the donkey-work involved in setting-up the environment for later.

See the documentation for the Obey module.

*WimpSlot

Syntax: *WimpSlot [-min] <number>[K] [[-max] <number>[K]]

If 'K' (or 'k') follows the <number>, the value is multiplied by 1024. <number> can be specified in decimal or &hex, or <base>_<digits>

The WimpSlot command calls Wimp_SlotSize as appropriate to ensure that the right amount of memory is available. If sufficient memory is not available, the error 'Not enough application memory' is returned.

Since high-level language libraries often respond by crashing completely when confronted with insufficient application memory, it is wise for applications to safeguard themselves from such an eventuality by checking that sufficient memory is available before running the main program.

Summary

In summary, an application directory should contain the following files:

        $.!foo                  ; directory name (ie. application)
        $.!foo.!Boot            ; executed by Filer when $ is catalogued
        $.!foo.!Run             ; executed by Filer when !foo is 2-clicked
        $.!foo.<something>      ; specified in !Run file after '-runfile'

An example !Boot obey file would look something like this:

        | > adfs::foodisc.!foo.!Boot
        |
        IconSprites <Obey$Dir>.!Sprites    (contains icon '!foo')
        Set Alias$@RunType_ddd /<Obey$Dir> %%*0

where 'ddd' is the filetype of the data files processed by !foo. Note the '%%*0' on the last line: this is necessary because of the parameter substitution performed by the *obey command.

An example !Run obey file would look something like this:

        | > adfs::foodisc.!foo.!Run
        |
        | The comment lines are useful for reading later
        Set foo$dir <Obey$Dir>
        WimpSlot -min 200k -max 1000k
        Run "<foo$dir>.fooimage" %*0

Note the quotes around the filename, which are needed if <foo$dir>.fooimage is a C program (the C library stuff reads the command line, and would otherwise think that the '<' denotes redirection), and the '%*0' at the end, which ensures that the parameters given to the *Obey command originally are passed through to the main application.