[core] allow scilab to use more secure hash functions
[scilab.git] / scilab / modules / core / sci_gateway / cpp / core_gw.cpp
1 /*
2 *  Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 *  Copyright (C) 2008-2008 - DIGITEO - Antoine ELIAS
4 *
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  *
7  * This file is hereby licensed under the terms of the GNU GPL v2.0,
8  * pursuant to article 5.3.4 of the CeCILL v.2.1.
9  * This file was originally licensed under the terms of the CeCILL v2.1,
10  * and continues to be available under such terms.
11  * For more information, see the COPYING file which you should have received
12  * along with this program.
13 *
14 */
15
16 #include "core_gw.hxx"
17 #include "context.hxx"
18
19 #define MODULE_NAME L"core"
20 extern "C"
21 {
22 #include "gw_core.h"
23 }
24
25 int CoreModule::Load()
26 {
27     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"type", &sci_type, MODULE_NAME));
28     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getmodules", &sci_getmodules, MODULE_NAME));
29     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getdebuginfo", &sci_getdebuginfo, MODULE_NAME));
30     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getversion", &sci_getversion, MODULE_NAME));
31     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"clear", &sci_clear, MODULE_NAME));
32     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"banner", &sci_banner, MODULE_NAME));
33     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"quit", &sci_quit, MODULE_NAME));
34     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"exit", &sci_exit, MODULE_NAME));
35     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"exists", &sci_exists, MODULE_NAME));
36     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"isdef", &sci_isdef, MODULE_NAME));
37     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"argn", &sci_argn, MODULE_NAME));
38     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"global", &sci_global, MODULE_NAME));
39     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"clearglobal", &sci_clearglobal, MODULE_NAME));
40     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"isglobal", &sci_isglobal, MODULE_NAME));
41     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getos", &sci_getos, MODULE_NAME));
42     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getscilabmode", &sci_getscilabmode, MODULE_NAME));
43     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"with_module", &sci_with_module, MODULE_NAME));
44     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"lasterror", &sci_lasterror, MODULE_NAME));
45     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"warning", &sci_warning, MODULE_NAME));
46     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getmd5", &sci_getmd5, MODULE_NAME));
47     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"hash", &sci_hash, MODULE_NAME));
48     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"error", &sci_error, MODULE_NAME));
49     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"pause", &sci_pause, MODULE_NAME));
50     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"abort", &sci_abort, MODULE_NAME));
51     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"who", &sci_who, MODULE_NAME));
52     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"sciargs", &sci_sciargs, MODULE_NAME));
53     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"format", &sci_format, MODULE_NAME));
54     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"ieee", &sci_ieee, MODULE_NAME));
55     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"typename", &sci_typename, MODULE_NAME));
56     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"funcprot", &sci_funcprot, MODULE_NAME));
57     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"mode", &sci_mode, MODULE_NAME));
58     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"what", &sci_what, MODULE_NAME));
59     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"where", &sci_where, MODULE_NAME));
60     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"getmemory", &sci_getmemory, MODULE_NAME));
61     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"errclear", &sci_errclear, MODULE_NAME));
62     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"intppty", &sci_intppty, MODULE_NAME));
63     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"newfun", &sci_newfun, MODULE_NAME));
64     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"clearfun", &sci_clearfun, MODULE_NAME));
65     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"funptr", &sci_funptr, MODULE_NAME));
66     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"analyzerOptions", &sci_analyzeroptions, MODULE_NAME));
67     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"macr2tree", &sci_macr2tree, MODULE_NAME));
68     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"predef", &sci_predef, MODULE_NAME));
69     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"debug", &sci_debug, MODULE_NAME));
70     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"recursionlimit", &sci_recursionlimit, MODULE_NAME));
71     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"list", &sci_list_gw, MODULE_NAME));
72     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"struct", &sci_struct_gw, MODULE_NAME));
73     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"null", &sci_null, MODULE_NAME));
74     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"insert", &sci_insert, MODULE_NAME));
75     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"cell", &sci_cell_gw, MODULE_NAME));
76     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"makecell", &sci_makecell, MODULE_NAME));
77     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"typeof", &sci_typeof, MODULE_NAME));
78     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"tlist", &sci_tlist_gw, MODULE_NAME));
79     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"mlist", &sci_mlist_gw, MODULE_NAME));
80     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"isfield", &sci_isfield, MODULE_NAME));
81     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"fieldnames", &sci_fieldnames, MODULE_NAME));
82     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"oldEmptyBehaviour", &sci_oldEmptyBehaviour, MODULE_NAME));
83     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"checkNamedArguments", &sci_checkNamedArguments, MODULE_NAME));
84
85 #ifndef NDEBUG
86     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"inspectorGetItemCount", &sci_inspectorGetItemCount, MODULE_NAME));
87     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"inspectorShowItem", &sci_inspectorShowItem, MODULE_NAME));
88     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"inspectorShowUnreferencedItem", &sci_inspectorShowUnreferencedItem, MODULE_NAME));
89     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"inspectorGetItem", &sci_inspectorGetItem, MODULE_NAME));
90     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"inspectorGetUnreferencedItem", &sci_inspectorGetUnreferencedItem, MODULE_NAME));
91     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"inspectorDeleteUnreferencedItems", &sci_inspectorDeleteUnreferencedItems, MODULE_NAME));
92     symbol::Context::getInstance()->addFunction(types::Function::createFunction(L"inspectorGetFunctionList", &sci_inspectorGetFunctionList, MODULE_NAME));
93 #endif
94     return 1;
95 }