load¶
Loads soar files, rete networks, saved percept streams and external libraries.
Synopsis¶
load file¶
Load and evaluate the contents of a file. The filename
can be a relative path
or a fully qualified path. The source will generate an implicit push to the new
directory, execute the command, and then pop back to the current working
directory from which the command was issued. This is traditionally known as the
source command.
Options¶
Option | Description |
---|---|
filename |
The file of Soar productions and commands to load. |
-a, --all |
Enable a summary for each file sourced |
-d, --disable |
Disable all summaries |
-v, --verbose |
Print excised production names |
Summaries¶
After the source completes, the number of productions sourced and excised is summarized:
This can be disabled by using the -d
flag.
Multiple Summaries¶
A separate summary for each file sourced can be enabled using the -a
flag:
Listing Excised Productions¶
A list of excised productions is available using the -v
flag:
Combining the -a
and -v
flags add excised production names to the output
for each file.
load rete-network¶
The load rete-network
command loads a Rete net previously saved. The Rete net
is Soar's internal representation of production memory; the conditions of
productions are reordered and common substructures are shared across different
productions. This command provides a fast method of saving and loading
productions since a special format is used and no parsing is necessary. Rete-net
files are portable across platforms that support Soar.
If the filename contains a suffix of .Z
, then the file is compressed
automatically when it is saved and uncompressed when it is loaded. Compressed
files may not be portable to another platform if that platform does not support
the same uncompress utility.
Usage¶
load percepts¶
Replays input stored using the capture-input command. The replay file also includes a random number generator seed and seeds the generator with that.
Synopsis¶
Options¶
Option | Description |
---|---|
filename |
Open filename and load input and random seed. |
-o, --open |
Reads captured input from file in to memory and seeds the random number generator. |
-c, --close |
Stop replaying input. |
load library¶
Load a shared library into the local client (for the purpose of, e.g., providing custom event handling).
Options¶
Option | Description |
---|---|
library_name |
The root name of the library (without the .dll or .so extension; this is added for you depending on your platform). |
arguments |
Whatever arguments the library's initialization function is expecting, if any. |
Technical Details¶
Sometimes, a user will want to extend an existing environment. For example, the
person may want to provide custom RHS functions, or register for print events
for the purpose of logging trace information. If modifying the existing
environment is cumbersome or impossible, then the user has two options: create a
remote client that provides the functionality, or use load library. load
library
creates extensions in the local client, making it orders of magnitude
faster than a remote client.
To create a loadable library, the library must contain the following function:
This function is called when load library
loads your library. It is
responsible for any initialization that you want to take place (e.g. registering
custom RHS functions, registering for events, etc).
The argc
and argv
arguments are intended to mirror the arguments that a
standard SML client would get. Thus, the first argument is the name of the
library, and the rest are whatever other arguments are provided. This is to make
it easy to use the same codebase to create a loadable library or a standard
remote SML client (e.g. when run as a standard client, just pass the arguments
main gets into sml_InitLibrary
).
The return value of sml_InitLibrary
is for any error messages you want to
return to the load-library call. If no error occurs, return a zero-length
string.
An example library is provided in the Tools/TestExternalLibraryLib
project.
This example can also be compiled as a standard remote SML client. The
Tools/TestExternalLibraryExe
project tests loading the
TestExternalLibraryLib
library.
Load Library Examples¶
To load TestExternalLibraryLib
:
To load a library that takes arguments (say, a logger):