warning/error fixes for Visual Studio

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7543 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-09-28 20:58:41 +00:00
commit 219517adc0
6 changed files with 33 additions and 8 deletions

View file

@ -571,6 +571,7 @@ $1 = &temp; %}
}
%typemap(throws) SWIGTYPE {
(void)$1;
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown");
RETURN $null;
}

View file

@ -167,6 +167,7 @@
}
%typemap(throws) SWIGTYPE {
(void)$1;
SWIG_exception(0,"Thrown exception from C++ (unknown)");
}

View file

@ -12,9 +12,12 @@
/* Typemaps for input parameters */
%typemap(in) int, short, long, signed char, bool, enum SWIGTYPE
%typemap(in) int, short, long, signed char, enum SWIGTYPE
"$1 = ($1_ltype) SvIV($input);";
%typemap(in) bool
"$1 = SvIV($input) ? true : false;";
%typemap(in) unsigned int, unsigned short, unsigned long, unsigned char
"$1 = ($1_ltype) SvUV($input);";
@ -68,11 +71,14 @@
const short & (short temp),
const long & (long temp),
const signed char & (signed char temp),
const bool & (bool temp),
const enum SWIGTYPE & ($*1_ltype temp)
"temp = ($*1_ltype) SvIV($input);
$1 = &temp;";
%typemap(in) const bool & (bool temp)
"temp = SvIV($input) ? true : false;
$1 = &temp;";
%typemap(in) const unsigned int & (unsigned int temp),
const unsigned short & (unsigned short temp),
const unsigned long & (unsigned long temp),
@ -227,9 +233,12 @@
/* Variable input */
%typemap(varin) int, short, long, signed char, bool
%typemap(varin) int, short, long, signed char
"$1 = ($1_ltype) SvIV($input);";
%typemap(varin) bool
"$1 = SvIV($input) ? true : false;";
%typemap(varin) unsigned int, unsigned short, unsigned long, unsigned char
"$1 = ($1_ltype) SvUV($input);";
@ -305,11 +314,14 @@
const short & (short temp),
const long & (long temp),
const signed char & (signed char temp),
const bool & (bool temp),
const enum SWIGTYPE & ($*1_ltype temp)
"temp = ($*1_ltype) SvIV($input);
$1 = &temp;";
%typemap(varin) const bool & (bool temp)
"temp = SvIV($input) ? true : false;
$1 = &temp;";
%typemap(varin) const unsigned int & (unsigned int temp),
const unsigned short & (unsigned short temp),
const unsigned long & (unsigned long temp),
@ -555,10 +567,12 @@
}
%typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [ANY] %{
(void)$1;
SWIG_croak("C++ $1_type exception thrown");
%}
%typemap(throws) enum SWIGTYPE %{
(void)$1;
SWIG_croak("C++ $1_type exception thrown");
%}

View file

@ -266,7 +266,6 @@ namespace std {
"Expected an array of " #T);
SV **tv;
I32 len = av_len(av) + 1;
T* obj;
for (int i=0; i<len; i++) {
tv = av_fetch(av, i, 0);
if (CHECK_T(*tv)) {
@ -284,9 +283,9 @@ namespace std {
}
}
%typemap(out) vector<T> {
int len = $1.size();
size_t len = $1.size();
SV **svs = new SV*[len];
for (unsigned int i=0; i<len; i++) {
for (size_t i=0; i<len; i++) {
svs[i] = sv_newmortal();
FROM_T(svs[i], $1[i]);
}

View file

@ -79,8 +79,13 @@ INPUT_TYPEMAP(unsigned int, SvUV);
INPUT_TYPEMAP(unsigned long, SvUV);
INPUT_TYPEMAP(unsigned short, SvUV);
INPUT_TYPEMAP(unsigned char, SvUV);
INPUT_TYPEMAP(bool, SvIV);
%typemap(in) bool *INPUT(bool temp), bool &INPUT(bool temp) {
temp = SvIV($input) ? true : false;
$1 = &temp;
}
%typemap(typecheck) bool *INPUT = bool;
%typemap(typecheck) bool &INPUT = bool;
%typemap(in) long long *INPUT($*1_ltype temp), long long &INPUT($*1_ltype temp) {
temp = strtoll(SvPV($input,PL_na), 0, 0);

View file

@ -1916,6 +1916,11 @@ SwigType_emit_type_table(File *f_forward, File *f_table) {
Printf(table, " &_swigt_%s,\n", ki.item);
Printf(cast_init, " _swigc_%s,\n", ki.item);
}
if (i==0) {
/* empty arrays are not allowed by ISO C */
Printf(table, " NULL\n");
Printf(cast_init, " NULL\n");
}
Delete(table_list);