3.4. Configuration

[<<<] [>>>]

To reach advanced features, like using system include files from predefined directories or using dynamic modules you have to create a configuration file. This configuration file is probably different for most installation and reflects the directory structure, networking environment and other specialties of your setup.

The format of the configuration file is binary. This is to speed up configuration information reading. To create this binary format, you have to edit the text format of the configuration file usually named `scriba.conf.lsp' and have to convert it to binary format using the command line

scriba -k scriba.conf.lsp

The ScriptBasic executable using the option `-D' dumps binary configuration files into text format. Note that this dump program will not restore the comments of the original configuration file nor the line breaks or spaces (except those in strings).

The format of the text file version of the configuration information is simple. It contains the keys and the corresponding values separated by one or more spaces and new lines. Usually a key and the assigned value are written on a line. Lines starting with the character ; are comment.

The values can be integer numbers, real numbers, strings and sub-configurations. Strings can either be single line started and terminated by a single " character or multi-line strings starting and ending with three """ characters, just like in the language ScriptBasic.

Sub-configurations start with the character ( and are closed with the character ). The lists between the parentheses are keys and corresponding values.

[Former versions of ScriptBasic preceding version 2.0.0 did not allow a configuration to have empty sub configuration. Version 2.0.0 and later allow such a configuration part. This may happen in case the configuration file is edited and all the keys in a subconfiguration is commented out. This was a bug that was hard to spot. The later version executed a clean up procedure when reading the text version of the configuration file during configuration compilation and removes the sub tree.]

The keywords of the current version are:

ScriptBasic ignores all lines containing a key that it does not understand. This is dangerous on one hand because it makes typing errors less recognizable. On the other hand it allows different variations share common configuration file. The external modules implemented as dynamic load library functions can also access any configuration data.

An example configuration file from a Windows NT installation:

; scriba.conf
; ScriptBasic sample configuration file
; Note that this configuration file format is from v2.0b1 or later and has to be compiled
; to internal binary format before starting ScriptBasic

; this is the extension of the dynamic load libraries on this system dll ".dll"

; where the modules are to be loaded from module "d:\\MyProjects\\sb\\modules\\" module "d:\\MyProjects\\sb\\sysmodules\\" module "c:\\ScriptBasic\\modules\\"

; where to search system and module include files ; trailing / or \\ is needed include "d:\\MyProjects\\sb\\source\\include\\" include "c:\\ScriptBasic\\source\\include\\"

; ; define external preprocessors ; preproc ( ; extensions that preprocessors are to be applied on extensions ( ; here the key is the extension and the value is the symbolic name of the external ; preprocessor heb "heb" ) ; the external preprocessors external ( heb ( executable "D:\\MyProjects\\sb\\Release\\scriba.exe d:\\MyProjects\\sb\\source\\heber.bas" directory "d:\\MyProjects\\sb\\hebtemp\\"

) ) )


; the maximal number of steps allowed for a program to run ; comment it out or set to zero to have no limit maxstep 30000

; the maximal number of steps allowed for a program to run ; inside a function. ; comment it out or set to zero to have no limit maxlocalstep 0

; the maximal number of recursive function call deepness ; essentially this is the "stack" size maxlevel 300

; the maximal memory in bytes that a basic program is allowed to use ; for its variables maxmem 1000000


; ScriptBasic loads the modules before starting the code ; in the order they are specified here ; ;preload "ext_trial"

; ; This is the directory where we store the compiled code ; to automatically avoid recompilation ; cache "d:\\MyProjects\\sb\\cache\\"

cgi ( ;

; These are the keys used by the CGI module ; debugfile "d:\\MyProjects\\sb\\cgidebug.txt" )

Although Windows NT programs are usually configured using the registry or active directory services ScriptBasic uses a text file to ease and maintain compatibility with UNIX versions.

To ease the compatibility even more the file names are allowed to use the UNIX style forward slash / as directory separator character.

When the program starts one of its first action is to search the configuration file. The search for the configuration file is different on Windows NT and under UNIX operating system.

[<<<] [>>>]