Macros | |
#define | croc_ex_import(t, name) (croc_ex_importNS((t), (name)), croc_pop((t), 1)) |
#define | croc_ex_importStk(t, name) (croc_ex_importNSStk((t), (name)), croc_pop((t), 1)) |
#define | croc_ex_importFromString(t, name, src, srcName) (croc_ex_importFromStringNS((t), (name), (src), (srcName)), croc_pop((t), 1)) |
#define | croc_ex_importFromStringNS(t, name, src, srcName) (croc_pushString((t), (src)), croc_ex_importFromStringNSStk((t), (name), (srcName))) |
#define | croc_ex_importFromStringStk(t, name, srcName) (croc_ex_importFromStringNSStk((t), (name), (src), (srcName)), croc_pop((t), 1)) |
Functions | |
word_t | croc_ex_importNS (CrocThread *t, const char *name) |
word_t | croc_ex_importNSStk (CrocThread *t, word_t name) |
word_t | croc_ex_importFromStringNSStk (CrocThread *t, const char *name, const char *srcName) |
Importing modules.
#define croc_ex_import | ( | t, | |
name | |||
) | (croc_ex_importNS((t), (name)), croc_pop((t), 1)) |
Imports a module, just like an import statement in Croc.
t | is the thread. This will be evaluated by this macro more than once. |
name | is the name of the module to import. |
#define croc_ex_importStk | ( | t, | |
name | |||
) | (croc_ex_importNSStk((t), (name)), croc_pop((t), 1)) |
Like croc_ex_import, but uses a stack slot for the name.
t | is the thread. This will be evaluated by this macro more than once. |
name | should be a stack index of a string containing the name of the module to import. |
#define croc_ex_importFromString | ( | t, | |
name, | |||
src, | |||
srcName | |||
) | (croc_ex_importFromStringNS((t), (name), (src), (srcName)), croc_pop((t), 1)) |
Imports a module from a string.
t | is the thread. This will be evaluated by this macro more than once. |
name | is the module name that it will be imported as. |
src | is the source code as a string. |
srcName | is the name of the source that will be used in error messages. |
#define croc_ex_importFromStringNS | ( | t, | |
name, | |||
src, | |||
srcName | |||
) | (croc_pushString((t), (src)), croc_ex_importFromStringNSStk((t), (name), (srcName))) |
Like croc_ex_importFromString, but leaves the namespace of the imported module on the stack.
#define croc_ex_importFromStringStk | ( | t, | |
name, | |||
srcName | |||
) | (croc_ex_importFromStringNSStk((t), (name), (src), (srcName)), croc_pop((t), 1)) |
Like croc_ex_importFromString, but expects the source on top of the stack instead of as a parameter.
word_t croc_ex_importNS | ( | CrocThread * | t, |
const char * | name | ||
) |
Like croc_ex_import, but leaves the namespace of the imported module on the stack.
word_t croc_ex_importNSStk | ( | CrocThread * | t, |
word_t | name | ||
) |
Like croc_ex_importStk, but leaves the namespace of the imported module on the stack.
word_t croc_ex_importFromStringNSStk | ( | CrocThread * | t, |
const char * | name, | ||
const char * | srcName | ||
) |
Like croc_ex_importFromStringStk, but leaves the namespace of the imported module on the stack.