SCLang
Extends:
Constructor Summary
Public Constructor | ||
public |
constructor(options: {}) |
Member Summary
Public Members | ||
public |
log: * |
|
public |
options: * |
|
public |
process: * |
|
public |
stateWatcher: * |
Method Summary
Public Methods | ||
public |
args(options: *): * build args for sclang |
|
public |
boot |
|
public |
executeFile(filename: *): * executeFile |
|
public |
installListeners(subprocess: *, listenToStdin: *) listen to events from process and pipe stdio to the stateWatcher |
|
public |
interpret(code: String, nowExecutingPath: String, asString: Boolean, postErrors: Boolean, getBacktrace: Boolean): Promise interpret |
|
public |
makeSclangConfig(config: object): Promise makeSclangConfig |
|
public |
makeStateWatcher(): * |
|
public |
quit(): * |
|
public |
sclangConfigOptions(options: object): object sclangConfigOptions |
|
public |
spawnProcess(execPath: string, commandLineOptions: object): Promise spawnProcess - starts the sclang executable |
|
public |
storeSclangConf(): * storeSclangConf |
|
public |
write(chunk: *, callback: *, noEcho: *) write |
Public Constructors
public constructor(options: {}) source
Params:
Name | Type | Attribute | Description |
options | {} |
|
Public Members
public log: * source
public options: * source
public process: * source
public stateWatcher: * source
Public Methods
public args(options: *): * source
build args for sclang
-d <path> Set runtime directory -D Enter daemon mode (no input) -g <memory-growth>[km] Set heap growth (default 256k) -h Display this message and exit -l <path> Set library configuration file -m <memory-space>[km] Set initial heap size (default 2m) -r Call Main.run on startup -s Call Main.stop on shutdown -u <network-port-number> Set UDP listening port (default 57120) -i <ide-name> Specify IDE name (for enabling IDE-specific class code, default "none") -a Standalone mode
Params:
Name | Type | Attribute | Description |
options | * |
Return:
* |
public executeFile(filename: *): * source
executeFile
Params:
Name | Type | Attribute | Description |
filename | * |
Return:
* |
public installListeners(subprocess: *, listenToStdin: *) source
listen to events from process and pipe stdio to the stateWatcher
Params:
Name | Type | Attribute | Description |
subprocess | * | ||
listenToStdin | * |
public interpret(code: String, nowExecutingPath: String, asString: Boolean, postErrors: Boolean, getBacktrace: Boolean): Promise source
interpret
evaluates code in sclang and returns a promise
resolves promise with result or rejects with error as JSON
Params:
Name | Type | Attribute | Description |
code | String | source code to evaluate |
|
nowExecutingPath | String | set thisProcess.nowExecutingPath for use in a REPL to evaluate text in a file and let sclang know what file it is executing. |
|
asString | Boolean | return result .asString for post window otherwise returns result as a JSON object |
|
postErrors | Boolean | call error.reportError on any errors which posts call stack, receiver, args, etc |
|
getBacktrace | Boolean | return full backtrace |
public makeSclangConfig(config: object): Promise source
makeSclangConfig
make sclang_config.yaml as a temporary file with the supplied values
This is the config file that sclang reads, specifying includePaths and excludePaths
Params:
Name | Type | Attribute | Description |
config | object | options to write to file |
public sclangConfigOptions(options: object): object source
sclangConfigOptions
Builds the options that will be written to the config file that is read by sclang If supercolliderjs-conf specifies a sclang_conf path then this is read and any includePaths and excludePaths are merged
throws error if config cannot be read
Params:
Name | Type | Attribute | Description |
options | object | supercolliderJs options |
public spawnProcess(execPath: string, commandLineOptions: object): Promise source
spawnProcess - starts the sclang executable
sets this.process adds state listeners
Return:
Promise | resolves null on successful boot and compile rejects on failure to boot or failure to compile the class library |
public write(chunk: *, callback: *, noEcho: *) source
write
send a raw string to sclang to be interpreted callback is called after write is complete
Params:
Name | Type | Attribute | Description |
chunk | * | ||
callback | * | ||
noEcho | * |