11.THE LIBRARIES
A Programming Language Manual




You learned how to create functions that perform some specific tasks in your programs and even to group them in separate files. To come to your aid, the GS9 language offers a few sets of predefined functions, grouped in so called libraries. They have different uses, from working with strings, to mathematical functions and even to files access. The console application makes these libraries accessible so all these functions are ready to be used anywhere you need them. Let's have a look at the GS9 libraries.


11.1 Default library

The Default library contains common functions that are used in most programs. In fact, the println instruction from all of your programs, is a function declared in this default library.

gs_error, gs_debug,
new, delete,
gs_compilefile, gs_compilestring, gs_docommand,
gs_gid, gs_gname, gs_gget, gs_gset,
print, println,
ZERO,
NULL,
TYPE_NUM,
TYPE_PTR,
TYPE_TAB,
TYPE_STR,
TYPE_OBJ,
TYPE_FNC,
TYPE_MAX,



11.2 Strings library

The Strings library contains functions to work with strings.

strlen, strpos, stripos, strposr, striposr, strchr, strskip, strsub, strlwr, strupr, strtrim, strreplace, strexplode, strimplode


11.3 Tables library

The Tables library contains functions to work with tables.

tabsize, tabresize, tabsub, tabcut, tabadd, tabins, tabrem, tabset, tabcpy, tabpush, tabpop


11.4 Files library

The Files library contains functions to work with files. It can load and save data from files, create directories, etc.

fopen, fsize, fseek, ftell, fwrite, fwriteb, fwritew, fwritei, fwritef, fwrites, fwritetext, fread, freadb, freadw, freadi, freadf, freads, freadtext, fclose


11.5 Memory library

The Memory library contains functions to work with memory buffers. It can be pretty dangerous if not used correctly.

memalloc, memrealloc, memfree, memcpy, memcmp, memget, memgetw, memgeti, memgetf, memgets, memset, memsetw, memseti, memsetf, memsets


11.6 Math library

The Math library contains mathematical functions.

rand, frand, srand,
sgn, abs,
floor, ceil, round, trunc,
exp, log, pow, sqrt,
sin, cos, tan, asin, acos, atan,
PI, PI2, DEG2RAD, RAD2DEG,



11.7 System library

The System library contains operating system specific functions. Like functions to launch executable files or to pop message boxes.

sys_time, sys_localtime, sys_localdate,
sys_scanln, sys_getchar, sys_getkey,
sys_shell, sys_launch, sys_command, sys_commandline,
sys_fileexist,
sys_fileinfo, sys_filedelete, sys_filefind,
sys_directoryget, sys_directoryset, directorycreate, sys_directorydelete,
sys_messagebox, sys_messagebeep,
MB_OK, MB_OKCANCEL, MB_RETRYCANCEL, MB_YESNO, MB_YESNOCANCEL, MB_ABORTRETRYIGNORE, MB_ICONEXCLAMATION, MB_ICONQUESTION, MB_ICONERROR, MB_SYSTEMMODAL,
IDOK, IDCANCEL, IDYES, IDNO, IDABORT, IDRETRY, IDIGNORE,



11.8 Image library

The Image library contains operating functions for working with images, colors and fonts.

img_info, img_setshader, img_getshader, img_create, img_destroy, img_flip, img_save, img_load, img_fill, img_getpixel, img_setpixel, img_drawbar, img_blit,
fnt_open, fnt_close, fnt_info, fnt_setspacing, fnt_getspacing, fnt_usekerning, fnt_gettextmetrics, fnt_rendertext, COLOR, color_hex,
IMG_SHADER_COPY, IMG_SHADER_COPY_RGB, IMG_SHADER_COPY_A, IMG_SHADER_ALPHA_BLEND, IMG_SHADER_ALPHA_ADD, IMG_SHADER_ALPHA_SUB, IMG_SHADER_ALPHA_MUL, IMG_SHADER_ALPHA_MUL2X, FNT_FLAG_BOLD, FNT_FLAG_ITALIC, FNT_FLAG_ANTI_ALIASING,