bool mods for Visual C++
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4285 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
30a37433aa
commit
be2645fa50
1 changed files with 24 additions and 5 deletions
|
|
@ -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, <emp) != TCL_OK) {
|
||||
|
|
@ -94,6 +93,17 @@
|
|||
$1 = &temp;
|
||||
}
|
||||
|
||||
%typemap(in) const bool & (bool temp)
|
||||
{
|
||||
long ltemp;
|
||||
if (Tcl_GetLongFromObj(interp, $input, <emp) != 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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue