~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to bindings/java/plplotjavac.i

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
You should have received a copy of the GNU Library General Public License
17
17
along with the file PLplot; if not, write to the Free Software
18
 
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
19
19
*/
20
20
 
21
21
/*
30
30
   3) it works both with the single and double-precision versions of the
31
31
      PLplot library.
32
32
 
33
 
This is known to work with swig-1.3.17 on Linux.
 
33
This is known to work with swig-1.3.21.
34
34
 
35
35
*/
36
36
%module plplotjavac
46
46
typedef float PLFLT;
47
47
#endif
48
48
 
49
 
typedef int PLINT;
 
49
typedef long PLINT;
 
50
typedef unsigned int PLUNICODE;
 
51
typedef PLINT PLBOOL;
 
52
 
 
53
/* Simple (input) PLBOOL arguments */
 
54
/* Use macro style similar to INPUT_TYPEMAP defined in typemaps.i, but
 
55
 * actually follow what is done in java.swg for bool C type except 
 
56
 * change action of typemap(in) from "? true : false;" to "? 1 : 0;" to
 
57
 * be consistent with actual C type of PLBOOL which is PLINT.  If C type
 
58
 * of PLBOOL ever changed to bool, none of this would be necessary, but
 
59
 * such a change would demand using the c99 standard for PLplot which is
 
60
 * not widely implemented yet.
 
61
 */
 
62
%define PLBOOL_INPUT_TYPEMAP(TYPE, JNITYPE, JTYPE, JNIDESC)
 
63
%typemap(jni) TYPE "JNITYPE"
 
64
%typemap(jtype) TYPE "JTYPE"
 
65
%typemap(jstype) TYPE "JTYPE"
 
66
 
 
67
%typemap(in) TYPE
 
68
%{ $1 = $input ? 1 : 0; %}
 
69
 
 
70
%typemap(javadirectorin) TYPE "$jniinput"
 
71
%typemap(javadirectorout) TYPE "$javacall"
 
72
 
 
73
%typemap(directorin,descriptor=JNIDESC) TYPE
 
74
%{$input = (JNITYPE *) $1; %}
 
75
 
 
76
%typemap(javain) TYPE "$javainput"
 
77
%enddef
 
78
 
 
79
PLBOOL_INPUT_TYPEMAP(PLBOOL, jboolean, boolean, "Z");
 
80
 
 
81
/* This renamed macro copied exactly from OUTPUT_TYPEMAP macro
 
82
 * in typemaps.i which handles *OUTPUT types. */
 
83
 
 
84
%define PLBOOL_OUTPUT_TYPEMAP(TYPE, JNITYPE, JTYPE, JAVATYPE, JNIDESC, TYPECHECKTYPE)
 
85
%typemap(jni) TYPE *OUTPUT, TYPE &OUTPUT %{JNITYPE##Array%}
 
86
%typemap(jtype) TYPE *OUTPUT, TYPE &OUTPUT "JTYPE[]"
 
87
%typemap(jstype) TYPE *OUTPUT, TYPE &OUTPUT "JTYPE[]"
 
88
%typemap(javain) TYPE *OUTPUT, TYPE &OUTPUT "$javainput"
 
89
%typemap(javadirectorin) TYPE *OUTPUT, TYPE &OUTPUT "$jniinput"
 
90
%typemap(javadirectorout) TYPE *OUTPUT, TYPE &OUTPUT "$javacall"
 
91
 
 
92
%typemap(in) TYPE *OUTPUT($*1_ltype temp), TYPE &OUTPUT($*1_ltype temp)
 
93
{
 
94
  if (!$input) {
 
95
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null");
 
96
    return $null;
 
97
  }
 
98
  if (JCALL1(GetArrayLength, jenv, $input) == 0) {
 
99
    SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element");
 
100
    return $null;
 
101
  }
 
102
  $1 = &temp; 
 
103
}
 
104
 
 
105
%typemap(directorin,descriptor=JNIDESC) TYPE &OUTPUT
 
106
%{ *(($&1_ltype) $input = &$1; %}
 
107
 
 
108
%typemap(directorin,descriptor=JNIDESC) TYPE *OUTPUT
 
109
%{
 
110
#error "Need to provide OUT directorin typemap, TYPE array length is unknown"
 
111
%}
 
112
 
 
113
%typemap(freearg) TYPE *OUTPUT, TYPE &OUTPUT ""
 
114
 
 
115
%typemap(argout) TYPE *OUTPUT, TYPE &OUTPUT 
 
116
{
 
117
  JNITYPE jvalue = (JNITYPE)temp$argnum;
 
118
  JCALL4(Set##JAVATYPE##ArrayRegion, jenv, $input, 0, 1, &jvalue);
 
119
}
 
120
 
 
121
%typemap(typecheck) TYPE *INOUT = TYPECHECKTYPE;
 
122
%typemap(typecheck) TYPE &INOUT = TYPECHECKTYPE;
 
123
%enddef
 
124
 
 
125
/* Copy what is done for C bool type, only use PLBOOL instead. */
 
126
PLBOOL_OUTPUT_TYPEMAP(PLBOOL, jboolean, boolean, Boolean, "[Ljava/lang/Boolean;", jbooleanArray);
50
127
 
51
128
/***************************
52
129
        A trick for docstrings
88
165
 * afterwards.  Thus, the must_free_buffers logic is gone as well.
89
166
 *---------------------------------------------------------------------------*/
90
167
 
 
168
/* 1d array of jbooleans */
 
169
 
 
170
static void
 
171
setup_array_1d_b( PLBOOL **pa, jboolean *adat, int n )
 
172
{
 
173
   int i;
 
174
   *pa = (PLBOOL *) malloc( n * sizeof(PLBOOL) );
 
175
   for( i=0; i < n; i++ ) {
 
176
      (*pa)[i] = adat[i] ? 1 : 0;
 
177
   }
 
178
}
 
179
 
91
180
/* 1d array of jints */
92
181
 
93
182
static void
196
285
**********************************************************************************/
197
286
 
198
287
/* with preceding count */
199
 
%typemap(in) (PLINT n, PLINT* Array) {
 
288
%typemap(in) (PLINT n, PLINT *Array) {
200
289
   jint *jxdata = (*jenv)->GetIntArrayElements( jenv, $input, 0 );
201
290
   $1 = (*jenv)->GetArrayLength( jenv, $input);
202
291
   Alen = $1;
206
295
    * the java array can be released immediately. */
207
296
   (*jenv)->ReleaseIntArrayElements( jenv, $input, jxdata, 0 );
208
297
}
209
 
%typemap(freearg) (PLINT n, PLINT* Array) {
 
298
%typemap(freearg) (PLINT n, PLINT *Array) {
210
299
   free($2);
211
300
}
212
 
%typemap(jni) (PLINT n, PLINT* Array) "jintArray"
213
 
%typemap(jtype) (PLINT n, PLINT* Array) "int[]"
214
 
%typemap(jstype) (PLINT n, PLINT* Array) "int[]"
215
 
%typemap(javain) (PLINT n, PLINT* Array) "$javainput"
216
 
%typemap(javaout) (PLINT n, PLINT* Array) {
217
 
   return $jnicall;
218
 
}
219
 
 
220
 
/* check consistency with previous */
221
 
%typemap(in) PLINT* ArrayCk {
222
 
   jint *jydata = (*jenv)->GetIntArrayElements( jenv, $input, 0 );
223
 
   if((*jenv)->GetArrayLength( jenv, $input ) != Alen) {
224
 
      printf("Vectors must be same length.\n");
225
 
      return;
226
 
   }
227
 
   setup_array_1d_i( &$1, jydata, Alen);
228
 
   (*jenv)->ReleaseIntArrayElements( jenv, $input, jydata, 0 );
229
 
}
230
 
%typemap(freearg) PLINT* ArrayCk {
231
 
   free($1);
232
 
}
233
 
%typemap(jni) PLINT* ArrayCk "jintArray"
234
 
%typemap(jtype) PLINT* ArrayCk "int[]"
235
 
%typemap(jstype) PLINT* ArrayCk "int[]"
236
 
%typemap(javain) PLINT* ArrayCk "$javainput"
237
 
%typemap(javaout) PLINT* ArrayCk {
 
301
%typemap(jni) (PLINT n, PLINT *Array) "jintArray"
 
302
%typemap(jtype) (PLINT n, PLINT *Array) "int[]"
 
303
%typemap(jstype) (PLINT n, PLINT *Array) "int[]"
 
304
%typemap(javain) (PLINT n, PLINT *Array) "$javainput"
 
305
%typemap(javaout) (PLINT n, PLINT *Array) {
 
306
   return $jnicall;
 
307
}
 
308
 
 
309
/* Trailing count and check consistency with previous*/
 
310
%typemap(in) (PLINT *ArrayCk, PLINT n) {
 
311
   jint *jydata = (*jenv)->GetIntArrayElements( jenv, $input, 0 );
 
312
   if((*jenv)->GetArrayLength( jenv, $input ) != Alen) {
 
313
      printf("Vectors must be same length.\n");
 
314
      return;
 
315
   }
 
316
   $2 = (*jenv)->GetArrayLength( jenv, $input );
 
317
   setup_array_1d_i( &$1, jydata, Alen);
 
318
   (*jenv)->ReleaseIntArrayElements( jenv, $input, jydata, 0 );
 
319
}
 
320
%typemap(freearg) (PLINT *ArrayCk, PLINT n) {
 
321
   free($1);
 
322
}
 
323
%typemap(jni) (PLINT *ArrayCk, PLINT n) "jintArray"
 
324
%typemap(jtype) (PLINT *ArrayCk, PLINT n) "int[]"
 
325
%typemap(jstype) (PLINT *ArrayCk, PLINT n) "int[]"
 
326
%typemap(javain) (PLINT *ArrayCk, PLINT n) "$javainput"
 
327
%typemap(javaout) (PLINT *ArrayCk, PLINT n) {
 
328
   return $jnicall;
 
329
}
 
330
 
 
331
/* no count but check consistency with previous */
 
332
%typemap(in) PLINT *ArrayCk {
 
333
   jint *jydata = (*jenv)->GetIntArrayElements( jenv, $input, 0 );
 
334
   if((*jenv)->GetArrayLength( jenv, $input ) != Alen) {
 
335
      printf("Vectors must be same length.\n");
 
336
      return;
 
337
   }
 
338
   setup_array_1d_i( &$1, jydata, Alen);
 
339
   (*jenv)->ReleaseIntArrayElements( jenv, $input, jydata, 0 );
 
340
}
 
341
%typemap(freearg) PLINT *ArrayCk {
 
342
   free($1);
 
343
}
 
344
%typemap(jni) PLINT *ArrayCk "jintArray"
 
345
%typemap(jtype) PLINT *ArrayCk "int[]"
 
346
%typemap(jstype) PLINT *ArrayCk "int[]"
 
347
%typemap(javain) PLINT *ArrayCk "$javainput"
 
348
%typemap(javaout) PLINT *ArrayCk {
238
349
   return $jnicall;
239
350
}
240
351
 
241
352
/* Weird case to allow argument to be one shorter than others */
242
 
%typemap(in) PLINT* ArrayCkMinus1 {
 
353
/* This case is used both for PLBOOL and PLINT.  Define PLBOOL version
 
354
 * first.  (AWI thinks this may be necessary because of the above
 
355
 * typedef PLINT PLBOOL;)
 
356
 */
 
357
%typemap(in) PLBOOL *ArrayCkMinus1 {
 
358
   jboolean *jydata = (*jenv)->GetBooleanArrayElements( jenv, $input, 0 );
 
359
   if((*jenv)->GetArrayLength( jenv, $input ) < Alen-1) {
 
360
      printf("Vector must be at least length of others minus 1.\n");
 
361
      return;
 
362
   }
 
363
   setup_array_1d_b( &$1, jydata, Alen);
 
364
   (*jenv)->ReleaseBooleanArrayElements( jenv, $input, jydata, 0 );
 
365
}
 
366
%typemap(freearg) PLBOOL *ArrayCkMinus1 {
 
367
   free($1);
 
368
}
 
369
%typemap(jni) PLBOOL *ArrayCkMinus1 "jbooleanArray"
 
370
%typemap(jtype) PLBOOL *ArrayCkMinus1 "boolean[]"
 
371
%typemap(jstype) PLBOOL *ArrayCkMinus1 "boolean[]"
 
372
%typemap(javain) PLBOOL *ArrayCkMinus1 "$javainput"
 
373
%typemap(javaout) PLBOOL *ArrayCkMinus1 {
 
374
   return $jnicall;
 
375
}
 
376
 
 
377
%typemap(in) PLINT *ArrayCkMinus1 {
243
378
   jint *jydata = (*jenv)->GetIntArrayElements( jenv, $input, 0 );
244
379
   if((*jenv)->GetArrayLength( jenv, $input ) < Alen-1) {
245
380
      printf("Vector must be at least length of others minus 1.\n");
248
383
   setup_array_1d_i( &$1, jydata, Alen);
249
384
   (*jenv)->ReleaseIntArrayElements( jenv, $input, jydata, 0 );
250
385
}
251
 
%typemap(freearg) PLINT* ArrayCkMinus1 {
 
386
%typemap(freearg) PLINT *ArrayCkMinus1 {
252
387
   free($1);
253
388
}
254
 
%typemap(jni) PLINT* ArrayCkMinus1 "jintArray"
255
 
%typemap(jtype) PLINT* ArrayCkMinus1 "int[]"
256
 
%typemap(jstype) PLINT* ArrayCkMinus1 "int[]"
257
 
%typemap(javain) PLINT* ArrayCkMinus1 "$javainput"
258
 
%typemap(javaout) PLINT* ArrayCkMinus1 {
 
389
%typemap(jni) PLINT *ArrayCkMinus1 "jintArray"
 
390
%typemap(jtype) PLINT *ArrayCkMinus1 "int[]"
 
391
%typemap(jstype) PLINT *ArrayCkMinus1 "int[]"
 
392
%typemap(javain) PLINT *ArrayCkMinus1 "$javainput"
 
393
%typemap(javaout) PLINT *ArrayCkMinus1 {
259
394
   return $jnicall;
260
395
}
261
396
 
277
412
   return $jnicall;
278
413
}
279
414
 
280
 
/* Trailing count */
281
 
%typemap(in) (PLINT *ArrayCk, PLINT n) {
282
 
   jint *jydata = (*jenv)->GetIntArrayElements( jenv, $input, 0 );
283
 
   if((*jenv)->GetArrayLength( jenv, $input ) != Alen) {
284
 
      printf("Vectors must be same length.\n");
285
 
      return;
286
 
   }
287
 
   setup_array_1d_i( &$1, jydata, Alen);
288
 
   (*jenv)->ReleaseIntArrayElements( jenv, $input, jydata, 0 );
289
 
}
290
 
%typemap(freearg) (PLINT *ArrayCk, PLINT n) {
291
 
   free($1);
292
 
}
293
 
%typemap(jni) (PLINT *ArrayCk, PLINT n) "jintArray"
294
 
%typemap(jtype) (PLINT *ArrayCk, PLINT n) "int[]"
295
 
%typemap(jstype) (PLINT *ArrayCk, PLINT n) "int[]"
296
 
%typemap(javain) (PLINT *ArrayCk, PLINT n) "$javainput"
297
 
%typemap(javaout) (PLINT *ArrayCk, PLINT n) {
298
 
   return $jnicall;
299
 
}
300
 
 
301
415
/******************************************************************************
302
416
                                 PLFLT Arrays
303
417
******************************************************************************/
330
444
/* temporary*/
331
445
#endif
332
446
/* with preceding count */
333
 
%typemap(in) (PLINT n, PLFLT* Array) {
 
447
%typemap(in) (PLINT n, PLFLT *Array) {
334
448
   jPLFLT *jxdata = (*jenv)->GetPLFLTArrayElements( jenv, $input, 0 );
335
449
   $1 = (*jenv)->GetArrayLength( jenv, $input);
336
450
   Alen = $1;
340
454
    * the java array can be released immediately. */
341
455
   (*jenv)->ReleasePLFLTArrayElements( jenv, $input, jxdata, 0 );
342
456
}
343
 
%typemap(freearg) (PLINT n, PLFLT* Array) {
 
457
%typemap(freearg) (PLINT n, PLFLT *Array) {
344
458
   free($2);
345
459
}
346
 
%typemap(jni) (PLINT n, PLFLT* Array) jPLFLTArray
347
 
%typemap(jtype) (PLINT n, PLFLT* Array) jPLFLTbracket
348
 
%typemap(jstype) (PLINT n, PLFLT* Array) jPLFLTbracket
349
 
%typemap(javain) (PLINT n, PLFLT* Array) "$javainput"
350
 
%typemap(javaout) (PLINT n, PLFLT* Array) {
351
 
   return $jnicall;
352
 
}
353
 
 
354
 
/* check consistency with previous */
355
 
%typemap(in) PLFLT* ArrayCk {
356
 
   jPLFLT *jydata = (*jenv)->GetPLFLTArrayElements( jenv, $input, 0 );
357
 
   if((*jenv)->GetArrayLength( jenv, $input ) != Alen) {
358
 
      printf("Vectors must be same length.\n");
359
 
      return;
360
 
   }
361
 
   setup_array_1d_PLFLT( &$1, jydata, Alen );
362
 
   (*jenv)->ReleasePLFLTArrayElements( jenv, $input, jydata, 0 );
363
 
}
364
 
%typemap(freearg) PLFLT* ArrayCk {
365
 
   free($1);
366
 
}
367
 
%typemap(jni) PLFLT* ArrayCk jPLFLTArray
368
 
%typemap(jtype) PLFLT* ArrayCk jPLFLTbracket
369
 
%typemap(jstype) PLFLT* ArrayCk jPLFLTbracket
370
 
%typemap(javain) PLFLT* ArrayCk "$javainput"
371
 
%typemap(javaout) PLFLT* ArrayCk{
 
460
%typemap(jni) (PLINT n, PLFLT *Array) jPLFLTArray
 
461
%typemap(jtype) (PLINT n, PLFLT *Array) jPLFLTbracket
 
462
%typemap(jstype) (PLINT n, PLFLT *Array) jPLFLTbracket
 
463
%typemap(javain) (PLINT n, PLFLT *Array) "$javainput"
 
464
%typemap(javaout) (PLINT n, PLFLT *Array) {
 
465
   return $jnicall;
 
466
}
 
467
 
 
468
/* trailing count, and check consistency with previous */
 
469
%typemap(in) (PLFLT *ArrayCk, PLINT n) {
 
470
   jPLFLT *jydata = (*jenv)->GetPLFLTArrayElements( jenv, $input, 0 );
 
471
   $2 = (*jenv)->GetArrayLength( jenv, $input );
 
472
   if((*jenv)->GetArrayLength( jenv, $input ) != Alen) {
 
473
      printf("Vectors must be same length.\n");
 
474
      return;
 
475
   }
 
476
   setup_array_1d_PLFLT( &$1, jydata, Alen );
 
477
   (*jenv)->ReleasePLFLTArrayElements( jenv, $input, jydata, 0 );
 
478
}
 
479
%typemap(freearg) (PLFLT *ArrayCk, PLINT n) {
 
480
   free($1);
 
481
}
 
482
%typemap(jni) (PLFLT *ArrayCk, PLINT n) jPLFLTArray
 
483
%typemap(jtype) (PLFLT *ArrayCk, PLINT n) jPLFLTbracket
 
484
%typemap(jstype) (PLFLT *ArrayCk, PLINT n) jPLFLTbracket
 
485
%typemap(javain) (PLFLT *ArrayCk, PLINT n) "$javainput"
 
486
%typemap(javaout) (PLFLT *ArrayCk, PLINT n){
 
487
   return $jnicall;
 
488
}
 
489
 
 
490
/* no count, but check consistency with previous */
 
491
%typemap(in) PLFLT *ArrayCk {
 
492
   jPLFLT *jydata = (*jenv)->GetPLFLTArrayElements( jenv, $input, 0 );
 
493
   if((*jenv)->GetArrayLength( jenv, $input ) != Alen) {
 
494
      printf("Vectors must be same length.\n");
 
495
      return;
 
496
   }
 
497
   setup_array_1d_PLFLT( &$1, jydata, Alen );
 
498
   (*jenv)->ReleasePLFLTArrayElements( jenv, $input, jydata, 0 );
 
499
}
 
500
%typemap(freearg) PLFLT *ArrayCk {
 
501
   free($1);
 
502
}
 
503
%typemap(jni) PLFLT *ArrayCk jPLFLTArray
 
504
%typemap(jtype) PLFLT *ArrayCk jPLFLTbracket
 
505
%typemap(jstype) PLFLT *ArrayCk jPLFLTbracket
 
506
%typemap(javain) PLFLT *ArrayCk "$javainput"
 
507
%typemap(javaout) PLFLT *ArrayCk{
372
508
   return $jnicall;
373
509
}
374
510
 
445
581
}
446
582
 
447
583
/* check consistency with X dimension of previous */
448
 
%typemap(in) PLFLT* ArrayCkX {
 
584
%typemap(in) PLFLT *ArrayCkX {
449
585
   jPLFLT *jxdata = (*jenv)->GetPLFLTArrayElements( jenv, $input, 0 );
450
586
   if((*jenv)->GetArrayLength( jenv, $input ) != Xlen) {
451
587
      printf("Vectors must be same length.\n");
454
590
   setup_array_1d_PLFLT( &$1, jxdata, Xlen );
455
591
   (*jenv)->ReleasePLFLTArrayElements( jenv, $input, jxdata, 0 );
456
592
}
457
 
%typemap(freearg) PLFLT* ArrayCkX {
 
593
%typemap(freearg) PLFLT *ArrayCkX {
458
594
   free($1);
459
595
}
460
 
%typemap(jni) PLFLT* ArrayCkX jPLFLTArray
461
 
%typemap(jtype) PLFLT* ArrayCkX jPLFLTbracket
462
 
%typemap(jstype) PLFLT* ArrayCkX jPLFLTbracket
463
 
%typemap(javain) PLFLT* ArrayCkX "$javainput"
464
 
%typemap(javaout) PLFLT* ArrayCkX{
 
596
%typemap(jni) PLFLT *ArrayCkX jPLFLTArray
 
597
%typemap(jtype) PLFLT *ArrayCkX jPLFLTbracket
 
598
%typemap(jstype) PLFLT *ArrayCkX jPLFLTbracket
 
599
%typemap(javain) PLFLT *ArrayCkX "$javainput"
 
600
%typemap(javaout) PLFLT *ArrayCkX{
465
601
   return $jnicall;
466
602
}
467
603
 
468
604
/* check consistency with Y dimension of previous */
469
 
%typemap(in) PLFLT* ArrayCkY {
 
605
%typemap(in) PLFLT *ArrayCkY {
470
606
   jPLFLT *jydata = (*jenv)->GetPLFLTArrayElements( jenv, $input, 0 );
471
607
   if((*jenv)->GetArrayLength( jenv, $input ) != Ylen) {
472
608
      printf("Vectors must be same length.\n");
475
611
   setup_array_1d_PLFLT( &$1, jydata, Ylen );
476
612
   (*jenv)->ReleasePLFLTArrayElements( jenv, $input, jydata, 0 );
477
613
}
478
 
%typemap(freearg) PLFLT* ArrayCkY {
 
614
%typemap(freearg) PLFLT *ArrayCkY {
479
615
   free($1);
480
616
}
481
 
%typemap(jni) PLFLT* ArrayCkY jPLFLTArray
482
 
%typemap(jtype) PLFLT* ArrayCkY jPLFLTbracket
483
 
%typemap(jstype) PLFLT* ArrayCkY jPLFLTbracket
484
 
%typemap(javain) PLFLT* ArrayCkY "$javainput"
485
 
%typemap(javaout) PLFLT* ArrayCkY{
 
617
%typemap(jni) PLFLT *ArrayCkY jPLFLTArray
 
618
%typemap(jtype) PLFLT *ArrayCkY jPLFLTbracket
 
619
%typemap(jstype) PLFLT *ArrayCkY jPLFLTbracket
 
620
%typemap(javain) PLFLT *ArrayCkY "$javainput"
 
621
%typemap(javaout) PLFLT *ArrayCkY{
486
622
   return $jnicall;
487
623
}
488
624
 
872
1008
    /* Get the String from the StringBuffer */
873
1009
    jmethodID setLengthID;
874
1010
    jclass sbufClass = (*jenv)->GetObjectClass(jenv, $input);
875
 
    jmethodID toStringID = (*jenv)->GetMethodID(jenv, sbufClass, "toString", "()Ljava/lang/String;");
876
 
    jstring js = (jstring) (*jenv)->CallObjectMethod(jenv, $input, toStringID);
877
 
 
878
 
    /* Convert the String to a C string */
879
 
    const char *pCharStr = (*jenv)->GetStringUTFChars(jenv, js, 0);
880
 
 
881
1011
    /* Take a copy of the C string as the typemap is for a non const C string */
882
1012
    jmethodID capacityID = (*jenv)->GetMethodID(jenv, sbufClass, "capacity", "()I");
883
1013
    jint capacity = (*jenv)->CallIntMethod(jenv, $input, capacityID);
884
1014
    $1 = (char *) malloc(capacity+1);
885
 
    strcpy($1, pCharStr);
886
 
 
887
 
    /* Release the UTF string we obtained with GetStringUTFChars */
888
 
    (*jenv)->ReleaseStringUTFChars(jenv,  js, pCharStr);
889
1015
 
890
1016
    /* Zero the original StringBuffer, so we can replace it with the result */
891
1017
    setLengthID = (*jenv)->GetMethodID(jenv, sbufClass, "setLength", "(I)V");
917
1043
 
918
1044
/* Character arrays: */
919
1045
 
920
 
%typemap(jni) (PLINT *p_argc, char **argv) "jobjectArray"
921
 
%typemap(jtype) (PLINT *p_argc, char **argv) "String[]"
922
 
%typemap(jstype) (PLINT *p_argc, char **argv) "String[]"
923
 
%typemap(javain) (PLINT *p_argc, char **argv) "$javainput"
924
 
%typemap(javaout) (PLINT *p_argc, char **argv) {
 
1046
%typemap(jni) (int *p_argc, char **argv) "jobjectArray"
 
1047
%typemap(jtype) (int *p_argc, char **argv) "String[]"
 
1048
%typemap(jstype) (int *p_argc, char **argv) "String[]"
 
1049
%typemap(javain) (int *p_argc, char **argv) "$javainput"
 
1050
%typemap(javaout) (int *p_argc, char **argv) {
925
1051
   return $jnicall;
926
1052
}
927
 
%typemap(in) (PLINT *p_argc, char **argv) (jint size) {
 
1053
%typemap(in) (int *p_argc, char **argv) (jint size) {
928
1054
   int i = 0;
929
1055
   size = (*jenv)->GetArrayLength(jenv, $input);
930
1056
   $1 = &size;
932
1058
   /* make a copy of each string */
933
1059
   for (i = 0; i<size; i++) {
934
1060
      jstring j_string = (jstring)(*jenv)->GetObjectArrayElement(jenv, $input, i);
935
 
      const char * c_string = (*jenv)->GetStringUTFChars(jenv, j_string, 0);
 
1061
      const char * c_string = (char *) (*jenv)->GetStringUTFChars(jenv, j_string, 0);
936
1062
/* Commented out version straight from swig documentation, but I think
937
1063
 * it is wrong.
938
1064
 *    $2[i] = malloc(strlen((c_string)+1)*sizeof(const char *)); */
945
1071
}
946
1072
 
947
1073
/* This cleans up the memory we malloc'd before the function call */
948
 
%typemap(freearg) (PLINT *p_argc, char **argv) {
 
1074
%typemap(freearg) (int *p_argc, char **argv) {
949
1075
   int i;
950
1076
/* Commented out version straight from swig documentation, but I think
951
1077
 * it is wrong.