Latest exception fixes for properties

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6950 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-02-15 22:02:22 +00:00
commit 97ed6ef9f3
5 changed files with 124 additions and 55 deletions

View file

@ -341,6 +341,7 @@ $1 = &temp; %}
// Macro used by the $excode special variable // Macro used by the $excode special variable
%define SWIGEXCODE "\n if ($modulePINVOKE.SWIGPendingException.Pending) throw $modulePINVOKE.SWIGPendingException.Retrieve();" %enddef %define SWIGEXCODE "\n if ($modulePINVOKE.SWIGPendingException.Pending) throw $modulePINVOKE.SWIGPendingException.Retrieve();" %enddef
%define SWIGEXCODE2 "\n if ($modulePINVOKE.SWIGPendingException.Pending) throw $modulePINVOKE.SWIGPendingException.Retrieve();" %enddef
%typemap(csout, excode=SWIGEXCODE) bool, const bool & { %typemap(csout, excode=SWIGEXCODE) bool, const bool & {
bool ret = $imcall;$excode bool ret = $imcall;$excode
@ -426,53 +427,112 @@ $1 = &temp; %}
/* Properties */ /* Properties */
%typemap(csvarin) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ %typemap(csvarin, excode=SWIGEXCODE2) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
set { set {
$imcall; $imcall;$excode
} %} } %}
%typemap(csvarin) char *, char[ANY], char[] %{ %typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
set { set {
$imcall; $imcall;$excode
} %}
%typemap(csvarout) bool, const bool &,
char, const char &,
signed char, const signed char &,
unsigned char, const unsigned char &,
short, const short &,
unsigned short, const unsigned short &,
int, const int &,
unsigned int, const unsigned int &,
long, const long &,
unsigned long, const unsigned long &,
long long, const long long &,
unsigned long long, const unsigned long long &,
float, const float &,
double, const double & %{
get {
return $imcall;
} %} } %}
%typemap(csvarout) char *, char[ANY], char[] %{ %typemap(csvarout, excode=SWIGEXCODE2) bool, const bool & %{
get { get {
return $imcall; bool ret = $imcall;$excode
return ret;
} %} } %}
%typemap(csvarout) void %{ %typemap(csvarout, excode=SWIGEXCODE2) char, const char & %{
get { get {
$imcall; char ret = $imcall;$excode
return ret;
} %} } %}
%typemap(csvarout) SWIGTYPE %{ %typemap(csvarout, excode=SWIGEXCODE2) signed char, const signed char & %{
get { get {
return new $&csclassname($imcall, true); sbyte ret = $imcall;$excode
return ret;
} %} } %}
%typemap(csvarout) SWIGTYPE & %{ %typemap(csvarout, excode=SWIGEXCODE2) unsigned char, const unsigned char & %{
get { get {
return new $csclassname($imcall, $owner); byte ret = $imcall;$excode
return ret;
} %} } %}
%typemap(csvarout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{ %typemap(csvarout, excode=SWIGEXCODE2) short, const short & %{
get {
short ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) unsigned short, const unsigned short & %{
get {
ushort ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) int, const int & %{
get {
int ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) unsigned int, const unsigned int & %{
get {
uint ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) long, const long & %{
get {
int ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) unsigned long, const unsigned long & %{
get {
uint ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) long long, const long long & %{
get {
long ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) unsigned long long, const unsigned long long & %{
get {
ulong ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) float, const float & %{
get {
float ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) double, const double & %{
get {
double ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
get {
string ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) void %{
get {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE %{
get {
$&csclassname ret = new $&csclassname($imcall, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE & %{
get {
$csclassname ret = new $csclassname($imcall, $owner);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
get { get {
IntPtr cPtr = $imcall; IntPtr cPtr = $imcall;
return (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner); $csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
return ret;
} %} } %}
/* Typemaps used for the generation of proxy and type wrapper class code */ /* Typemaps used for the generation of proxy and type wrapper class code */
@ -610,13 +670,14 @@ using System.Runtime.InteropServices;
string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
return ret; return ret;
} }
%typemap(csvarin) char *, char[ANY], char[] %{ %typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
set { set {
new $modulePINVOKE.SwigStringMarshal($imcall).ptr; new $modulePINVOKE.SwigStringMarshal($imcall).ptr;$excode
} %} } %}
%typemap(csvarout) char *, char[ANY], char[] %{ %typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
get { get {
return System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall); string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
return ret;
} %} } %}
*/ */

View file

@ -27,9 +27,10 @@
return ret; return ret;
} }
%typemap(csvarout) const enum SWIGTYPE & %{ %typemap(csvarout, excode=SWIGEXCODE2) const enum SWIGTYPE & %{
get { get {
return ($*csclassname)$imcall; $*csclassname ret = ($*csclassname)$imcall;$excode
return ret;
} %} } %}
@ -55,9 +56,10 @@
return ret; return ret;
} }
%typemap(csvarout) enum SWIGTYPE %{ %typemap(csvarout, excode=SWIGEXCODE2) enum SWIGTYPE %{
get { get {
return ($csclassname)$imcall; $csclassname ret = ($csclassname)$imcall;$excode
return ret;
} %} } %}
%typemap(csbase) enum SWIGTYPE "" %typemap(csbase) enum SWIGTYPE ""

View file

@ -29,9 +29,10 @@
return ret; return ret;
} }
%typemap(csvarout) const enum SWIGTYPE & %{ %typemap(csvarout, excode=SWIGEXCODE2) const enum SWIGTYPE & %{
get { get {
return $imcall; int ret = $imcall;$excode
return ret;
} %} } %}
@ -57,9 +58,10 @@
return ret; return ret;
} }
%typemap(csvarout) enum SWIGTYPE %{ %typemap(csvarout, excode=SWIGEXCODE2) enum SWIGTYPE %{
get { get {
return $imcall; int ret = $imcall;$excode
return ret;
} %} } %}
%typemap(csbase) enum SWIGTYPE "" %typemap(csbase) enum SWIGTYPE ""

View file

@ -28,9 +28,10 @@
return ret; return ret;
} }
%typemap(csvarout) const enum SWIGTYPE & %{ %typemap(csvarout, excode=SWIGEXCODE2) const enum SWIGTYPE & %{
get { get {
return $*csclassname.swigToEnum($imcall); $*csclassname ret = $*csclassname.swigToEnum($imcall);$excode
return ret;
} %} } %}
@ -56,9 +57,10 @@
return ret; return ret;
} }
%typemap(csvarout) enum SWIGTYPE %{ %typemap(csvarout, excode=SWIGEXCODE2) enum SWIGTYPE %{
get { get {
return $csclassname.swigToEnum($imcall); $csclassname ret = $csclassname.swigToEnum($imcall);$excode
return ret;
} %} } %}
%typemap(csbase) enum SWIGTYPE "" %typemap(csbase) enum SWIGTYPE ""

View file

@ -40,13 +40,14 @@ class string;
return ret; return ret;
} }
%typemap(csvarin) string %{ %typemap(csvarin, excode=SWIGEXCODE2) string %{
set { set {
$imcall; $imcall;$excode
} %} } %}
%typemap(csvarout) string %{ %typemap(csvarout, excode=SWIGEXCODE2) string %{
get { get {
return $imcall; string ret = $imcall;$excode
return ret;
} %} } %}
%typemap(typecheck) string = char *; %typemap(typecheck) string = char *;
@ -76,13 +77,14 @@ class string;
return ret; return ret;
} }
%typemap(csvarin) const string & %{ %typemap(csvarin, excode=SWIGEXCODE2) const string & %{
set { set {
$imcall; $imcall;$excode
} %} } %}
%typemap(csvarout) const string & %{ %typemap(csvarout, excode=SWIGEXCODE2) const string & %{
get { get {
return $imcall; string ret = $imcall;$excode
return ret;
} %} } %}
%typemap(typecheck) const string & = char *; %typemap(typecheck) const string & = char *;