summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2004-11-28 19:16:24 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2004-11-28 19:16:24 +0000
commitb8d5ea651d15bf944e27fe5a02604bbf5760fb8d (patch)
treebdbadd36df8293e4f2c6900bc6ddb1b60bb364ef
parentb3b49159326aa49974166a0111182fcebb057f1d (diff)
downloadswig-b8d5ea651d15bf944e27fe5a02604bbf5760fb8d.tar.gz
const enum SWIGTYPE & typemaps added
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6783 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r--Lib/csharp/enums.swg31
-rw-r--r--Lib/csharp/enumsimple.swg29
-rw-r--r--Lib/csharp/enumtypesafe.swg31
-rw-r--r--Lib/java/enums.swg32
-rw-r--r--Lib/java/enumsimple.swg28
-rw-r--r--Lib/java/enumtypesafe.swg27
-rw-r--r--Lib/java/enumtypeunsafe.swg28
-rw-r--r--Lib/perl5/perl5.swg22
-rw-r--r--Lib/pike/pike.swg8
-rw-r--r--Lib/ruby/rubyenum.swg9
-rw-r--r--Lib/tcl/tcl8.swg22
11 files changed, 239 insertions, 28 deletions
diff --git a/Lib/csharp/enums.swg b/Lib/csharp/enums.swg
index 8cbcd920d..e63c74fcf 100644
--- a/Lib/csharp/enums.swg
+++ b/Lib/csharp/enums.swg
@@ -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;
diff --git a/Lib/csharp/enumsimple.swg b/Lib/csharp/enumsimple.swg
index d64de7de2..6c3839ea5 100644
--- a/Lib/csharp/enumsimple.swg
+++ b/Lib/csharp/enumsimple.swg
@@ -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"
diff --git a/Lib/csharp/enumtypesafe.swg b/Lib/csharp/enumtypesafe.swg
index 0f57aad9e..e0c72f73b 100644
--- a/Lib/csharp/enumtypesafe.swg
+++ b/Lib/csharp/enumtypesafe.swg
@@ -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;
diff --git a/Lib/java/enums.swg b/Lib/java/enums.swg
index 665e1aa14..4a390cf81 100644
--- a/Lib/java/enums.swg
+++ b/Lib/java/enums.swg
@@ -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;
diff --git a/Lib/java/enumsimple.swg b/Lib/java/enumsimple.swg
index ff88af3f1..6e15b2292 100644
--- a/Lib/java/enumsimple.swg
+++ b/Lib/java/enumsimple.swg
@@ -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"
diff --git a/Lib/java/enumtypesafe.swg b/Lib/java/enumtypesafe.swg
index 5f0821f87..19a151c32 100644
--- a/Lib/java/enumtypesafe.swg
+++ b/Lib/java/enumtypesafe.swg
@@ -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"
diff --git a/Lib/java/enumtypeunsafe.swg b/Lib/java/enumtypeunsafe.swg
index b224faa2e..fcc76714e 100644
--- a/Lib/java/enumtypeunsafe.swg
+++ b/Lib/java/enumtypeunsafe.swg
@@ -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"
diff --git a/Lib/perl5/perl5.swg b/Lib/perl5/perl5.swg
index 2a9077c83..24d6b1b59 100644
--- a/Lib/perl5/perl5.swg
+++ b/Lib/perl5/perl5.swg
@@ -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;
diff --git a/Lib/pike/pike.swg b/Lib/pike/pike.swg
index e3b71a695..282519368 100644
--- a/Lib/pike/pike.swg
+++ b/Lib/pike/pike.swg
@@ -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;
diff --git a/Lib/ruby/rubyenum.swg b/Lib/ruby/rubyenum.swg
index 0366ce15e..0aa371e15 100644
--- a/Lib/ruby/rubyenum.swg
+++ b/Lib/ruby/rubyenum.swg
@@ -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;
}
diff --git a/Lib/tcl/tcl8.swg b/Lib/tcl/tcl8.swg
index f921409dc..4b8c013e2 100644
--- a/Lib/tcl/tcl8.swg
+++ b/Lib/tcl/tcl8.swg
@@ -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;