Commit 8c563245 authored by claes's avatar claes

GetObjectInfoFloatArray and IntArray added

parent 5edb94e2
/* /*
* Proview $Id: jpwr_rt_gdh.c,v 1.14 2007-04-26 11:26:16 claes Exp $ * Proview $Id: jpwr_rt_gdh.c,v 1.15 2007-09-19 15:08:23 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -876,7 +876,7 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getParent ...@@ -876,7 +876,7 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getParent
"<init>", "(II)V"); "<init>", "(II)V");
PwrtObjid_getOix = (*env)->GetMethodID( env, PwrtObjid_id, "getOix", "()I"); PwrtObjid_getOix = (*env)->GetMethodID( env, PwrtObjid_id, "getOix", "()I");
PwrtObjid_getVid = (*env)->GetMethodID( env, PwrtObjid_id, "getVid", "()I"); PwrtObjid_getVid = (*env)->GetMethodID( env, PwrtObjid_id, "getVid", "()I");
//printf("PwrtObjid_xxx initierade\n"); //printf("PwrtObjid_yyy initierade\n");
} }
objid.oix = (*env)->CallIntMethod( env, objid_obj, PwrtObjid_getOix); objid.oix = (*env)->CallIntMethod( env, objid_obj, PwrtObjid_getOix);
...@@ -1019,7 +1019,7 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectClass ...@@ -1019,7 +1019,7 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectClass
"<init>", "(II)V"); "<init>", "(II)V");
pwrtObjid_getOix = (*env)->GetMethodID( env, pwrtObjid_id, "getOix", "()I"); pwrtObjid_getOix = (*env)->GetMethodID( env, pwrtObjid_id, "getOix", "()I");
pwrtObjid_getVid = (*env)->GetMethodID( env, pwrtObjid_id, "getVid", "()I"); pwrtObjid_getVid = (*env)->GetMethodID( env, pwrtObjid_id, "getVid", "()I");
//printf("pwrtObjid_xxx initierade\n"); //printf("pwrtObjid_yyy initierade\n");
} }
objid.oix = (*env)->CallIntMethod( env, objid_obj, pwrtObjid_getOix); objid.oix = (*env)->CallIntMethod( env, objid_obj, pwrtObjid_getOix);
...@@ -1239,6 +1239,46 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoFloat ...@@ -1239,6 +1239,46 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoFloat
return return_obj; return return_obj;
} }
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoFloatArray
(JNIEnv *env, jclass obj, jstring name, jint size)
{
int sts;
const char *str;
char *cstr;
jclass cdhrFloatArray_id;
jmethodID cdhrFloatArray_cid;
jobject return_obj;
jint jsts;
jfloatArray jvalue = 0;
pwr_tFloat32 *value;
char *s;
cdhrFloatArray_id = (*env)->FindClass( env, "jpwr/rt/CdhrFloatArray");
cdhrFloatArray_cid = (*env)->GetMethodID( env, cdhrFloatArray_id,
"<init>", "([FI)V");
str = (*env)->GetStringUTFChars( env, name, 0);
cstr = (char *)str;
gdh_ConvertUTFstring( cstr, cstr);
if ( (s = (char *)strchr( cstr, '#')))
*s = 0;
value = (pwr_tFloat32 *)calloc( size, sizeof(pwr_tFloat32));
sts = gdh_GetObjectInfo( cstr, value, size * 4);
(*env)->ReleaseStringUTFChars( env, name, cstr);
jsts = (jint) sts;
if ( ODD(sts)) {
jvalue = (*env)->NewFloatArray( env, size);
(*env)->SetFloatArrayRegion( env, jvalue, 0, (int)size, value);
}
free( value);
return_obj = (*env)->NewObject( env, cdhrFloatArray_id,
cdhrFloatArray_cid, jvalue, jsts);
return return_obj;
}
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoInt JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoInt
(JNIEnv *env, jclass obj, jstring name) (JNIEnv *env, jclass obj, jstring name)
{ {
...@@ -1272,6 +1312,46 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoInt ...@@ -1272,6 +1312,46 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoInt
return return_obj; return return_obj;
} }
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoIntArray
(JNIEnv *env, jclass obj, jstring name, jint size)
{
int sts;
const char *str;
char *cstr;
jclass cdhrIntArray_id;
jmethodID cdhrIntArray_cid;
jobject return_obj;
jint jsts;
jintArray jvalue = 0;
pwr_tInt32 *value;
char *s;
cdhrIntArray_id = (*env)->FindClass( env, "jpwr/rt/CdhrIntArray");
cdhrIntArray_cid = (*env)->GetMethodID( env, cdhrIntArray_id,
"<init>", "([FI)V");
str = (*env)->GetStringUTFChars( env, name, 0);
cstr = (char *)str;
gdh_ConvertUTFstring( cstr, cstr);
if ( (s = (char *)strchr( cstr, '#')))
*s = 0;
value = (pwr_tInt32 *)calloc( size, sizeof(pwr_tInt32));
sts = gdh_GetObjectInfo( cstr, value, size * 4);
(*env)->ReleaseStringUTFChars( env, name, cstr);
jsts = (jint) sts;
if ( ODD(sts)) {
jvalue = (*env)->NewIntArray( env, size);
(*env)->SetIntArrayRegion( env, jvalue, 0, (int)size, value);
}
free( value);
return_obj = (*env)->NewObject( env, cdhrIntArray_id,
cdhrIntArray_cid, jvalue, jsts);
return return_obj;
}
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoString JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoString
(JNIEnv *env, jclass obj, jstring name) (JNIEnv *env, jclass obj, jstring name)
{ {
......
...@@ -7,11 +7,6 @@ ...@@ -7,11 +7,6 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Inaccessible static: initDone */
/* Inaccessible static: currentSystemGroup */
/* Inaccessible static: currentUser */
/* Inaccessible static: currentPassword */
/* Inaccessible static: currentPrivilege */
/* /*
* Class: jpwr_rt_Gdh * Class: jpwr_rt_Gdh
* Method: init * Method: init
...@@ -92,6 +87,22 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoString ...@@ -92,6 +87,22 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoString
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoObjid JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoObjid
(JNIEnv *, jobject, jstring); (JNIEnv *, jobject, jstring);
/*
* Class: jpwr_rt_Gdh
* Method: getObjectInfoFloatArray
* Signature: (Ljava/lang/String;)Ljpwr/rt/CdhrFloatArray;
*/
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoFloatArray
(JNIEnv *, jobject, jstring, jint);
/*
* Class: jpwr_rt_Gdh
* Method: getObjectInfoIntArray
* Signature: (Ljava/lang/String;)Ljpwr/rt/CdhrIntArray;
*/
JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getObjectInfoIntArray
(JNIEnv *, jobject, jstring, jint);
/* /*
* Class: jpwr_rt_Gdh * Class: jpwr_rt_Gdh
* Method: toggleObjectInfo * Method: toggleObjectInfo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment