Difference between revisions of "SCI Programming Language/Files"

From SCI Wiki
Jump to navigationJump to search
 
(14 intermediate revisions by the same user not shown)
Line 19: Line 19:
 
</div><br />
 
</div><br />
  
<div align="center"><span style="font-size: 22pt">Files </span><br />
+
<div align="center"><span style="font-size: 22pt">Files</span><br />
 
''Author: [[Jeff Stephenson]]''</div>
 
''Author: [[Jeff Stephenson]]''</div>
  
 
&nbsp;
 
&nbsp;
  
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.
+
== Files ==
  
classdef
+
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.
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
+
===<br /> classdef ===
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.
+
<blockquote>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.</blockquote>
  
system.sh
+
===<br /> selector ===
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.
+
<blockquote>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.</blockquote>
  
kernel.sh
+
===<br /> system.sh ===
This contains the definitions for interfacing with the kernel.
+
<blockquote>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.</blockquote>
  
game.sh
+
===<br /> kernel.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.
+
<blockquote>This contains the definitions for interfacing with the kernel.</blockquote>
  
classes.txt
+
===<br /> game.sh ===
This is a text file produced by the compiler that is used by a BRIEF macro to browse the SCI class system.
+
<blockquote>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.</blockquote>
  
offsets.txt
+
===<br /> classes.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.
+
<blockquote>This is a text file produced by the compiler that is used by a BRIEF macro to browse the SCI class system.</blockquote>
  
994.voc
+
===<br /> offsets.txt ===
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.
+
<blockquote>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.</blockquote>
  
996.voc
+
===<br /> 994.voc ===
This is the class table. It specifies the number of the script files that contain each class.
+
<blockquote>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.</blockquote>
  
997.voc
+
===<br /> 996.voc ===
This file contains the names of selectors. It is only used by the debugger and in printing error messages.
+
<blockquote>This is the class table. It specifies the number of the script files that contain each class.</blockquote>
  
 +
===<br /> 997.voc ===
 +
<blockquote>This file contains the names of selectors. It is only used by the debugger and in printing error messages.</blockquote>
  
Page 25
+
===<br /> $$$sc.lck ===
 
+
<blockquote>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.</blockquote>
 
+
&nbsp;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
$$$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:
 
The following two SCI commands deal with source code organization:
  
script#
+
===<br /> script# ===
The script# command sets the script number of the output file.
+
<blockquote>The script# command sets the script number of the output file.
  
(script# 4)
+
<code>(script# 4)</code>
  
 
sets the output file names to 4.scr and 4.hep, regardless of the actual name of the
 
sets the output file names to 4.scr and 4.hep, regardless of the actual name of the
source file.
+
source file.</blockquote>
  
include
+
===<br /> scriptID ===
 +
<blockquote><div id="scriptID"></div><code>(scriptID 86 0)</code></blockquote>
  
This includes a header file in the current source file at the current position.
+
<blockquote>Unknown hand written note</blockquote>
  
(include "/sc/foo.sh") or (include /sc/foo.sh)
+
===<br /> include ===
 +
<blockquote>This includes a header file in the current source file at the current position.
  
includes the file /sc/foo.sh. Include files may be nested as deeply as desired.
+
<code>(include "/sc/foo.sh")</code> or <code>(include /sc/foo.sh)</code>
  
 +
includes the file /sc/foo.sh. Include files may be nested as deeply as desired.</blockquote>
 +
&nbsp;
  
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:
+
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 <div id="sinclude"></div>'''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
+
<blockquote><code>set sinclude=f:/games/sci/system;c:/include</code></blockquote>
  
 
to your autoexec.bat file.
 
to your autoexec.bat file.
 
 
Page 26
 
 
 
 
 
 
 
Compiling SCI Code
 
 
The SCI compiler is invoked with the command:
 
 
sc filel [file2] [file3] [options]
 
 
Any number of file specifications may be entered on the command line, and a file specification may include wild-card names.
 
 
Options
 
 
-a
 
Abort compile if the file is already locked.
 
 
-d
 
Include debugging information so that the debugger can display source code.
 
 
-D<str>
 
Create a command line define which has the same result as using the define statement in a source file (except that spaces and some other characters are not permitted).
 
 
-g<num> Define maximum number of global or local variables. The default is 750.
 
 
-I
 
Generate an assembly language code listing for the file with the original source interspersed. This is useful when using the built-in debugger of SCI. When compiling filename.sc, the list file is named filename.sl.
 
 
-n
 
Turns off "auto-naming" of objects. As described in the appendix on object-oriented programming, each object has a name property which is used to represent the object textually. Unless the property is explicitly set, the compiler will generate the value for this property automatically, using the object's symbol string for the name. The object names, however, take up space. While they are useful (almost vital) for debugging, if you're running out of memory in a room, it might help to compile with the -n option to leave the names out.
 
 
-O
 
Use offset.txt to generate 994.voc.
 
 
-oout-dir
 
Set the directory for the output files to out-dir.
 
 
-s
 
Display a message when a forward referenced selector is used.
 
 
-v
 
Do not lock the class database.
 
 
-w
 
Output words high-byte first (for the Macintosh).
 
 
-z
 
Turn off optimization. Not a particularly useful option except for those of us who must maintain the compiler.
 
 
 
Page 27
 
 
 
 
 
 
 
  
 
&nbsp;
 
&nbsp;
Line 162: Line 96:
 
<references />
 
<references />
  
&nbsp;
+
[[SCI Programming Language | Table of Contents]]
 
 
[[The SCI Programming Language | Table of Contents]]
 
 
 
&nbsp;
 
  
<span style="float: left">[[The SCI Programming Language |&lt; Previous: Table of Contents]]</span><span style="float: right">[[The SCI Programming Language/Files|Next: Files &gt;]]</span>
+
<span style="float: left">[[SCI Programming Language/Procedures|&lt; Previous: Procedures]]</span>
 +
<span style="float: right">[[SCI Programming Language/Compiling SCI|Next: Compiling SCI &gt;]]</span>
  
 
&nbsp;
 
&nbsp;
  
 
[[Category:SCI Documentation]]
 
[[Category:SCI Documentation]]
 +
[[Category:SCI32]]
 
[[Category:Scripting]]
 
[[Category:Scripting]]

Latest revision as of 19:32, 26 May 2016

Official SCI Documentation

Chapter: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Index


Files
Author: Jeff Stephenson

 

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


Table of Contents

< Previous: Procedures Next: Compiling SCI >