[kepler-dev] Warnings while compiling matlab under 32bit windows

Jianwu Wang jianwu at sdsc.edu
Tue May 4 11:04:21 PDT 2010


Hi Christopher,

     Great!

     As you have known, the reason we choose MinGW is that the 
ptmatlab.dll generated in Cygwin has some problems when users run Kepler 
without Cygwin. It's probably because some libs needed to run the 
ptmatlab.dll are embedded in Cygwin.


Best wishes

Sincerely yours

Jianwu Wang
jianwu at sdsc.edu
http://users.sdsc.edu/~jianwu/

Scientific Workflow Automation Technologies (SWAT) Laboratory
San Diego Supercomputer Center
University of California, San Diego
San Diego, CA, U.S.A.


On 5/4/2010 10:40 AM, Christopher Brooks wrote:
> Hi Jianwu,
> Good news!
> Under Windows Server 2003 r2, I can run a Matlab demo from within
> Ptolemy (outside of Kepler) by copying the Kepler ptmatlab.dll.
>
> I checked both the Kepler devel trunk and the 2.0 branch and
> they are both fine.  To test, I did:
>
> cd $PTII
> cp 
> /cygdrive/c/tmp/cxh/src/kepler/common/lib/ptolemy/matlab/ptmatlab.dll 
> ptolemy/matlab/ptmatlab.dll
> java -classpath . ptolemy.vergil.VergilApplication -ptiny 
> ptolemy/matlab/demo/MatlabExpression/MatlabExpression.xml
>
> cp 
> /cygdrive/c/tmp/cxh/src/kepler-2.0/common-2.0/lib/ptolemy/matlab/ptmatlab.dll 
> ptolemy/matlab/
> java -classpath . ptolemy.vergil.VergilApplication -ptiny 
> ptolemy/matlab/demo/MatlabExpression/MatlabExpression.xml
>
> I did find one problem with ptolemy.data.expr under Windows, which I 
> fixed,
> checked into the Ptolemy II release branch and updated the Kepler 
> revision.txt files
> for the devel head and the 2.0 release branch.
>
> I'll look into the Ptolemy matlab build problem later today.  I think 
> we will need
> to require MinGW for the Cygwin installers and update configure and 
> some makefiles.
>
> _Christopher
>
>
>
> On 5/3/10 10:38 PM, Jianwu Wang wrote:
>> Hi Christopher,
>>
>> Dan used MinGW to compile the ptmatlab.cc. I'm not sure whether he 
>> got the same warnings. At least, I didn't get warning message when I 
>> used MinGW-64 (http://sourceforge.net/projects/mingw-w64/) to
>> compile it under 64 bit windows 7 using the following commands
>>
>> "gcc" -DPT_NO_ENGGETARRAY -DPT_NO_ENGPUTARRAY -DPT_NO_MXGETNAME 
>> "-Ic:/Program Files/MATLAB/R2010a/extern/include" "-IC:/Program 
>> Files/Java/jdk1.6.0_20/jre/../include" "-IC:/Program
>> Files/Java/jdk1.6.0_20/jre/../include/win32" -shared ptmatlab.cc 
>> -fno-exceptions -o ptmatlab.dll -L"c:/Program 
>> Files/MATLAB/R2010a/bin/win64" -Wl,--add-stdcall-alias -leng -lmx -lmex
>>
>> Can you run the demo workflow from Kepler?
>>
>> P.S. Dan is in vacation right now and will be back on Thursday.
>>
>> Best wishes
>>
>> Sincerely yours
>>
>> Jianwu Wang
>> jianwu at sdsc.edu
>> http://users.sdsc.edu/~jianwu/
>>
>> Scientific Workflow Automation Technologies (SWAT) Laboratory
>> San Diego Supercomputer Center
>> University of California, San Diego
>> San Diego, CA, U.S.A.
>>
>>
>> On 5/3/2010 9:54 PM, Christopher Brooks wrote:
>>> Hi Daniel,
>>> I get warnings when I compile ptmatlab.cc under 32 bit windows.
>>> Also, I'm having problems running the Matlab interface under Ptolemy 
>>> under
>>> 32 bit Windows. When I run 
>>> $PTII/ptolemy/matlab/demo/MatlabExpression/MatlabExpression.xml
>>> from Eclipse, I get to preinitialize and the the process hangs.
>>>
>>> A similar setup from January, 2009 works ok. I'm not sure where the 
>>> problem
>>> is yet.
>>>
>>> Below are the warnings. I think we need to use ifdefs here instead of
>>> casting everything to jlong.
>>>
>>> _Christopher
>>>
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabEngOpen(JNIEn
>>>> v*, _jobject*, _jstring*)':
>>>> ptmatlab.cc:136: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jint 
>>>> Java_ptolemy_matlab_Engine_ptmatlabEngClose(JNIEn
>>>> v*, _jobject*, jlong, jlong)':
>>>> ptmatlab.cc:151: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc:152: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jint 
>>>> Java_ptolemy_matlab_Engine_ptmatlabEngEvalString(
>>>> JNIEnv*, _jobject*, jlong, _jstring*)':
>>>> ptmatlab.cc:181: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabEngGetArray(J
>>>> NIEnv*, _jobject*, jlong, _jstring*)':
>>>> ptmatlab.cc:194: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc:207: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jint 
>>>> Java_ptolemy_matlab_Engine_ptmatlabEngPutArray(JN
>>>> IEnv*, _jobject*, jlong, _jstring*, jlong)':
>>>> ptmatlab.cc:218: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc:220: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabEngOutputBuff
>>>> er(JNIEnv*, _jobject*, jlong, jint)':
>>>> ptmatlab.cc:241: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc:252: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateCellMat
>>>> rix(JNIEnv*, _jobject*, _jstring*, jint, jint)':
>>>> ptmatlab.cc:270: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateString(
>>>> JNIEnv*, _jobject*, _jstring*, _jstring*, jint, jint)':
>>>> ptmatlab.cc:300: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateDoubleM
>>>> atrixOneDim(JNIEnv*, _jobject*, _jstring*, _jdoubleArray*, jint)':
>>>> ptmatlab.cc:322: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateDoubleM
>>>> atrix(JNIEnv*, _jobject*, _jstring*, _jobjectArray*, jint, jint)':
>>>> ptmatlab.cc:354: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateComplex
>>>> MatrixOneDim(JNIEnv*, _jobject*, _jstring*, _jobjectArray*, jint)':
>>>> ptmatlab.cc:387: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateComplex
>>>> cxh at newton ~/ptII/ptolemy/matlabing*, _jobjectArray*, jint, jint)':
>>>> $ matlab.cc:425: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateStructM
>>>> atrix(JNIEnv*, _jobject*, _jstring*, _jobjectArray*, jint, jint)':
>>>> ptmatlab.cc:458: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `void 
>>>> Java_ptolemy_matlab_Engine_ptmatlabDestroy(JNIEnv
>>>> *, _jobject*, jlong, _jstring*)':
>>>> ptmatlab.cc:468: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetCell(JNIEn
>>>> v*, _jobject*, jlong, jint, jint)':
>>>> ptmatlab.cc:485: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc:493: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `_jstring* 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetClassN
>>>> ame(JNIEnv*, _jobject*, jlong)':
>>>> ptmatlab.cc:503: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `_jintArray* 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetDime
>>>> nsions(JNIEnv*, _jobject*, jlong)':
>>>> ptmatlab.cc:516: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `_jstring* 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetFieldN
>>>> ameByNumber(JNIEnv*, _jobject*, jlong, jint)':
>>>> ptmatlab.cc:538: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jlong 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetFieldByNum
>>>> ber(JNIEnv*, _jobject*, jlong, jint, jint, jint)':
>>>> ptmatlab.cc:553: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc:561: warning: cast from pointer to integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jint 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetNumberOfFie
>>>> lds(JNIEnv*, _jobject*, jlong)':
>>>> ptmatlab.cc:570: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `_jstring* 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetString
>>>> (JNIEnv*, _jobject*, jlong, jint)':
>>>> ptmatlab.cc:582: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `_jstring* 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetOutput
>>>> (JNIEnv*, _jobject*, jlong, jint)':
>>>> ptmatlab.cc:607: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `jboolean 
>>>> Java_ptolemy_matlab_Engine_ptmatlabIsComplex(
>>>> JNIEnv*, _jobject*, jlong)':
>>>> ptmatlab.cc:619: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `_jobjectArray* 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetD
>>>> oubleMatrix(JNIEnv*, _jobject*, jlong, jint, jint)':
>>>> ptmatlab.cc:636: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `_jobjectArray* 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetC
>>>> omplexMatrix(JNIEnv*, _jobject*, jlong, jint, jint)':
>>>> ptmatlab.cc:666: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `_jobjectArray* 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetL
>>>> ogicalMatrix(JNIEnv*, _jobject*, jlong, jint, jint)':
>>>> ptmatlab.cc:705: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `void 
>>>> Java_ptolemy_matlab_Engine_ptmatlabSetString(JNIE
>>>> nv*, _jobject*, _jstring*, jlong, jint, _jstring*, jint)':
>>>> ptmatlab.cc:739: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `void 
>>>> Java_ptolemy_matlab_Engine_ptmatlabSetStructField
>>>> (JNIEnv*, _jobject*, _jstring*, jlong, _jstring*, jint, jint, jlong)':
>>>> ptmatlab.cc:766: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc:767: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc: In function `void 
>>>> Java_ptolemy_matlab_Engine_ptmatlabSetCell(JNIEnv
>>>> *, _jobject*, _jstring*, jlong, jint, jint, jlong)':
>>>> ptmatlab.cc:793: warning: cast to pointer from integer of different 
>>>> size
>>>> ptmatlab.cc:794: warning: cast to pointer from integer of different 
>>>> size
>>>
>>>
>>>
>>> On 4/29/10 1:45 PM, Daniel Crawl wrote:
>>>> Author: crawl
>>>> Date: 2010-04-29 13:45:15 -0700 (Thu, 29 Apr 2010)
>>>> New Revision: 57729
>>>>
>>>> Modified:
>>>> branches/rel-8-0-beta-2/ptolemy/matlab/ptmatlab.cc
>>>> Log:
>>>> Bug fixes for 64 bit Mac and Windows: removing double casts and 
>>>> changing
>>>> all ptrlong to jlong.
>>>>
>>>>
>>>> Modified: branches/rel-8-0-beta-2/ptolemy/matlab/ptmatlab.cc
>>>> ===================================================================
>>>> --- branches/rel-8-0-beta-2/ptolemy/matlab/ptmatlab.cc 2010-04-29 
>>>> 20:13:17 UTC (rev 57728)
>>>> +++ branches/rel-8-0-beta-2/ptolemy/matlab/ptmatlab.cc 2010-04-29 
>>>> 20:45:15 UTC (rev 57729)
>>>> @@ -102,9 +102,6 @@
>>>> #define mxGetLogicals(ma) mxGetPr(ma)
>>>> #endif
>>>>
>>>> -// Declare an integer type that correctly casts a long
>>>> -typedef long ptrlong;
>>>> -
>>>> #include<stdio.h>
>>>> #include<stdlib.h>
>>>>
>>>> @@ -132,7 +129,7 @@
>>>> if (cmdString != NULL) cmd = jni->GetStringUTFChars(cmdString, 0);
>>>> Engine *ep = engOpen(cmd);
>>>> if (ep != NULL) {
>>>> - retval = (ptrlong)ep;
>>>> + retval = (jlong)ep;
>>>> }
>>>> else {
>>>> printf("ptmatlabEngOpen: %s failed!\n", cmd==NULL?"":cmd); 
>>>> fflush(stdout);
>>>> @@ -147,8 +144,8 @@
>>>> jlong e,
>>>> jlong p)
>>>> {
>>>> - Engine *ep = (Engine*)(ptrlong)e;
>>>> - char* output_buf = (char*)(int)p;
>>>> + Engine *ep = (Engine*)e;
>>>> + char* output_buf = (char*)p;
>>>> const char debug = ptmatlabGetDebug(jni,obj);
>>>> if (debug> 1) {
>>>> printf("ptmatlabEngClose: calling engClose(%d)\n", ep); 
>>>> fflush(stdout);
>>>> @@ -170,7 +167,7 @@
>>>> jlong e,
>>>> jstring evalStr)
>>>> {
>>>> - Engine *ep = (Engine*)(ptrlong)e;
>>>> + Engine *ep = (Engine*)e;
>>>> const char *str = jni->GetStringUTFChars(evalStr, 0);
>>>> int retval = engEvalString(ep, str);
>>>> jni->ReleaseStringUTFChars(evalStr, str);
>>>> @@ -183,7 +180,7 @@
>>>> jlong e,
>>>> jstring name)
>>>> {
>>>> - Engine *ep = (Engine*)(ptrlong) e;
>>>> + Engine *ep = (Engine*) e;
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> const char *str = jni->GetStringUTFChars(name, 0);
>>>> #ifdef PT_NO_ENGGETARRAY
>>>> @@ -196,7 +193,7 @@
>>>> printf("ptmatlabEngGetArray(%s) %d x %d\n", str, dimArray[0], 
>>>> dimArray[1]);
>>>> }
>>>> jni->ReleaseStringUTFChars(name, str);
>>>> - return (ptrlong) ma;
>>>> + return (jlong) ma;
>>>> }
>>>>
>>>> JNIEXPORT jint JNICALL Java_ptolemy_matlab_Engine_ptmatlabEngPutArray
>>>> @@ -207,9 +204,9 @@
>>>> jlong pma)
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> - Engine *ep = (Engine*)(ptrlong) e;
>>>> + Engine *ep = (Engine*) e;
>>>> const char *str = jni->GetStringUTFChars(name, 0);
>>>> - mxArray *ma = (mxArray*)(ptrlong)pma;
>>>> + mxArray *ma = (mxArray*)pma;
>>>> #ifdef PT_NO_ENGPUTARRAY
>>>> // Daniel Crawl says to use engPutVariable(), see
>>>> // 
>>>> http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/rn/f34-998197.html 
>>>>
>>>> @@ -230,7 +227,7 @@
>>>> jlong e,
>>>> jint n)
>>>> {
>>>> - Engine *ep = (Engine*)(ptrlong) e;
>>>> + Engine *ep = (Engine*) e;
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> char *p = (char*)calloc(n+1,sizeof(char));
>>>> if (p == NULL) {
>>>> @@ -241,7 +238,7 @@
>>>> printf("ptmatlabEngOutputBuffer: set, engine=%d, p=0x%x, n=%d\n", 
>>>> ep, p, n); fflush(stdout);
>>>> }
>>>> engOutputBuffer(ep, p, n);
>>>> - return (ptrlong)p;
>>>> + return (jlong)p;
>>>> }
>>>>
>>>> JNIEXPORT jlong JNICALL 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateCellMatrix
>>>> @@ -259,7 +256,7 @@
>>>> printf("ptmatlabCreateCellMatrix(%s) %d x %d\n", nstr, n, m);
>>>> jni->ReleaseStringUTFChars(name, nstr);
>>>> }
>>>> - return (ptrlong) ma;
>>>> + return (jlong) ma;
>>>> }
>>>>
>>>> JNIEXPORT jlong JNICALL 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateString
>>>> @@ -289,7 +286,7 @@
>>>> }
>>>> }
>>>> jni->ReleaseStringUTFChars(s, str);
>>>> - return (ptrlong) ma;
>>>> + return (jlong) ma;
>>>> }
>>>>
>>>> JNIEXPORT jlong JNICALL 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateDoubleMatrixOneDim
>>>> @@ -311,7 +308,7 @@
>>>> }
>>>>
>>>> jni->GetDoubleArrayRegion(a, 0, length, pr);
>>>> - return (ptrlong) ma;
>>>> + return (jlong) ma;
>>>> }
>>>>
>>>> JNIEXPORT jlong JNICALL 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateDoubleMatrix
>>>> @@ -343,7 +340,7 @@
>>>> jni->ReleasePrimitiveArrayCritical(row, rowelements, 0);
>>>> jni->DeleteLocalRef(row); // free references
>>>> }
>>>> - return (ptrlong) ma;
>>>> + return (jlong) ma;
>>>> }
>>>>
>>>> JNIEXPORT jlong JNICALL 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateComplexMatrixOneDim
>>>> @@ -376,7 +373,7 @@
>>>> *(pi+j) = jni->GetDoubleField(element, complexImagFieldID);
>>>> jni->DeleteLocalRef(element);
>>>> }
>>>> - return (ptrlong) ma;
>>>> + return (jlong) ma;
>>>> }
>>>>
>>>> JNIEXPORT jlong JNICALL 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateComplexMatrix
>>>> @@ -414,7 +411,7 @@
>>>> }
>>>> jni->DeleteLocalRef(jcolumn);
>>>> }
>>>> - return (ptrlong) ma;
>>>> + return (jlong) ma;
>>>> }
>>>>
>>>> JNIEXPORT jlong JNICALL 
>>>> Java_ptolemy_matlab_Engine_ptmatlabCreateStructMatrix
>>>> @@ -447,7 +444,7 @@
>>>> jni->ReleaseStringUTFChars((jstring)jni->GetObjectArrayElement(fieldNames,i),names[i]); 
>>>>
>>>> }
>>>> free(names);
>>>> - return (ptrlong) ma;
>>>> + return (jlong) ma;
>>>> }
>>>>
>>>> JNIEXPORT void JNICALL Java_ptolemy_matlab_Engine_ptmatlabDestroy
>>>> @@ -457,7 +454,7 @@
>>>> jstring name)
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> if (debug> 1) {
>>>> const char *str = jni->GetStringUTFChars(name, 0);
>>>> printf("ptmatlabDestroy(%s)\n", str); fflush(stdout);
>>>> @@ -474,7 +471,7 @@
>>>> jint m)
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> int subs[] = {n, m};
>>>> int index = mxCalcSingleSubscript(ma, 2, subs);
>>>> mxArray *fma = mxGetCell(ma, index);
>>>> @@ -482,7 +479,7 @@
>>>> const int *dimArray = mxGetDimensions(fma);
>>>> printf("ptmatlabGetCell(%s,%d,%d) %d x %d\n", mxGetName(ma), n, m, 
>>>> dimArray[0], dimArray[1]);
>>>> }
>>>> - return (ptrlong) fma;
>>>> + return (jlong) fma;
>>>> }
>>>>
>>>> JNIEXPORT jstring JNICALL 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetClassName
>>>> @@ -492,7 +489,7 @@
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>>
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> const char *classNameStr = mxGetClassName(ma);
>>>> if (debug> 1) printf("ptmatlabGetClassName(%s) = %s\n", 
>>>> mxGetName(ma), classNameStr);
>>>> return jni->NewStringUTF(classNameStr);
>>>> @@ -505,7 +502,7 @@
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>>
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> jint ndims = mxGetNumberOfDimensions(ma);
>>>> const int *dims = mxGetDimensions(ma);
>>>> // MSVC can't deal with variable length arrays
>>>> @@ -527,7 +524,7 @@
>>>> jint k)
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> const char* fieldNameStr = mxGetFieldNameByNumber(ma, k);
>>>> if (debug> 1) printf("ptmatlabGetFieldNameByNumber(%s,%d) = 
>>>> %s\n",mxGetName(ma), k, fieldNameStr);
>>>> return jni->NewStringUTF(fieldNameStr);
>>>> @@ -542,7 +539,7 @@
>>>> jint m)
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> int subs[] = {n, m};
>>>> int index = mxCalcSingleSubscript(ma, 2, subs);
>>>> mxArray *fma = mxGetFieldByNumber(ma, index, k);
>>>> @@ -550,7 +547,7 @@
>>>> const int *dimArray = mxGetDimensions(fma);
>>>> printf("ptmatlabGetFieldByNumber(%s,%d,%d,%d) %d x %d\n", 
>>>> mxGetName(ma), k, n, m, dimArray[0], dimArray[1]);
>>>> }
>>>> - return (ptrlong) fma;
>>>> + return (jlong) fma;
>>>> }
>>>>
>>>> JNIEXPORT jint JNICALL 
>>>> Java_ptolemy_matlab_Engine_ptmatlabGetNumberOfFields
>>>> @@ -559,7 +556,7 @@
>>>> jlong pma)
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> if (debug> 1) printf("ptmatlabGetNumberOfFields(%s) = 
>>>> %d\n",mxGetName(ma), mxGetNumberOfFields(ma));
>>>> return (jint) mxGetNumberOfFields(ma);
>>>> }
>>>> @@ -571,7 +568,7 @@
>>>> jint n)
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> const int *dims = mxGetDimensions(ma);
>>>> int strlen = dims[1];
>>>> int nrows = dims[0];
>>>> @@ -596,7 +593,7 @@
>>>> jint n)
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> - char *p = (char*)(ptrlong)jp;
>>>> + char *p = (char*)jp;
>>>> if (debug> 1) printf("ptmatlabGetOutput(%d) = %s\n", n, p);
>>>> jstring retval = jni->NewStringUTF(p);
>>>> return retval;
>>>> @@ -608,7 +605,7 @@
>>>> jobject obj,
>>>> jlong pma)
>>>> {
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>>
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> if (debug> 1) printf("ptmatlabIsComplex(%s) = %d\n",mxGetName(ma), 
>>>> mxIsComplex(ma));
>>>> @@ -625,7 +622,7 @@
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>>
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> jdouble *pr = (jdouble*) mxGetPr(ma); // Cast assumes jdouble is 
>>>> double
>>>>
>>>> if (debug> 1) printf("ptmatlabGetDoubleMatrix(%s) %d x 
>>>> %d\n",mxGetName(ma), n, m);
>>>> @@ -655,7 +652,7 @@
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>>
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> jdouble *pr = (jdouble*) mxGetPr(ma); // Cast assumes jdouble is 
>>>> double
>>>> jdouble *pi = (jdouble*) mxGetPi(ma);
>>>>
>>>> @@ -694,7 +691,7 @@
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>>
>>>> - mxArray *ma = (mxArray*)(ptrlong) pma;
>>>> + mxArray *ma = (mxArray*) pma;
>>>> mxLogical *pr = (mxLogical*) mxGetLogicals(ma);
>>>>
>>>> if (debug> 1) printf("ptmatlabGetLogicalMatrix(%s) %d x 
>>>> %d\n",mxGetName(ma), n, m);
>>>> @@ -728,7 +725,7 @@
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>> char *str = (char*) jni->GetStringUTFChars(s, 0);
>>>> - mxArray *ma = (mxArray *)(ptrlong)pma;
>>>> + mxArray *ma = (mxArray *)pma;
>>>> mxChar *d = (mxChar*)mxGetData(ma);
>>>> const int *dims = mxGetDimensions(ma);
>>>> int nrows = dims[0];
>>>> @@ -755,8 +752,8 @@
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>>
>>>> - mxArray *structMa = (mxArray *)(ptrlong) sma;
>>>> - mxArray *fieldMa = (mxArray *)(ptrlong) fma;
>>>> + mxArray *structMa = (mxArray *) sma;
>>>> + mxArray *fieldMa = (mxArray *) fma;
>>>> int subs[] = {n, m};
>>>> int index = mxCalcSingleSubscript(structMa, 2, subs);
>>>> const char *str = jni->GetStringUTFChars(fieldName, 0);
>>>> @@ -782,8 +779,8 @@
>>>> {
>>>> char debug = ptmatlabGetDebug(jni,obj);
>>>>
>>>> - mxArray *cellArray = (mxArray *)(ptrlong)sma;
>>>> - mxArray *cell = (mxArray *)(ptrlong)fma;
>>>> + mxArray *cellArray = (mxArray *)sma;
>>>> + mxArray *cell = (mxArray *)fma;
>>>> int subs[] = {n, m};
>>>> int index = mxCalcSingleSubscript(cellArray, 2, subs);
>>>> mxSetCell(cellArray, index, cell);
>>>>
>>>> _______________________________________________
>>>> Ptexternal-cvs mailing list
>>>> Ptexternal-cvs at chess.eecs.berkeley.edu
>>>> http://chess.eecs.berkeley.edu/ptexternal/listinfo/ptexternal-cvs
>>>
>


More information about the Kepler-dev mailing list