FileInfo II Installation programme


Here is a small installation programme that can be used to install new
extensions into an existing FileInfo. It is intended to be part of a larger
spftware installation package, so just merge it into your own installation
software.


The software provides you with two entry points:

- The 'read_and_install_extensions' function (no parameters)
- The 'install_extension_in_fileinfo2 (fi_ext$,fi_type,fi_flags,fi_name$,
       fi_job$,fi_thing$,fi_file$,fi_command$)' function

Explanations follow:

1 - The 'read_and_install_extensions' function
===============================================

The "read_and_install_extensions" function reads DATAs, and puts them into
a correct format, then calls the 'install_extensions_in_fileinfo2' function.
The DATA must be as follows:
- the number of extension/action blocks (starting at 1)
- then, for each extension/action block:
  * the name of the extension (without any separator such as '_')
  * the action type (probably 0 or 1)
  * the flag(s) - often 0
  * the name to appear in the Menu
  * the name of the mandatory/excluded job(s) - often ""
  * the name of the thing to execute
  * the name of the file to execute
  * the command line to pass to the executed programme

If you do not understand what these parameters are, please read the
(excellent!) FileInfo II manual!

Please note that the "read_and_install_extensions" function contains a
"restore", which you should amend to point to the correct line containing
the first of the DATA statements as mentioned above.

The function returns -15 if the DATA was incorrect, else it returns the
error as returned by:

2 - The "install_extension_in_fileinfo2" function
==================================================

This takes a certain number of paramters, which are just arrays containing
the information required, in the order as given hereabove.
Please note that the arrays start with element 1, not 0, and they must have
the same number of elements. The function checks whether this is the case
and returns an error if not

Errors returned by this function:

-19 : FileInfo just isn't there
-15 : the arrays didn't check

any error from channel opening/writing when attempting to save the file


3 - Creating extension blocks and action blocks
=========================================================

The programme will automatically create either extension blocks or action
blocks, depending on what is required.

It normally creates EXTENSION blocks.

Action blocks are created in two situations:

- If an extension already exists. For example, if you attempt to install
'doc' extension, there is a good chance that this is already contained
in the user's FileInfo database. In that case, the program asks the user
if s/he wishes to add your program to this extension. If the user says no,
then it is not added.

- If you pass an empty string ("") as extension name, either in the DATAs or
in the extension name array passed as parameter to the
"install_extension_in_fileinfo2" function. In this
case, the program attempts to set up an action block for the previous
extension. This means that the first extension name MUST not be an empty
string.


4 - Adapting the program to your own use
========================================

As is, this program sets up its own screen. The channel is contained
in a variable called fi_chan%, set in the procedure
"init_install_extensions_window".
You can, of course, remove the call to this function and set the fi_chan% variable
to another number (this is set in install_extension_in_fileinfo2). It should be
*a "con" channel though. Your window should have space for five lines of text.


Nearly all variables used by the program are locals, or parameters, so they
should not have any influence on your program.

The exception to this is a text array called 'fi2text$'. This contains the
various prompts.


There is smaple DATA and a procedure called 'test' right at the end of the
program - they sould be deleted. You can use test to see how it works.




5 - Using TK II
===============

The  'write_fileinfo_file" function makes use of some TK II keywords
(channel opening/ filetesting).

The rest should be normal S*basic.



Copyright and licence
=====================


This software is Copyright (c)  W. Lenerz  2000
All rights reserved. This software is NOT public domain, however, you are
hereby granted the following licence:

You may use this software, either as is or adapted by you or somebody else,
in your own software. No credit needs to be given to me.

W. Lenerz
