SCI Programming Language/Files
Files
Source files for the script compiler traditionally have the extension .sc. Header (include) files traditionally have the extension .sh. Message editor header files traditionally have the extension .shm. Source files may have any filename; two examples are banner.sc and castle.sc. The two output files from the compilation will have the names number.scr and number.hep where number is the script# (defined below) of the module. Following are other files (besides the source file and any user-defined header files) which are involved in a compilation.
classdef
This file contains the information about the structure of the classes which have been defined in the application. It is read automatically by the compiler and is rewritten by the compiler after a successful compilation in order to keep it up to date.
selector
This file contains definitions of selectors which are used in object-oriented programming. It is automatically included in a compile and, like classdef, is rewritten after a successful compile. Any symbol in a properties or methods statement or in the selector position in a send to an object is assumed to be a selector and is assigned a selector number included in selector.
system.sh
This contains the definitions for interfacing with the various system classes and procedures. It also contains the system global variable definitions and defines for keycodes, script numbers, etc. It is automatically included in all compiles.
kernel.sh
This contains the definitions for interfacing with the kernel.
game.sh
This is the game-specific header file. It contains global variables, procedure declarations, and definitions for an individual game. It is automatically included in the compile after system.sh.
classes.txt
This is a text file produced by the compiler that is used by a BRIEF macro to browse the SCI class system.
offsets.txt
This is a text file that contains a list of class-selector pairs for frequently used properties. It is used by the compiler to produce 994.voc.
994.voc
For each class-selector pair in offsets.txt, the compiler writes an entry to this file containing the offset of that property in an SCI object. With this information, the interpreter can access a frequently used property without going through the message-passing mechanism. It is generated by the compiler when the -0 command line parameter is used.
996.voc
This is the class table. It specifies the number of the script files that contain each class.
997.voc
This file contains the names of selectors. It is only used by the debugger and in printing error messages.
$$$sc.lck
This read-only file serves as a semaphore, indicating that a compile is occurring in the current directory. This prevents two compiles from trying to do the same task concurrently (updating the same classdef, for instance). $$$sc.lck is created at the beginning of a compile and deleted at the end.
The following two SCI commands deal with source code organization:
script#
The script# command sets the script number of the output file.
(script# 4)
sets the output file names to 4.scr and 4.hep, regardless of the actual name of the
source file.
scriptID
(scriptID 86 0)
Unknown hand written note
include
This includes a header file in the current source file at the current position.
(include "/sc/foo.sh")
or(include /sc/foo.sh)
includes the file /sc/foo.sh. Include files may be nested as deeply as desired.
When compiling or including a file, the compiler first looks in the current directory. If it fails to find it there, it next looks for the file in the directories specified in the environment variable
sinclude. This variable is just like the DOS path variable. The search directories are separated by semicolons. To set the compiler to look for include files in f:/games/scilsystem and c:/include if it doesn't find them in the current directory, add the line:
set sinclude=f:/games/sci/system;c:/include
to your autoexec.bat file.
- Notes
< Previous: Procedures Next: Compiling SCI >