1 | /* |
2 | * This Source Code Form is subject to the terms of the Mozilla Public |
3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
5 | * |
6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
7 | */ |
8 | |
9 | #ifndef _MAL_SCOPE_H_ |
10 | #define _MAL_SCOPE_H_ |
11 | |
12 | #include "mal.h" |
13 | /* #define MAL_SCOPE_DEBUG */ |
14 | |
15 | #define MAXSCOPE 256 |
16 | |
17 | typedef struct SCOPEDEF { |
18 | struct SCOPEDEF *link; /* module with same index value */ |
19 | str name; /* index in namespace */ |
20 | Symbol *space; /* type dispatcher table */ |
21 | int isAtomModule; /* atom module definition ? */ |
22 | void *dll; /* dlopen handle */ |
23 | str help; /* short description of module functionality*/ |
24 | } *Module, ModuleRecord; |
25 | |
26 | mal_export Module userModule(void); |
27 | mal_export Module globalModule(str nme); |
28 | mal_export Module fixModule(str nme); |
29 | mal_export Module getModule(str nme); |
30 | mal_export void freeModule(Module cur); |
31 | mal_export void insertSymbol(Module scope, Symbol prg); |
32 | mal_export void deleteSymbol(Module scope, Symbol prg); |
33 | mal_export Module findModule(Module scope, str name); |
34 | mal_export Symbol findSymbol(Module usermodule, str mod, str fcn); |
35 | mal_export Symbol findSymbolInModule(Module v, str fcn); |
36 | mal_export void getModuleList(Module** out, int* length); |
37 | mal_export void freeModuleList(Module* list); |
38 | mal_export void listModules(stream *out, Module s); |
39 | mal_export void dumpModules(stream *out); |
40 | |
41 | #define getSymbolIndex(N) (int)(*(char*)(N)) |
42 | |
43 | #endif /* _MAL_SCOPE_H_ */ |
44 | |