summaryrefslogtreecommitdiff
path: root/Lib/tcl
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2003-02-10 22:33:53 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2003-02-10 22:33:53 +0000
commitb8caeeae1b43c891561490f8b2acb00f61fb0c12 (patch)
treea4de5bc7ddce7dd9ff1f947326ee5ba5daa8b667 /Lib/tcl
parent4890710cde5f73ebbc4638bbe2e30ea414ee76e6 (diff)
downloadswig-b8caeeae1b43c891561490f8b2acb00f61fb0c12.tar.gz
bool mods for Visual C++
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4285 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/tcl')
-rw-r--r--Lib/tcl/tcl8.swg29
1 files changed, 24 insertions, 5 deletions
diff --git a/Lib/tcl/tcl8.swg b/Lib/tcl/tcl8.swg
index 06e73726a..6dff5cdc6 100644
--- a/Lib/tcl/tcl8.swg
+++ b/Lib/tcl/tcl8.swg
@@ -39,7 +39,7 @@
is no guarantee that a bool is the same size as an int so we have to do this */
%typemap(in) bool (int tempb) "if (Tcl_GetIntFromObj(interp,$input,&tempb) == TCL_ERROR) SWIG_fail;
- $1 = (bool) tempb;";
+ $1 = tempb ? true : false;";
/* These will pass an integer as an unsigned long. However, the implementation is crippled due
to limited precision in Tcl */
@@ -83,8 +83,7 @@
const unsigned short & (unsigned short temp),
const unsigned long & (unsigned long temp),
const signed char & (signed char temp),
- const unsigned char & (unsigned char temp),
- const bool & (bool temp)
+ const unsigned char & (unsigned char temp)
{
long ltemp;
if (Tcl_GetLongFromObj(interp, $input, &ltemp) != TCL_OK) {
@@ -94,6 +93,17 @@
$1 = &temp;
}
+%typemap(in) const bool & (bool temp)
+{
+ long ltemp;
+ if (Tcl_GetLongFromObj(interp, $input, &ltemp) != TCL_OK) {
+ SWIG_fail;
+ }
+ temp = ltemp ? true : false;
+ $1 = &temp;
+}
+
+
%typemap(in) const float & (float temp),
const double & (double temp)
{
@@ -270,7 +280,7 @@
/* -- Variable input --- */
-%typemap(varin) int, unsigned int, short, unsigned short, long, unsigned long, signed char, unsigned char, bool, enum SWIGTYPE
+%typemap(varin) int, unsigned int, short, unsigned short, long, unsigned long, signed char, unsigned char, enum SWIGTYPE
{
long temp;
if (Tcl_GetLongFromObj(interp, $input, &temp) != TCL_OK) {
@@ -279,6 +289,15 @@
$1 = ($1_type) temp;
}
+%typemap(varin) bool
+{
+ long temp;
+ if (Tcl_GetLongFromObj(interp, $input, &temp) != TCL_OK) {
+ return (char*) "Type error. expected an integer";
+ }
+ $1 = temp ? true : false;
+}
+
%typemap(varin) long long "$1 = (long long) strtoll(Tcl_GetStringFromObj($input,NULL),0,0);";
%typemap(varin) unsigned long long "$1 = (unsigned long long) strtoull(Tcl_GetStringFromObj($input,NULL),0,0);";
@@ -433,7 +452,7 @@
const unsigned int &, const unsigned short &, const unsigned long &,
const long long &, const unsigned long long &,
enum SWIGTYPE,
- bool, const bool &
+ bool, const bool &
{
long tmp;
if (Tcl_GetLongFromObj(NULL,$input,&tmp) == TCL_ERROR) $1 = 0;