sysLoadScript |
|
sysLoadScript( const filename) // name of scriptfile Compiles and loads a script file at runtime. The script is searced in the current working directory and all directories listed in environment variable CSSPATH. To access any functions or identifiers in the script they have to be forward declared. Example: #loadLibrary 'KcSysLib' extern var foovar[]; // implemented in foo.css foo(var xy); // implemented in foo.css main() { sysLoadScript('foo'); // load foo.css foovar[1] = 1234; foo('hello'); } CSS won't load the same script more than once; any attemps to do so will be silently ignored. You may want to put the forward declarations into a file foo.hss and include that file at compile time. I recommend to do this by#loadScript rather than #include, because that will avoid multiple loading. (In C/C++ you would have to make constructions like#ifndef _FOO_ ... #define _FOO_ ... body ... #endif) Example: #loadLibrary 'KcSysLib' #loadScript 'foo.hss' // forward declarations main() { sysLoadScript('foo'); // load foo.css at runtime sysLoadScript("scripts\Foo.Css"); // will be ignored since allready loaded foovar[1] = 1234; foo('hello'); } | ||||||||
Copyright © IBK Landquart | Last revised by Peter Koch, 24.02.00 | << Back Top Next >> |