Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Andrew Ross <andrewross@us...> - 2004-05-21 15:10:04
|
Update of /cvsroot/plplot/plplot/bindings/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7265/bindings/java Modified Files: plplotjavac.i Log Message: Add plvect and plsvect to the common API. Add java, python and tcl bindings and examples for plvect and plsvect. Modify example 22 and make C, C++, fortran, java, python and tcl versions consistent. C, C++, fortran and tcl versions of example 22 now produce identical results. There appear to be some rounding errors with java and python. Index: plplotjavac.i =================================================================== RCS file: /cvsroot/plplot/plplot/bindings/java/plplotjavac.i,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- plplotjavac.i 15 Feb 2004 22:13:28 -0000 1.10 +++ plplotjavac.i 21 May 2004 15:09:23 -0000 1.11 @@ -425,6 +425,24 @@ return $jnicall; } +/* with no trailing count */ +%typemap(in) PLFLT *Array { + jPLFLT *jxdata = (*jenv)->GetPLFLTArrayElements( jenv, $input, 0 ); + Alen = (*jenv)->GetArrayLength( jenv, $input ); + setup_array_1d_PLFLT( &$1, jxdata, Alen); + (*jenv)->ReleasePLFLTArrayElements( jenv, $input, jxdata, 0 ); +} +%typemap(freearg) PLFLT *Array { + free($1); +} +%typemap(jni) PLFLT *Array jPLFLTArray +%typemap(jtype) PLFLT *Array jPLFLTbracket +%typemap(jstype) PLFLT *Array jPLFLTbracket +%typemap(javain) PLFLT *Array "$javainput" +%typemap(javaout) PLFLT *Array { + return $jnicall; +} + /* check consistency with X dimension of previous */ %typemap(in) PLFLT* ArrayCkX { jPLFLT *jxdata = (*jenv)->GetPLFLTArrayElements( jenv, $input, 0 ); @@ -575,6 +593,55 @@ return $jnicall; } +/* 2D array with no trailing dimensions, set the X, Y size for later checking */ +%typemap(in) PLFLT **Matrix { + jPLFLT **adat; + jobject *ai; + int nx = (*jenv)->GetArrayLength( jenv, $input ); + int ny = -1; + int i, j; + ai = (jobject *) malloc( nx * sizeof(jobject) ); + adat = (jPLFLT **) malloc( nx * sizeof(jPLFLT *) ); + + for( i=0; i < nx; i++ ) + { + ai[i] = (*jenv)->GetObjectArrayElement( jenv, $input, i ); + adat[i] = (*jenv)->GetPLFLTArrayElements( jenv, ai[i], 0 ); + + if (ny == -1) + ny = (*jenv)->GetArrayLength( jenv, ai[i] ); + else if (ny != (*jenv)->GetArrayLength( jenv, ai[i] )) { + printf( "Misshapen a array.\n" ); + for( j=0; j <= i; j++ ) + (*jenv)->ReleasePLFLTArrayElements( jenv, ai[j], adat[j], 0 ); + free(adat); + free(ai); + return; + } + } + + Xlen = nx; + Ylen = ny; + setup_array_2d_PLFLT( &$1, adat, nx, ny ); + for( i=0; i < nx; i++ ) + (*jenv)->ReleasePLFLTArrayElements( jenv, ai[i], adat[i], 0 ); + + free(adat); + free(ai); + +} +%typemap(freearg) PLFLT **Matrix { + free($1[0]); + free($1); +} +%typemap(jni) PLFLT **Matrix "jobjectArray" +%typemap(jtype) PLFLT **Matrix jPLFLTbracket2 +%typemap(jstype) PLFLT **Matrix jPLFLTbracket2 +%typemap(javain) PLFLT **Matrix "$javainput" +%typemap(javaout) PLFLT **Matrix { + return $jnicall; +} + /* 2D array, check for consistency */ %typemap(in) PLFLT **MatrixCk { jPLFLT **adat; |