DEFAULT LIBRARY
A Programming Language Manual




gs_error
( lib: Default, file: ../src/gs/gslib_default.cpp )
gs_error( info )

IN
str info error info (optional)

Generates an user error and stop the execution of the program.
If info is specified, the text will be reported along with the error.
It can be used to handle critical errors, that usually shouldn't happend, and to stop program in a "controlled" way.


 C/C++ source code


gs_debug
( lib: Default, file: ../src/gs/gslib_default.cpp )
gs_debug( debuglevel )

IN
int debuglevel binary debug flags

This function is used for advanced debuging.
It changes the processor level of debug, to receive more or less information when an error occures.
The debug level is an integer value with various flag options stored on bits.
bit 0: halt on errors, with a message box info
bit 1: log error description and short call stack info
bit 2: list current function machine code (used when bit 4 is set)
bit 3: list data on the stack (used when bit 4 is set)
bit 4: list extensive info about the current call stack (use bit 2 and 3)
bit 5: dump global variables with names and values
bit 6: dump all functions assemler code
The default level of debug is 3 (halt and short description) and should be enough to track most common errors.




 C/C++ source code


gs_compilefile
( lib: Default, file: ../src/gs/gslib_default.cpp )
int gs_compilefile( programfile )

IN
str programfile path to a valid program file
OUT
int 1=success, 0=fail

Compiles the program contained in the specified file and remember it's content.
The content of the file must be a valid GS9 program (with functions).
If an error occures or the file is not found, it will return false.
Somehow similar to the #include instruction.


 C/C++ source code


gs_compilestring
( lib: Default, file: ../src/gs/gslib_default.cpp )
int gs_compilestring( programtext )

IN
str programtext valid program text
OUT
int 1=success, 0=fail

Compiles the program contained in the specified string and remember it's content.
The content of the string must be a valid GS9 program (with functions).


 C/C++ source code


gs_dofile
( lib: Default, file: ../src/gs/gslib_default.cpp )
int gs_dofile( codefile )

IN
str codefile path to a valid instructions file
OUT
int 1=success, 0=fail

Compiles and execute the instructions contained in the specified file, than forget it's content.
The file must contain valid GS9 instructions, but no functions or other global declarations.
The effect will be like if the code from the file would be in a temporary function and that function is called right there.


 C/C++ source code


gs_dostring
( lib: Default, file: ../src/gs/gslib_default.cpp )
int gs_dostring( codetext )

IN
str codetext valid instrutions text
OUT
int 1=success, 0=fail

Compiles and execute the instructions contained in the specified string, than forget it's content.
The string must contain valid GS9 instructions, but no functions or other global declarations.
The effect will be like if the code from the string would be in a temporary function and that function is called right there.




 C/C++ source code


gs_gid
( lib: Default, file: ../src/gs/gslib_default.cpp )
int gs_gid( varname )

IN
str varname global variable's name
OUT
int variable's id or -1 if not found

Returns the internal index of the varname global variable.
If no global variable is found with the specified name, -1 will be returned.
See the Advanced access chapter.


 C/C++ source code


gs_gname
( lib: Default, file: ../src/gs/gslib_default.cpp )
str gs_gname( gid )

IN
int gid global variable's id
OUT
str global variable's name

Returns the name of a global variable specified by gid internal index.
Use gs_gid to obtain the gid of a global variable.


 C/C++ source code


gs_gget
( lib: Default, file: ../src/gs/gslib_default.cpp )
val gs_gget( gid )

IN
int gid global variable's id
OUT
val global variable's value

Returns the value of a global variable specified by gid internal index.
Use gs_gid to obtain the gid of a global variable.


 C/C++ source code


gs_gset
( lib: Default, file: ../src/gs/gslib_default.cpp )
gs_gset( gid, value )

IN
int gid global variable's id
val value value to set

Sets the value of a global variable specified by the gid internal index.
Use gs_gid to obtain the gid of a global variable.


 C/C++ source code


print
( lib: Default, file: ../src/gs/gslib_default.cpp )
print( ... )

IN
... ... any number of parameters of any type is accepted

Can handle multiple parameters of any type, printing all their values in the console, one by one.
There's an decent limit of length when printing, so huge texts will not be fully displayed.




 C/C++ source code


println
( lib: Default, file: ../src/gs/gslib_default.cpp )
println( ... )

IN
... ... any number of parameters of any type is accepted

Can handle multiple parameters of any type, printing all their values in the console, one by one.
It also adds a new line character (\n), so the next print call will write it's text on the next line.
There's an decent limit of length when printing, so huge texts will not be fully displayed.




 C/C++ source code


ZERO
( lib: Default, file: ../src/gs/gslib_default.cpp )
0.0

Just for fun.


NULL
( lib: Default, file: ../src/gs/gslib_default.cpp )
0

Value of ptr NULL.


TYPE_NUM
( lib: Default, file: ../src/gs/gslib_default.cpp )
0

Value of the type num. Usable with typeof.


TYPE_PTR
( lib: Default, file: ../src/gs/gslib_default.cpp )
1

Value of the type ptr. Usable with typeof.


TYPE_TAB
( lib: Default, file: ../src/gs/gslib_default.cpp )
2

Value of the type tab. Usable with typeof.


TYPE_STR
( lib: Default, file: ../src/gs/gslib_default.cpp )
3

Value of the type str. Usable with typeof.


TYPE_OBJ
( lib: Default, file: ../src/gs/gslib_default.cpp )
4

Value of the type obj. Usable with typeof.


TYPE_FNC
( lib: Default, file: ../src/gs/gslib_default.cpp )
5

Value of the type fnc. Usable with typeof.


TYPE_MAX
( lib: Default, file: ../src/gs/gslib_default.cpp )
6

Number of types supported in GS.