const enum SWIGTYPE & typemaps added

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6783 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2004-11-28 19:16:24 +00:00
commit b8d5ea651d
11 changed files with 239 additions and 28 deletions

View file

@ -3,6 +3,35 @@
* Note that the PINVOKE layer handles the enum as an int.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(cstype) const enum SWIGTYPE & "$*csclassname"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %}
%typecheck(SWIG_TYPECHECK_POINTER) const enum SWIGTYPE & ""
%typemap(throws) const enum SWIGTYPE & %{
(void)$1;
SWIG_CSharpThrowException(SWIG_CSharpException, "C++ $1_type exception thrown");
%}
%typemap(csin) const enum SWIGTYPE & "(int)$csinput"
%typemap(csout) const enum SWIGTYPE & {
return ($*csclassname)$imcall;
}
%typemap(csvarout) const enum SWIGTYPE & %{
get {
return ($*csclassname)$imcall;
} %}
// enum SWIGTYPE typemaps
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "$csclassname"
@ -10,7 +39,7 @@
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
%typecheck(SWIG_TYPECHECK_INT32) enum SWIGTYPE ""
%typecheck(SWIG_TYPECHECK_POINTER) enum SWIGTYPE ""
%typemap(throws) enum SWIGTYPE %{
(void)$1;

View file

@ -5,6 +5,35 @@
* in the C# proxy class.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(cstype) const enum SWIGTYPE & "int"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %}
%typecheck(SWIG_TYPECHECK_INT32) const enum SWIGTYPE & ""
%typemap(throws) const enum SWIGTYPE & %{
(void)$1;
SWIG_CSharpThrowException(SWIG_CSharpException, "C++ $1_type exception thrown");
%}
%typemap(csin) const enum SWIGTYPE & "$csinput"
%typemap(csout) const enum SWIGTYPE & {
return $imcall;
}
%typemap(csvarout) const enum SWIGTYPE & %{
get {
return $imcall;
} %}
// enum SWIGTYPE typemaps
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "int"

View file

@ -4,6 +4,35 @@
* enum and each enum item is a static instance of this class.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(cstype) const enum SWIGTYPE & "$*csclassname"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %}
%typecheck(SWIG_TYPECHECK_POINTER) const enum SWIGTYPE & ""
%typemap(throws) const enum SWIGTYPE & %{
(void)$1;
SWIG_CSharpThrowException(SWIG_CSharpException, "C++ $1_type exception thrown");
%}
%typemap(csin) const enum SWIGTYPE & "$csinput.swigValue"
%typemap(csout) const enum SWIGTYPE & {
return $*csclassname.swigToEnum($imcall);
}
%typemap(csvarout) const enum SWIGTYPE & %{
get {
return $*csclassname.swigToEnum($imcall);
} %}
// enum SWIGTYPE typemaps
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "$csclassname"
@ -11,7 +40,7 @@
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
%typecheck(SWIG_TYPECHECK_INT32) enum SWIGTYPE ""
%typecheck(SWIG_TYPECHECK_POINTER) enum SWIGTYPE ""
%typemap(throws) enum SWIGTYPE %{
(void)$1;

View file

@ -5,6 +5,34 @@
* specify a value for the enum item, as native Java enums do not support this.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(jni) const enum SWIGTYPE & "jint"
%typemap(jtype) const enum SWIGTYPE & "int"
%typemap(jstype) const enum SWIGTYPE & "$*javaclassname"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = (jint)*$1; %}
%typemap(directorin, descriptor="L$packagepath/$*javaclassname;") const enum SWIGTYPE & "$input = (jint)$1_name;"
%typemap(javadirectorin) const enum SWIGTYPE & "$*javaclassname.swigToEnum($jniinput)"
%typemap(javadirectorout) const enum SWIGTYPE & "($javacall).swigValue()"
%typecheck(SWIG_TYPECHECK_POINTER) const enum SWIGTYPE & ""
%typemap(throws) const enum SWIGTYPE & %{
(void)$1;
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown");
%}
%typemap(javain) const enum SWIGTYPE & "$javainput.swigValue()"
%typemap(javaout) const enum SWIGTYPE & {
return $*javaclassname.swigToEnum($jnicall);
}
// enum SWIGTYPE typemaps
%typemap(jni) enum SWIGTYPE "jint"
%typemap(jtype) enum SWIGTYPE "int"
%typemap(jstype) enum SWIGTYPE "$javaclassname"
@ -12,11 +40,11 @@
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = (jint)$1; %}
%typemap(directorin, descriptor="L$packagepath/$javaclassname") enum SWIGTYPE "$input = (jint) $1;"
%typemap(directorin, descriptor="L$packagepath/$javaclassname;") enum SWIGTYPE "$input = (jint) $1;"
%typemap(javadirectorin) enum SWIGTYPE "$javaclassname.swigToEnum($jniinput)"
%typemap(javadirectorout) enum SWIGTYPE "($javacall).swigValue()"
%typecheck(SWIG_TYPECHECK_INT32) enum SWIGTYPE ""
%typecheck(SWIG_TYPECHECK_POINTER) enum SWIGTYPE ""
%typemap(throws) enum SWIGTYPE %{
(void)$1;

View file

@ -5,6 +5,34 @@
* constant integers in the Java proxy class.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(jni) const enum SWIGTYPE & "jint"
%typemap(jtype) const enum SWIGTYPE & "int"
%typemap(jstype) const enum SWIGTYPE & "int"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = (jint)*$1; %}
%typemap(directorin, descriptor="I") const enum SWIGTYPE & "$input = (jint)$1_name;"
%typemap(javadirectorin) const enum SWIGTYPE & "$jniinput"
%typemap(javadirectorout) const enum SWIGTYPE & "$javacall"
%typecheck(SWIG_TYPECHECK_INT32) const enum SWIGTYPE & ""
%typemap(throws) const enum SWIGTYPE & %{
(void)$1;
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown");
%}
%typemap(javain) const enum SWIGTYPE & "$javainput"
%typemap(javaout) const enum SWIGTYPE & {
return $jnicall;
}
// enum SWIGTYPE typemaps
%typemap(jni) enum SWIGTYPE "jint"
%typemap(jtype) enum SWIGTYPE "int"
%typemap(jstype) enum SWIGTYPE "int"

View file

@ -4,6 +4,33 @@
* enum and each enum item is a static instance of this class.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(jni) const enum SWIGTYPE & "jint"
%typemap(jtype) const enum SWIGTYPE & "int"
%typemap(jstype) const enum SWIGTYPE & "$*javaclassname"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = (jint)*$1; %}
%typemap(directorin, descriptor="L$packagepath/$*javaclassname;") const enum SWIGTYPE & "$input = (jint)$1_name;"
%typemap(javadirectorin) const enum SWIGTYPE & "$*javaclassname.swigToEnum($jniinput)"
%typemap(javadirectorout) const enum SWIGTYPE & "($javacall).swigValue()"
%typecheck(SWIG_TYPECHECK_POINTER) const enum SWIGTYPE & ""
%typemap(throws) const enum SWIGTYPE & %{
(void)$1;
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown");
%}
%typemap(javain) const enum SWIGTYPE & "$javainput.swigValue()"
%typemap(javaout) const enum SWIGTYPE & {
return $*javaclassname.swigToEnum($jnicall);
}
// enum SWIGTYPE typemaps
%typemap(jni) enum SWIGTYPE "jint"
%typemap(jtype) enum SWIGTYPE "int"
%typemap(jstype) enum SWIGTYPE "$javaclassname"

View file

@ -5,6 +5,34 @@
* typesafe as they are all integers.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(jni) const enum SWIGTYPE & "jint"
%typemap(jtype) const enum SWIGTYPE & "int"
%typemap(jstype) const enum SWIGTYPE & "int"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = (jint)*$1; %}
%typemap(directorin, descriptor="I") const enum SWIGTYPE & "$input = (jint)$1_name;"
%typemap(javadirectorin) const enum SWIGTYPE & "$jniinput"
%typemap(javadirectorout) const enum SWIGTYPE & "$javacall"
%typecheck(SWIG_TYPECHECK_INT32) const enum SWIGTYPE & ""
%typemap(throws) const enum SWIGTYPE & %{
(void)$1;
SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown");
%}
%typemap(javain) const enum SWIGTYPE & "$javainput"
%typemap(javaout) const enum SWIGTYPE & {
return $jnicall;
}
// enum SWIGTYPE typemaps
%typemap(jni) enum SWIGTYPE "jint"
%typemap(jtype) enum SWIGTYPE "int"
%typemap(jstype) enum SWIGTYPE "int"

View file

@ -69,7 +69,8 @@
const short & (short temp),
const long & (long temp),
const signed char & (signed char temp),
const bool & (bool temp)
const bool & (bool temp),
const enum SWIGTYPE & ($*1_ltype temp)
"temp = ($*1_ltype) SvIV($input);
$1 = &temp;";
@ -98,7 +99,6 @@
$1 = &temp;
}
/* Typemap for output values */
%typemap(out) int, short, long, signed char, bool, enum SWIGTYPE
@ -191,7 +191,8 @@
const short &,
const long &,
const signed char &,
const bool &
const bool &,
const enum SWIGTYPE &
"ST(argvi) = sv_newmortal();
sv_setiv(ST(argvi++), (IV) *($1));";
@ -303,7 +304,8 @@
const short & (short temp),
const long & (long temp),
const signed char & (signed char temp),
const bool & (bool temp)
const bool & (bool temp),
const enum SWIGTYPE & ($*1_ltype temp)
"temp = ($*1_ltype) SvIV($input);
$1 = &temp;";
@ -473,14 +475,14 @@
* ------------------------------------------------------------ */
%typecheck(SWIG_TYPECHECK_INTEGER)
int, short, long,
unsigned int, unsigned short, unsigned long,
signed char, unsigned char,
long long, unsigned long long,
const int &, const short &, const long &,
int, short, long,
unsigned int, unsigned short, unsigned long,
signed char, unsigned char,
long long, unsigned long long,
const int &, const short &, const long &,
const unsigned int &, const unsigned short &, const unsigned long &,
const long long &, const unsigned long long &,
enum SWIGTYPE,
enum SWIGTYPE, const enum SWIGTYPE &,
bool, const bool &
{
$1 = SvIOK($input) ? 1 : 0;

View file

@ -79,7 +79,8 @@ extern "C" {
const unsigned char & (unsigned char temp),
const bool & (bool temp),
const long long & ($*1_ltype temp),
const unsigned long long & ($*1_ltype temp)
const unsigned long long & ($*1_ltype temp),
const enum SWIGTYPE & ($*1_ltype temp)
{
if ($input.type != T_INT)
Pike_error("Bad argument: Expected an integer.\n");
@ -151,7 +152,8 @@ extern "C" {
const long &, const unsigned long &,
const char &, const signed char &, const unsigned char &,
const bool &,
const long long &, const unsigned long long &
const long long &, const unsigned long long &,
const enum SWIGTYPE & ($*1_ltype temp)
"push_int(*($1));";
%typemap(out, pikedesc="tFloat") const float &, const double & "push_float(*($1));";
@ -214,7 +216,7 @@ extern "C" {
const int &, const short &, const long &,
const unsigned int &, const unsigned short &, const unsigned long &,
const long long &, const unsigned long long &,
enum SWIGTYPE,
enum SWIGTYPE, enum SWIGTYPE &,
bool, const bool &
{
$1 = ($input.type == T_INT) ? 1 : 0;

View file

@ -5,11 +5,18 @@
/* --- Input typemaps --- */
%typemap(in) enum SWIGTYPE "$1 = ($1_ltype) NUM2INT($input);";
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
"temp = ($*1_ltype) NUM2INT($input);
$1 = &temp;";
%typemap(directorout) enum SWIGTYPE "$result = NUM2INT($input);";
/* --- Output typemaps --- */
%typemap(out) enum SWIGTYPE "$result = INT2NUM($1);";
%typemap(out) const enum SWIGTYPE & "$result = INT2NUM((long) *($1));";
%typemap(directorin) enum SWIGTYPE "$input = INT2NUM($1);";
/* --- Variable Input --- */
@ -39,7 +46,7 @@ static void SWIG_AsVal(VALUE obj, int *val)
* Typechecking rules
* ------------------------------------------------------------ */
%typecheck(SWIG_TYPECHECK_INTEGER) enum SWIGTYPE
%typecheck(SWIG_TYPECHECK_INTEGER) enum SWIGTYPE, const enum SWIGTYPE &
{
$1 = ((TYPE($input) == T_FIXNUM) || (TYPE($input) == T_BIGNUM)) ? 1 : 0;
}

View file

@ -80,14 +80,15 @@
/* Constant references. Passed by value */
/* Const primitive references. Passed by value */
%typemap(in) const int & ($basetype temp),
const short & ($basetype temp),
const long & ($basetype temp),
const unsigned int & ($basetype temp),
const unsigned short & ($basetype temp),
const unsigned long & ($basetype temp),
const signed char & ($basetype temp),
const unsigned char & ($basetype temp)
%typemap(in) const int & ($*1_ltype temp),
const short & ($*1_ltype temp),
const long & ($*1_ltype temp),
const unsigned int & ($*1_ltype temp),
const unsigned short & ($*1_ltype temp),
const unsigned long & ($*1_ltype temp),
const signed char & ($*1_ltype temp),
const unsigned char & ($*1_ltype temp),
const enum SWIGTYPE & ($*1_ltype temp)
{
long ltemp;
if (Tcl_GetLongFromObj(interp, $input, &ltemp) != TCL_OK) {
@ -229,7 +230,8 @@
const short &, const unsigned short &,
const long &, const unsigned long &,
const signed char &, const unsigned char &,
const bool &
const bool &,
const enum SWIGTYPE &
"Tcl_SetObjResult(interp,Tcl_NewIntObj((long) *($1)));";
%typemap(out) const float &, const double &
@ -484,7 +486,7 @@
const int &, const short &, const long &,
const unsigned int &, const unsigned short &, const unsigned long &,
const long long &, const unsigned long long &,
enum SWIGTYPE,
enum SWIGTYPE, const enum SWIGTYPE &,
bool, const bool &
{
long tmp;