From: Matthias K. <mk...@us...> - 2006-02-19 19:29:21
|
Update of /cvsroot/swig/SWIG/Lib/guile In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3028/Lib/guile Modified Files: typemaps.i guile_gh_run.swg guile_gh.swg ghinterface.i Log Message: [MzScheme] Typemaps for all integral types now accept the full range of integral values, and they signal an error when a value outside the valid range is passed. [Guile] Typemaps for all integral types now signal an error when a value outside the valid range is passed. Index: typemaps.i =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/guile/typemaps.i,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** typemaps.i 29 Jan 2006 20:36:57 -0000 1.34 --- typemaps.i 19 Feb 2006 19:28:42 -0000 1.35 *************** *** 264,272 **** SIMPLE_MAP(signed char, gh_scm2char, gh_char2scm, char); SIMPLE_MAP(int, gh_scm2int, gh_int2scm, integer); ! SIMPLE_MAP(short, gh_scm2int, gh_int2scm, integer); SIMPLE_MAP(long, gh_scm2long, gh_long2scm, integer); SIMPLE_MAP(ptrdiff_t, gh_scm2long, gh_long2scm, integer); ! SIMPLE_MAP(unsigned int, gh_scm2ulong, gh_ulong2scm, integer); ! SIMPLE_MAP(unsigned short, gh_scm2ulong, gh_ulong2scm, integer); SIMPLE_MAP(unsigned long, gh_scm2ulong, gh_ulong2scm, integer); SIMPLE_MAP(size_t, gh_scm2ulong, gh_ulong2scm, integer); --- 264,272 ---- SIMPLE_MAP(signed char, gh_scm2char, gh_char2scm, char); SIMPLE_MAP(int, gh_scm2int, gh_int2scm, integer); ! SIMPLE_MAP(short, gh_scm2short, gh_int2scm, integer); SIMPLE_MAP(long, gh_scm2long, gh_long2scm, integer); SIMPLE_MAP(ptrdiff_t, gh_scm2long, gh_long2scm, integer); ! SIMPLE_MAP(unsigned int, gh_scm2uint, gh_ulong2scm, integer); ! SIMPLE_MAP(unsigned short, gh_scm2ushort, gh_ulong2scm, integer); SIMPLE_MAP(unsigned long, gh_scm2ulong, gh_ulong2scm, integer); SIMPLE_MAP(size_t, gh_scm2ulong, gh_ulong2scm, integer); Index: guile_gh_run.swg =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/guile/guile_gh_run.swg,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** guile_gh_run.swg 29 Jan 2006 20:35:52 -0000 1.12 --- guile_gh_run.swg 19 Feb 2006 19:28:42 -0000 1.13 *************** *** 69,72 **** --- 69,95 ---- #endif + static long + SWIG_convert_integer(SCM o, + long lower_bound, long upper_bound, + const char *func_name, int argnum) + { + long value = gh_scm2long(o); + if (value < lower_bound || value > upper_bound) + scm_wrong_type_arg((char *) func_name, argnum, o); + return value; + } + + static unsigned long + SWIG_convert_unsigned_integer(SCM o, + unsigned long lower_bound, + unsigned long upper_bound, + const char *func_name, int argnum) + { + unsigned long value = gh_scm2ulong(o); + if (value < lower_bound || value > upper_bound) + scm_wrong_type_arg((char *) func_name, argnum, o); + return value; + } + static swig_type_info *SWIG_Guile_LookupType(swig_module_info *module, SCM s, int normal) { swig_module_info *iter; Index: ghinterface.i =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/guile/ghinterface.i,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ghinterface.i 18 Nov 2003 15:52:49 -0000 1.2 --- ghinterface.i 19 Feb 2006 19:28:42 -0000 1.3 *************** *** 20,25 **** #define gh_scm2int(a) scm_num2int(a, SCM_ARG1, FUNC_NAME) #define gh_scm2long(a) scm_num2long(a, SCM_ARG1, FUNC_NAME) #define gh_scm2newstr SWIG_Guile_scm2newstr ! #define gh_scm2ulong(a) scm_num2ulong(a, SCM_ARG1, FUNC_NAME) #define gh_ulong2scm scm_ulong2num #define gh_long2scm scm_long2num --- 20,28 ---- #define gh_scm2int(a) scm_num2int(a, SCM_ARG1, FUNC_NAME) #define gh_scm2long(a) scm_num2long(a, SCM_ARG1, FUNC_NAME) + #define gh_scm2short(a) scm_num2short(a, SCM_ARG1, FUNC_NAME) #define gh_scm2newstr SWIG_Guile_scm2newstr ! #define gh_scm2ulong(a) scm_num2ulong(a, SCM_ARG1, FUNC_NAME) ! #define gh_scm2ushort(a) scm_num2ushort(a, SCM_ARG1, FUNC_NAME) ! #define gh_scm2uint(a) scm_num2uint(a, SCM_ARG1, FUNC_NAME) #define gh_ulong2scm scm_ulong2num #define gh_long2scm scm_long2num Index: guile_gh.swg =================================================================== RCS file: /cvsroot/swig/SWIG/Lib/guile/guile_gh.swg,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** guile_gh.swg 26 Nov 2005 09:28:19 -0000 1.8 --- guile_gh.swg 19 Feb 2006 19:28:42 -0000 1.9 *************** *** 8,11 **** --- 8,28 ---- %runtime "swigrun.swg" %runtime "guile_gh_run.swg" + + #define SWIG_convert_short(o) \ + SWIG_convert_integer(o, - (1 << (8 * sizeof(short) - 1)), \ + (1 << (8 * sizeof(short) - 1)) - 1, \ + FUNC_NAME, $argnum) + #define SWIG_convert_unsigned_short(o) \ + SWIG_convert_unsigned_integer(o, 0, \ + (1 << (8 * sizeof(short))) - 1, \ + FUNC_NAME, $argnum) + #define SWIG_convert_unsigned_int(o) \ + SWIG_convert_unsigned_integer(o, 0, UINT_MAX, \ + FUNC_NAME, $argnum) + + #define gh_scm2short(a) SWIG_convert_short(a) + #define gh_scm2ushort(a) SWIG_convert_unsigned_short(a) + #define gh_scm2uint(a) SWIG_convert_unsigned_int(a) + %include <guile.i> |