-
-
Notifications
You must be signed in to change notification settings - Fork 12
Lua GSL document where things happens
Francesco edited this page Apr 5, 2020
·
1 revision
The lua-gsl.h and lua-gsl.c implements support for the gsl_shell_state struct.
In lua-gsl.c essentially we:
- create a lua_State (gsl_shell_open function)
- manage the two mutexes that are included in the gsl_shell_state struct
- call the gsl_set_error_handler_off() function (in the function luaopen_gsl)
- set an extern reference to a gdt function so that the gdt static library is not discarded at link time
The files gsl_shell_inter.h and .cpp implements the class gsl_shell. What is done here is essentially what is done in the Lua frontend:
- lua_State is initialized
- commands are taken, as strings, and passed to Lua to be executed
- take care of errors and print them of the screen
- manage incomplete inputs to offer continuation
Initialization happens through the gsl_shell::init() method that calls gsl_shell_open() than execure via lua cpcall the pinit function and finally calls elem::LuaOpenLibrary() to load the elementary plot library.
In turns the pinit function does:
- init the language toolkit calling language_init()
- load standard Lua libraries
- override loaders to use instead the language toolkit's loaders
- call luaopen_gsl(), see above for this latter
- load using Lua's "require" function the "gslext" Lua module