File: glpk_java_structures.i

package info (click to toggle)
glpk-java 1.12.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,580 kB
  • sloc: sh: 3,609; java: 1,794; xml: 259; makefile: 154; ansic: 35
file content (24 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* File glpk_java_structures.i
 *
 * Handling of structures.
 *
 * If typedefs like
 *   typedef struct TYPE TYPE
 * are used in the C coding. SWIG maps pointers of type TYPE* to
 * SWIGTYPE_p_TYPE and not to Java class TYPE. This can be overcome by using
 * the macro %glp_structure(TYPE) in the Swig control file.
 */

%define %glp_structure(TYPE)
%typemap(jni) TYPE * "jlong"
%typemap(jtype) TYPE * "long"
%typemap(jstype) TYPE * "TYPE"
%typemap(in) TYPE %{ $1 = *($&1_ltype)&$input; %}
%typemap(out) TYPE *
%{ *($&1_ltype)&$result = $1; %}
%typemap(javain) TYPE * "TYPE.getCPtr($javainput)"
%typemap(javaout) TYPE * {
    long cPtr = $jnicall;
    return (cPtr == 0) ? null : new TYPE(cPtr, $owner);
  }
%enddef