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


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

OUT
obj new created object

Creates a new empty object of base gsObj class.

 C/C++ source code


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

IN
obj obj object to be deleted

Deletes a created object.

 C/C++ source code


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

IN
str programfile path to a valid program file
str gfname global function name (optional)
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.
Optional global function name to tell where to put the new global code.


 C/C++ source code


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

IN
str programtext valid program text
str gfname global function name (optional)
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).
Optional global function name to tell where to put the new global code.


 C/C++ source code


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

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

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

Define with the value of num type 0.


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

Define with the value of ptr type NULL.


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

Define with the internal value of the type num (0). Usable with typeof.


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

Define with the internal value of the type ptr (1). Usable with typeof.


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

Define with the internal value of the type tab (2). Usable with typeof.


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

Define with the internal value of the type str (3). Usable with typeof.


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

Define with the internal value of the type obj (4). Usable with typeof.


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

Define with the internal value of the type fnc (5). Usable with typeof.


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

Define with the internal count of types (6).