fix for long long types and old Tcl versions

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7304 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-06-17 23:15:51 +00:00
commit a3c5c637b8
2 changed files with 18 additions and 6 deletions

View file

@ -5,6 +5,7 @@
*/
#include <tcl.h>
#include <errno.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>

View file

@ -492,12 +492,23 @@
}
%typecheck(SWIG_TYPECHECK_INTEGER)
long long, unsigned long long,
const long long &, const unsigned long long &
{
Tcl_WideInt tmp;
if (Tcl_GetWideIntFromObj(NULL,$input,&tmp) == TCL_ERROR) $1 = 0;
else $1 = 1;
long long, const long long &
{
int len;
char *end = 0;
char *str = Tcl_GetStringFromObj($input, &len);
strtoll(str, &end, 0);
$1 = (end != 0) && (*end != '\0') && (str != end) && (errno == 0);
}
%typecheck(SWIG_TYPECHECK_INTEGER)
unsigned long long, const unsigned long long &
{
int len;
char *end = 0;
char *str = Tcl_GetStringFromObj($input, &len);
strtoull(str, &end, 0);
$1 = (end != 0) && (*end != '\0') && (str != end) && (errno == 0);
}
%typecheck(SWIG_TYPECHECK_DOUBLE)