cosmetic mods

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9098 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2006-05-13 23:17:45 +00:00
parent a87c35c3e1
commit 800605149b
4 changed files with 41 additions and 37 deletions

View File

@ -10,7 +10,7 @@
* To use non-const std::string references use the following %apply. Note
* that they are passed by value.
* %apply const std::string & {std::string &};
------------------------------------------------------------------------ */
* ----------------------------------------------------------------------------- */
%{
#include <string>

View File

@ -4,20 +4,21 @@
*
* typemaps.i
*
* SWIG Java typemap library
* Pointer and reference handling
* Pointer and reference handling typemap library
*
* These mappings provide support for input/output arguments and common
* uses for C/C++ pointers and C++ references.
* ----------------------------------------------------------------------------- */
// INPUT typemaps.
// These remap a C pointer or C++ reference to be an "INPUT" value which is passed by value
// instead of reference.
/*
The following methods can be applied to turn a pointer or reference into a simple
"input" value. That is, instead of passing a pointer or reference to an object,
INPUT typemaps
--------------
These typemaps remap a C pointer or C++ reference to be an "INPUT" value which is
passed by value instead of reference.
The following typemaps can be applied to turn a pointer or reference into a simple
input value. That is, instead of passing a pointer or reference to an object,
you would use a real value instead.
bool *INPUT, bool &INPUT
@ -71,6 +72,8 @@ There are no char *INPUT typemaps, however you can apply the signed char * typem
%typemap(in) TYPE *INPUT, TYPE &INPUT
%{ $1 = ($1_ltype)&$input; %}
%typemap(freearg) TYPE *INPUT, TYPE &INPUT ""
%typemap(directorout) TYPE *INPUT, TYPE &INPUT
%{ $1 = ($1_ltype)&$input; %}
@ -80,8 +83,6 @@ There are no char *INPUT typemaps, however you can apply the signed char * typem
%typemap(directorin,descriptor=JNIDESC) TYPE *INPUT
%{ *(($&1_ltype) $input) = (JNITYPE *) $1; %}
%typemap(freearg) TYPE *INPUT, TYPE &INPUT ""
%typemap(typecheck) TYPE *INPUT = TYPE;
%typemap(typecheck) TYPE &INPUT = TYPE;
%enddef
@ -134,7 +135,10 @@ INPUT_TYPEMAP(double, jdouble, double, "D");
// The output value is returned in this array passed in.
/*
The following methods can be applied to turn a pointer or reference into an "output"
OUTPUT typemaps
---------------
The following typemaps can be applied to turn a pointer or reference into an "output"
value. When calling a function, no input value would be given for
a parameter, but an output value would be returned. This works by a
Java array being passed as a parameter where a c pointer or reference is required.
@ -210,6 +214,14 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
$1 = &temp;
}
%typemap(freearg) TYPE *OUTPUT, TYPE &OUTPUT ""
%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT
{
JNITYPE jvalue = (JNITYPE)temp$argnum;
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &jvalue);
}
%typemap(directorout,warning="Need to provide TYPE *OUTPUT directorout typemap") TYPE *OUTPUT, TYPE &OUTPUT {
}
@ -220,14 +232,6 @@ There are no char *OUTPUT typemaps, however you can apply the signed char * type
{
}
%typemap(freearg) TYPE *OUTPUT, TYPE &OUTPUT ""
%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT
{
JNITYPE jvalue = (JNITYPE)temp$argnum;
JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &jvalue);
}
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
%typemap(typecheck) TYPE &INOUT = TYPECHECKTYPE;
%enddef
@ -269,14 +273,15 @@ OUTPUT_TYPEMAP(double, jdouble, double, Double, "[Ljava/lang/Double;", jdoubleAr
JCALL3(SetObjectArrayElement, jenv, $input, 0, bigint);
}
// INOUT
// Mappings for an argument that is both an input and output
// parameter
/*
The following methods can be applied to make a function parameter both
INOUT typemaps
--------------
Mappings for a parameter that is both an input and an output parameter
The following typemaps can be applied to make a function parameter both
an input and output value. This combines the behavior of both the
"INPUT" and "OUTPUT" methods described earlier. Output values are
"INPUT" and "OUTPUT" typemaps described earlier. Output values are
returned as an element in a Java array.
bool *INOUT, bool &INOUT
@ -348,6 +353,11 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
$1 = ($1_ltype) JCALL2(Get##JAVATYPE##ArrayElements, jenv, $input, 0);
}
%typemap(freearg) TYPE *INOUT, TYPE &INOUT ""
%typemap(argout) TYPE *INOUT, TYPE &INOUT
{ JCALL3(Release##JAVATYPE##ArrayElements, jenv, $input, (JNITYPE *)$1, 0); }
%typemap(directorout,warning="Need to provide TYPE *INOUT directorout typemap") TYPE *INOUT, TYPE &INOUT {
}
@ -359,11 +369,6 @@ There are no char *INOUT typemaps, however you can apply the signed char * typem
{
}
%typemap(freearg) TYPE *INOUT, TYPE &INOUT ""
%typemap(argout) TYPE *INOUT, TYPE &INOUT
{ JCALL3(Release##JAVATYPE##ArrayElements, jenv, $input, (JNITYPE *)$1, 0); }
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
%typemap(typecheck) TYPE &INOUT = TYPECHECKTYPE;
%enddef

View File

@ -9,13 +9,13 @@
char cvsroot_s_exp_cxx[] = "$Header$";
#include "swigmod.h"
#include "dohint.h"
static const char *usage = "\
S-Exp Options (available with -sexp)\n\
-typemaplang <lang> - Typemap language\n\n";
#include "swigmod.h"
#include "dohint.h"
//static Node *view_top = 0;
static File *out = 0;

View File

@ -9,6 +9,8 @@
char cvsroot_xml_cxx[] = "$Header$";
#include "swigmod.h"
static const char *usage = "\
XML Options (available with -xml)\n\
-xmllang <lang> - Typedef language\n\
@ -16,9 +18,6 @@ XML Options (available with -xml)\n\
------\n\
deprecated (use -o): -xml <output.xml> - Use <output.xml> as output file (extension .xml mandatory)\n";
#include "swigmod.h"
static File *out = 0;
static int xmllite = 0;