]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wxSWIG/swig_lib/tcl/constarray.i
fix text scrolling in GTK2 (patch 703988)
[wxWidgets.git] / wxPython / wxSWIG / swig_lib / tcl / constarray.i
CommitLineData
c90f71dd
RD
1// constarray.i
2//
3// This module changes SWIG to place constant values into a Tcl array
4
5
6#ifdef AUTODOC
7%subsection "Array Constants",pre
8%text %{
9%include constarray.i
10
11This module changes SWIG so that constant values are placed into a Tcl
12array instead of global variables. The array is given the same name as
13the SWIG module (specified with the %module directive).
14
15This module should generally be included at the top of an interface
16file before any declarations appear. Furthermore, this module changes
17the default handling of basic datatypes including integers, floats,
18and character strings.
19
20When this module is used, constants are simply accessed through the
21module name. For example :
22
23 %module example
24 ...
25 #define FOO 42
26
27would be accessed as '$example(FOO)'
28
29Note : This module replaces the existing mechanism for creating constants.
30The method used by this module is based on a set of typemaps supplied
31by Tim Medley.
32%}
33#endif
34
35%typemap(tcl,const) int SWIG_DEFAULT_TYPE,
36 unsigned int SWIG_DEFAULT_TYPE,
37 long SWIG_DEFAULT_TYPE,
38 unsigned long SWIG_DEFAULT_TYPE,
39 short SWIG_DEFAULT_TYPE,
40 unsigned short SWIG_DEFAULT_TYPE,
41 unsigned char SWIG_DEFAULT_TYPE,
42 signed char SWIG_DEFAULT_TYPE
43{
44 static int ivalue = (int) $source;
45 Tcl_LinkVar(interp,SWIG_name "($target)",(char *) &ivalue, TCL_LINK_INT | TCL_LINK_READ_ONLY);
46}
47
48%typemap(tcl,const) float SWIG_DEFAULT_TYPE,
49 double SWIG_DEFAULT_TYPE
50{
51 static double dvalue = (double) $source;
52 Tcl_LinkVar(interp, SWIG_prefix SWIG_name "($target)",(char *) &dvalue, TCL_LINK_DOUBLE | TCL_LINK_READ_ONLY);
53}
54
55%typemap(tcl,const) char *SWIG_DEFAULT_TYPE
56{
57 static char *cvalue = $source;
58 Tcl_LinkVar(interp, SWIG_prefix SWIG_name "($target)",(char *) &cvalue, TCL_LINK_STRING | TCL_LINK_READ_ONLY);
59}
60
61%typemap(tcl,const) Pointer *SWIG_DEFAULT_TYPE
62{
63 static char *pvalue;
64 pvalue = (char *) malloc(20+strlen("$mangle"));
65 SWIG_MakePtr(pvalue, (void *) ($source), "$mangle");
66 Tcl_LinkVar(interp, SWIG_prefix SWIG_name "($target)",(char *) &pvalue, TCL_LINK_STRING | TCL_LINK_READ_ONLY);
67}
68
69// ----------------------------------------------------------------------------------
70// Tcl 8 Object versions
71// ----------------------------------------------------------------------------------
72
73%typemap(tcl8,const) int SWIG_DEFAULT_TYPE,
74 unsigned int SWIG_DEFAULT_TYPE,
75 long SWIG_DEFAULT_TYPE,
76 unsigned long SWIG_DEFAULT_TYPE,
77 short SWIG_DEFAULT_TYPE,
78 unsigned short SWIG_DEFAULT_TYPE,
79 unsigned char SWIG_DEFAULT_TYPE,
80 signed char SWIG_DEFAULT_TYPE
81{
82 static int ivalue = (int) $source;
83 Tcl_LinkVar(interp, SWIG_prefix SWIG_name "($target)",(char *) &ivalue, TCL_LINK_INT | TCL_LINK_READ_ONLY);
84}
85
86%typemap(tcl8,const) float SWIG_DEFAULT_TYPE,
87 double SWIG_DEFAULT_TYPE
88{
89 static double dvalue = (double) $source;
90 Tcl_LinkVar(interp, SWIG_prefix SWIG_name "($target)",(char *) &dvalue, TCL_LINK_DOUBLE | TCL_LINK_READ_ONLY);
91}
92
93%typemap(tcl8,const) char *SWIG_DEFAULT_TYPE
94{
95 static char *cvalue = $source;
96 Tcl_LinkVar(interp, SWIG_prefix SWIG_name "($target)",(char *) &cvalue, TCL_LINK_STRING | TCL_LINK_READ_ONLY);
97}
98
99%typemap(tcl8,const) Pointer *SWIG_DEFAULT_TYPE
100{
101 static char *pvalue;
102 pvalue = (char *) malloc(20+strlen("$mangle"));
103 SWIG_MakePtr(pvalue, (void *) ($source), "$mangle");
104 Tcl_LinkVar(interp, SWIG_prefix SWIG_name "($target)",(char *) &pvalue, TCL_LINK_STRING | TCL_LINK_READ_ONLY);
105}
106
107
108