1 /*
2 * R : A Computer Language for Statistical Data Analysis
3 * Copyright (C) 2003-2017 The R Core Team.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, a copy is available at
17 * https://www.R-project.org/Licenses/
18 */
19
20 #include <R.h>
21 #include <Rinternals.h>
22 #include "tcltk.h"
23 #include <R_ext/Rdynload.h>
24 #include <R_ext/Visibility.h>
25
26 #define C_DEF(name, n) {#name, (DL_FUNC) &name, n}
27
28 static const R_CMethodDef CEntries[] = {
29 #ifdef Win32
30 C_DEF(tcltk_start, 0),
31 C_DEF(tcltk_end, 0),
32 #else
33 C_DEF(tcltk_init, 1),
34 C_DEF(RTcl_ActivateConsole, 0),
35 #endif
36 {NULL, NULL, 0}
37 };
38
39 #define EXTDEF(name, n) {#name, (DL_FUNC) &name, n}
40
41 static const R_ExternalMethodDef ExternEntries[] = {
42 EXTDEF(dotTcl, -1),
43 EXTDEF(dotTclObjv, 1),
44 EXTDEF(dotTclcallback, -1),
45 EXTDEF(RTcl_ObjFromVar, 1),
46 EXTDEF(RTcl_AssignObjToVar, 2),
47 EXTDEF(RTcl_StringFromObj, 1),
48 EXTDEF(RTcl_ObjAsCharVector, 1),
49 EXTDEF(RTcl_ObjAsDoubleVector, 1),
50 EXTDEF(RTcl_ObjAsIntVector, 1),
51 EXTDEF(RTcl_ObjAsRawVector, 1),
52 EXTDEF(RTcl_ObjFromCharVector, 2),
53 EXTDEF(RTcl_ObjFromDoubleVector, 2),
54 EXTDEF(RTcl_ObjFromIntVector, 2),
55 EXTDEF(RTcl_ObjFromRawVector, 1),
56 /* (..FromRaw... has only 1 arg, no drop=) */
57 EXTDEF(RTcl_ServiceMode, 1),
58 EXTDEF(RTcl_GetArrayElem, 2),
59 EXTDEF(RTcl_RemoveArrayElem, 2),
60 EXTDEF(RTcl_SetArrayElem, 3),
61 {NULL, NULL, 0}
62 };
63
64
R_init_tcltk(DllInfo * dll)65 void attribute_visible R_init_tcltk(DllInfo *dll)
66 {
67 R_registerRoutines(dll, CEntries, NULL, NULL, ExternEntries);
68 R_useDynamicSymbols(dll, FALSE);
69 R_forceSymbols(dll, FALSE);
70 }
71
72