diff options
author | Derrick <a11426@users.sourceforge.net> | 2011-02-14 20:11:58 +0000 |
---|---|---|
committer | Derrick <a11426@users.sourceforge.net> | 2011-02-14 20:11:58 +0000 |
commit | 5815f7ec289e067e765fb8e893a2f337d8b48303 (patch) | |
tree | ebe9e0534a089fe431cedc6fdbc1a53ac523d70c /Lib/go/go.swg | |
parent | 3e1af1f698d5d02d7905431bcb3549c0f7bc9aa7 (diff) | |
parent | 1fab53b2046b97702e1de4cfab06cb8fa8fc129d (diff) | |
download | swig-a11426-fortran.tar.gz |
update fortran branch. merge of 12160:12460a11426-fortran
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/a11426-fortran@12461 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib/go/go.swg')
-rw-r--r-- | Lib/go/go.swg | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/Lib/go/go.swg b/Lib/go/go.swg index 648e112e1..587d219be 100644 --- a/Lib/go/go.swg +++ b/Lib/go/go.swg @@ -157,8 +157,8 @@ const float &, const double & %{ - $result = ($1_ltype)_swig_allocate(sizeof($*1_ltype)); - *$result = *($1_ltype)$input; + $result = ($1_ltype)_swig_goallocate(sizeof($*1_ltype)); + *$result = *($1_ltype)&$input; %} /* The size_t type. */ @@ -192,7 +192,7 @@ %typemap(directorout) const size_t & %{ - $result = ($1_ltype)_swig_allocate(sizeof($*1_ltype)); + $result = ($1_ltype)_swig_goallocate(sizeof($*1_ltype)); *$result = *($1_ltype)$input; %} @@ -206,7 +206,7 @@ %typemap(out) SWIGTYPE (CLASS::*) %{ - $result = _swig_allocate(sizeof($1_ltype)); + $result = _swig_goallocate(sizeof($1_ltype)); *($&1_ltype)$result = $1; %} @@ -215,7 +215,7 @@ %typemap(directorout) SWIGTYPE (CLASS::*) %{ - $result = _swig_allocate(sizeof($1_ltype)); + $result = _swig_goallocate(sizeof($1_ltype)); *($&1_ltype)$result = $input; %} @@ -254,14 +254,6 @@ %typemap(out) SWIGTYPE *const& %{ *($1_ltype)&$result = *$1; %} -/* Function pointers are translated by the code in go.cxx into - _swig_fnptr. Member pointers are translated to _swig_memberptr. */ - -%insert(go_header) %{ -type _swig_fnptr *byte -type _swig_memberptr *byte -%} - /* References. */ /* Converting a C++ reference to Go has to be handled in the C++ @@ -341,6 +333,28 @@ type _swig_memberptr *byte unsigned char *, unsigned char *&, unsigned char[ANY], unsigned char[] %{ $result = ($1_ltype)$input.p; %} +/* String & length */ + +%typemap(gotype) (char *STRING, size_t LENGTH) "string" + +%typemap(in) (char *STRING, size_t LENGTH) +%{ + $1 = ($1_ltype)$input.p; + $2 = ($2_ltype)$input.n; +%} + +%typemap(out) (char *STRING, size_t LENGTH) +%{ $result = _swig_makegostring((char*)$1, (size_t)$2); %} + +%typemap(directorin) (char *STRING, size_t LENGTH) +%{ $input = _swig_makegostring((char*)$1_name, $2_name); %} + +%typemap(directorout) (char *STRING, size_t LENGTH) +%{ + $1 = ($1_ltype)$input.p; + $2 = ($2_ltype)$input.n; +%} + /* Enums. We can't do the right thing for enums in typemap(gotype) so we deliberately don't define them. The right thing would be to capitalize the name. This is instead done in go.cxx. */ @@ -508,6 +522,7 @@ type _swig_memberptr *byte SWIGTYPE [], SWIGTYPE (CLASS::*) "" + /* Go keywords. */ %include <gokw.swg> |