00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "common.h"
00022 #include "net_threebit_jvr_jvr.h"
00023
00024
00025 static JavaVM *vm;
00026
00027
00028 static int jvrDebugLevel = JVR_NONE;
00029
00030
00031
00032
00033
00034
00035
00036
00037 void jvr_throw (JNIEnv *e,const char* exceptionClass, const char* file, int line, const char* format, ...) {
00038
00039 int bufSize = 10*1024;
00040 size_t maxSize = (10*1024)-2;
00041 char message[bufSize];
00042 va_list vlist = NULL;
00043 int length = 0;
00044
00045
00046 va_start(vlist,format);
00047 length += vsnprintf(&message[0]+length,maxSize-length,format,vlist);
00048 length += snprintf(&message[0]+length,maxSize-length," (%s:%d)",file,line);
00049
00050
00051 jclass exception = e->FindClass(exceptionClass);
00052 if (exception == NULL) {
00053 e->ThrowNew(e->FindClass("java.lang.Error"), "jvr_throw error: failed to find exception class.");
00054 return;
00055 }
00056 e->ThrowNew(exception, message);
00057 }
00058
00059
00060
00061
00062 void jvr_log (JNIEnv *e, const char* file, int line, const char* format, ...) {
00063 int bufSize = 10*1024;
00064 size_t maxSize = (10*1024)-2;
00065 char message[bufSize];
00066 va_list vlist = NULL;
00067 int length = 0;
00068
00069
00070 va_start(vlist,format);
00071 length += vsnprintf(&message[0]+length,maxSize-length,format,vlist);
00072 length += snprintf(&message[0]+length,maxSize-length," (%s:%d)",file,line);
00073
00074 printf(message);
00075 printf("\n");
00076 fflush(stdout);
00077 }
00078
00079 #ifdef WIN32
00080
00081
00082
00083 long int jvr_eventHandler (unsigned long ehandle)
00084 {
00085 JNIEnv *e;
00086 JVR_ENTER;
00087 vm->AttachCurrentThread((void**)&e,&attachArgs);
00088 if (e->ExceptionOccurred()) {
00089 e->ExceptionDescribe();
00090 e->ExceptionClear();
00091 return -1;
00092 }
00093 e->CallStaticVoidMethod(jvr_class, jvr_handleEvent_win32, (jlong) ehandle);
00094 if (e->ExceptionOccurred()) {
00095 e->ExceptionDescribe();
00096 e->ExceptionClear();
00097 return -1;
00098 }
00099 vm->DetachCurrentThread();
00100 JVR_EXIT;
00101 return(1);
00102 }
00103 #endif
00104
00105 #ifdef LINUX
00106
00107
00108
00109 long jvr_eventHandler (void *p)
00110 {
00111 JNIEnv *e;
00112 vm->AttachCurrentThread((void**)&e,&attachArgs);
00113 jmethodID handleEventMethod = e->GetStaticMethodID(jvr_class, "handleEvent", "()V");
00114 e->CallStaticVoidMethod(jvrClass, handleEventMethod);
00115 vm->DetachCurrentThread();
00116 return(1);
00117 }
00118 #endif
00119
00120
00121
00122
00123 int jvr_convert_sctsinfo_j2n(JNIEnv *e, jobject jtsinfo, SC_TSINFO *tsinfo) {
00124 JVR_ENTER;
00125
00126
00127 if (jtsinfo == NULL) { jvr_throw(JVR_THROW_JVR,"jtsinfo argument cannot be null"); JVR_EXIT; return -1; }
00128 if (tsinfo == NULL) { jvr_throw(JVR_THROW_JVR,"tsinfo argument cannot be null"); JVR_EXIT; return -1; }
00129
00130 jclass clazz = sc_tsinfo_class;
00131 jfieldID field;
00132
00133
00134
00135
00136
00137 field = e->GetFieldID(clazz,"sc_numts","J");
00138 if (e->GetLongField(jtsinfo,field) > tsinfo->sc_numts) {
00139 jvr_throw(JVR_THROW_JVR,"Cannot store %d timeslots. Only have %d slots available",e->GetLongField(jtsinfo,field),tsinfo->sc_numts);
00140 JVR_EXIT; return -1;
00141 }
00142 tsinfo->sc_numts = e->GetLongField(jtsinfo,field);
00143
00144 field = e->GetFieldID(clazz,"sc_tsarray","[J");
00145 jlongArray longArray = (jlongArray) e->GetObjectField(jtsinfo,field);
00146 jlong *longBuf = e->GetLongArrayElements(longArray,NULL);
00147 for (int x = 0; x < tsinfo->sc_numts; x++) {
00148 tsinfo->sc_tsarrayp[0] = longBuf[x];
00149 }
00150 e->ReleaseLongArrayElements(longArray,longBuf,0);
00151
00152 JVR_EXIT; return 0;
00153 }
00154
00155
00156
00157
00158 int jvr_convert_sctsinfo_n2j (JNIEnv *e, jobject jtsinfo, SC_TSINFO *tsinfo) {
00159 JVR_ENTER;
00160
00161 if (tsinfo == NULL) {
00162 jvr_throw(JVR_THROW_JVR,"tsinfo argument cannot be null");
00163 JVR_EXIT; return -1;
00164 }
00165 if (jtsinfo == NULL) {
00166 jvr_throw(JVR_THROW_JVR,"jtsinfo argument cannot be null");
00167 JVR_EXIT; return -1;
00168 }
00169
00170 jclass clazz = sc_tsinfo_class;
00171 jmethodID init = e->GetMethodID(clazz, "<init>", "()V");
00172 jfieldID field;
00173
00174
00175 field = e->GetFieldID(clazz,"sc_numts","J");
00176 e->SetLongField(jtsinfo, field, tsinfo->sc_numts);
00177
00178
00179 jlongArray longArray = e->NewLongArray(tsinfo->sc_numts);
00180 jlong *longBuf = e->GetLongArrayElements(longArray,NULL);
00181 for (int x = 0; x < tsinfo->sc_numts; x++) {
00182 longBuf[x] = tsinfo->sc_tsarrayp[x];
00183 }
00184 e->ReleaseLongArrayElements(longArray,longBuf,0);
00185
00186
00187 field = e->GetFieldID(clazz,"sc_tsarray","[J");
00188 e->SetObjectField(jtsinfo,field,longArray);
00189
00190 JVR_EXIT; return 0;
00191 }
00192
00193
00194
00195
00196 int jvr_convert_dxcap_j2n (JNIEnv *e, jobject jdxcap, DX_CAP *dxcap) {
00197 JVR_ENTER;
00198
00199 if (jdxcap == NULL) { jvr_throw(JVR_THROW_JVR,"jdxcap argument cannot be null"); JVR_EXIT; return -1; }
00200 if (dxcap == NULL) { jvr_throw(JVR_THROW_JVR,"dxcap argument cannot be null"); JVR_EXIT; return -1; }
00201
00202 jclass clazz = dx_cap_class;
00203 jfieldID field = NULL;
00204
00205
00206 field = e->GetFieldID(clazz,"ca_pamd_qtemp","B");
00207 dxcap->ca_pamd_qtemp = e->GetByteField(jdxcap,field);
00208 field = e->GetFieldID(clazz,"ca_pamd_spdval","B");
00209 dxcap->ca_pamd_spdval = e->GetByteField(jdxcap,field);
00210
00211
00212 field = e->GetFieldID(clazz,"ca_alowmax","I");
00213 dxcap->ca_alowmax = e->GetIntField(jdxcap,field);
00214 field = e->GetFieldID(clazz,"ca_ansrdgl","I");
00215 dxcap->ca_ansrdgl = e->GetIntField(jdxcap,field);
00216 field = e->GetFieldID(clazz,"ca_blowmax","I");
00217 dxcap->ca_blowmax = e->GetIntField(jdxcap,field);
00218 field = e->GetFieldID(clazz,"ca_cnosig","I");
00219 dxcap->ca_cnosig = e->GetIntField(jdxcap,field);
00220 field = e->GetFieldID(clazz,"ca_cnosil","I");
00221 dxcap->ca_cnosil = e->GetIntField(jdxcap,field);
00222 field = e->GetFieldID(clazz,"ca_dtn_deboff","I");
00223 dxcap->ca_dtn_deboff = e->GetIntField(jdxcap,field);
00224 field = e->GetFieldID(clazz,"ca_dtn_npres","I");
00225 dxcap->ca_dtn_npres = e->GetIntField(jdxcap,field);
00226 field = e->GetFieldID(clazz,"ca_dtn_pres","I");
00227 dxcap->ca_dtn_pres = e->GetIntField(jdxcap,field);
00228 field = e->GetFieldID(clazz,"ca_hedge","I");
00229 dxcap->ca_hedge = e->GetIntField(jdxcap,field);
00230 field = e->GetFieldID(clazz,"ca_hi1bmax","I");
00231 dxcap->ca_hi1bmax = e->GetIntField(jdxcap,field);
00232 field = e->GetFieldID(clazz,"ca_hi1ceil","I");
00233 dxcap->ca_hi1ceil = e->GetIntField(jdxcap,field);
00234 field = e->GetFieldID(clazz,"ca_hi1tola","I");
00235 dxcap->ca_hi1tola = e->GetIntField(jdxcap,field);
00236 field = e->GetFieldID(clazz,"ca_hi1tolb","I");
00237 dxcap->ca_hi1tolb = e->GetIntField(jdxcap,field);
00238 field = e->GetFieldID(clazz,"ca_higltch","I");
00239 dxcap->ca_higltch = e->GetIntField(jdxcap,field);
00240 field = e->GetFieldID(clazz,"ca_hisiz","I");
00241 dxcap->ca_hisiz = e->GetIntField(jdxcap,field);
00242 field = e->GetFieldID(clazz,"ca_intflg","I");
00243 dxcap->ca_intflg = e->GetIntField(jdxcap,field);
00244 field = e->GetFieldID(clazz,"ca_intfltr","I");
00245 dxcap->ca_intfltr = e->GetIntField(jdxcap,field);
00246 field = e->GetFieldID(clazz,"ca_lcdly","I");
00247 dxcap->ca_lcdly = e->GetIntField(jdxcap,field);
00248 field = e->GetFieldID(clazz,"ca_lcdly1","I");
00249 dxcap->ca_lcdly1 = e->GetIntField(jdxcap,field);
00250 field = e->GetFieldID(clazz,"ca_lo1bmax","I");
00251 dxcap->ca_lo1bmax = e->GetIntField(jdxcap,field);
00252 field = e->GetFieldID(clazz,"ca_lo1ceil","I");
00253 dxcap->ca_lo1ceil = e->GetIntField(jdxcap,field);
00254 field = e->GetFieldID(clazz,"ca_lo1rmax","I");
00255 dxcap->ca_lo1rmax = e->GetIntField(jdxcap,field);
00256 field = e->GetFieldID(clazz,"ca_lo1tola","I");
00257 dxcap->ca_lo1tola = e->GetIntField(jdxcap,field);
00258 field = e->GetFieldID(clazz,"ca_lo1tolb","I");
00259 dxcap->ca_lo1tolb = e->GetIntField(jdxcap,field);
00260 field = e->GetFieldID(clazz,"ca_lo2bmax","I");
00261 dxcap->ca_lo2bmax = e->GetIntField(jdxcap,field);
00262 field = e->GetFieldID(clazz,"ca_lo2rmin","I");
00263 dxcap->ca_lo2rmin = e->GetIntField(jdxcap,field);
00264 field = e->GetFieldID(clazz,"ca_lo2tola","I");
00265 dxcap->ca_lo2tola = e->GetIntField(jdxcap,field);
00266 field = e->GetFieldID(clazz,"ca_lo2tolb","I");
00267 dxcap->ca_lo2tolb = e->GetIntField(jdxcap,field);
00268 field = e->GetFieldID(clazz,"ca_logltch","I");
00269 dxcap->ca_logltch = e->GetIntField(jdxcap,field);
00270 field = e->GetFieldID(clazz,"ca_lower2frq","I");
00271 dxcap->ca_lower2frq = e->GetIntField(jdxcap,field);
00272 field = e->GetFieldID(clazz,"ca_lower3frq","I");
00273 dxcap->ca_lower3frq = e->GetIntField(jdxcap,field);
00274 field = e->GetFieldID(clazz,"ca_lowerfrq","I");
00275 dxcap->ca_lowerfrq = e->GetIntField(jdxcap,field);
00276 field = e->GetFieldID(clazz,"ca_maxansr","I");
00277 dxcap->ca_maxansr = e->GetIntField(jdxcap,field);
00278 field = e->GetFieldID(clazz,"ca_maxintering","I");
00279 dxcap->ca_maxintering = e->GetIntField(jdxcap,field);
00280 field = e->GetFieldID(clazz,"ca_mxtime2frq","I");
00281 dxcap->ca_mxtime2frq = e->GetIntField(jdxcap,field);
00282 field = e->GetFieldID(clazz,"ca_mxtime3frq","I");
00283 dxcap->ca_mxtime3frq = e->GetIntField(jdxcap,field);
00284 field = e->GetFieldID(clazz,"ca_mxtimefrq","I");
00285 dxcap->ca_mxtimefrq = e->GetIntField(jdxcap,field);
00286 field = e->GetFieldID(clazz,"ca_nbrbeg","I");
00287 dxcap->ca_nbrbeg = e->GetIntField(jdxcap,field);
00288 field = e->GetFieldID(clazz,"ca_nbrdna","I");
00289 dxcap->ca_nbrdna = e->GetIntField(jdxcap,field);
00290 field = e->GetFieldID(clazz,"ca_noanswer","I");
00291 dxcap->ca_noanswer = e->GetIntField(jdxcap,field);
00292 field = e->GetFieldID(clazz,"ca_nsbusy","I");
00293 dxcap->ca_nsbusy = e->GetIntField(jdxcap,field);
00294 field = e->GetFieldID(clazz,"ca_pamd_failtime","I");
00295 dxcap->ca_pamd_failtime = e->GetIntField(jdxcap,field);
00296 field = e->GetFieldID(clazz,"ca_pamd_minring","I");
00297 dxcap->ca_pamd_minring = e->GetIntField(jdxcap,field);
00298 field = e->GetFieldID(clazz,"ca_rejctfrq","I");
00299 dxcap->ca_rejctfrq = e->GetIntField(jdxcap,field);
00300 field = e->GetFieldID(clazz,"ca_stdely","I");
00301 dxcap->ca_stdely = e->GetIntField(jdxcap,field);
00302 field = e->GetFieldID(clazz,"ca_time2frq","I");
00303 dxcap->ca_time2frq = e->GetIntField(jdxcap,field);
00304 field = e->GetFieldID(clazz,"ca_time3frq","I");
00305 dxcap->ca_time3frq = e->GetIntField(jdxcap,field);
00306 field = e->GetFieldID(clazz,"ca_timefrq","I");
00307 dxcap->ca_timefrq = e->GetIntField(jdxcap,field);
00308 field = e->GetFieldID(clazz,"ca_upper2frq","I");
00309 dxcap->ca_upper2frq = e->GetIntField(jdxcap,field);
00310 field = e->GetFieldID(clazz,"ca_upper3frq","I");
00311 dxcap->ca_upper3frq = e->GetIntField(jdxcap,field);
00312 field = e->GetFieldID(clazz,"ca_upperfrq","I");
00313 dxcap->ca_upperfrq = e->GetIntField(jdxcap,field);
00314 field = e->GetFieldID(clazz,"rfu1","I");
00315 dxcap->rfu1 = e->GetIntField(jdxcap,field);
00316 field = e->GetFieldID(clazz,"rfu2","I");
00317 dxcap->rfu2 = e->GetIntField(jdxcap,field);
00318 field = e->GetFieldID(clazz,"rfu3","I");
00319 dxcap->rfu3 = e->GetIntField(jdxcap,field);
00320 field = e->GetFieldID(clazz,"rfu4","I");
00321 dxcap->rfu4 = e->GetIntField(jdxcap,field);
00322
00323 JVR_EXIT; return 0;
00324 }
00325
00326
00327
00328
00329 int jvr_convert_tngen_n2j (JNIEnv *e, jobject jtngen, TN_GEN *tngen) {
00330 JVR_ENTER;
00331
00332 if (jtngen == NULL) { jvr_throw(JVR_THROW_JVR,"jtngen argument cannot be null"); JVR_EXIT; return -1; }
00333 if (tngen == NULL) { jvr_throw(JVR_THROW_JVR,"tngen argument cannot be null"); JVR_EXIT; return -1; }
00334
00335 jclass clazz = tn_gen_class;
00336 jfieldID field = NULL;
00337
00338 field = e->GetFieldID(clazz,"tg_dflag","I");
00339 e->SetIntField(jtngen,field,tngen->tg_dflag);
00340 field = e->GetFieldID(clazz,"tg_freq1","I");
00341 e->SetIntField(jtngen,field,tngen->tg_freq1);
00342 field = e->GetFieldID(clazz,"tg_freq2","I");
00343 e->SetIntField(jtngen,field,tngen->tg_freq2);
00344 field = e->GetFieldID(clazz,"tg_ampl1","I");
00345 e->SetIntField(jtngen,field,tngen->tg_ampl1);
00346 field = e->GetFieldID(clazz,"tg_ampl2","I");
00347 e->SetIntField(jtngen,field,tngen->tg_ampl2);
00348 field = e->GetFieldID(clazz,"tg_dur","I");
00349 e->SetIntField(jtngen,field,tngen->tg_dur);
00350
00351 JVR_EXIT; return 0;
00352 }
00353
00354
00355
00356
00357 int jvr_convert_dvtpt_j2n (JNIEnv *e, jobjectArray jtptArray, DV_TPT *tpt) {
00358 JVR_ENTER;
00359 if (jtptArray == NULL) { jvr_throw(JVR_THROW_JVR,"jtptArray argument cannot be null"); JVR_EXIT; return -1; }
00360 if (e->GetArrayLength(jtptArray) == 0) { jvr_throw(JVR_THROW_JVR,"jtptArray cannot have size 0"); JVR_EXIT; return -1; }
00361 if (tpt == NULL) { jvr_throw(JVR_THROW_JVR,"tpt argument cannot be null"); JVR_EXIT; return -1; }
00362
00363 jsize arrayLength = e->GetArrayLength(jtptArray);
00364 if (arrayLength > JVR_DVTPT_MAXSIZE) {
00365 jvr_throw(JVR_THROW_JVR,"Length of jtptArray (%d) cannot exceed JVR_DVTPT_MAXSIZE (%d)",arrayLength,JVR_DVTPT_MAXSIZE);
00366 JVR_EXIT; return -1;
00367 }
00368
00369
00370
00371 jclass clazz = dv_tpt_class;
00372 jfieldID field = NULL;
00373 DV_TPT *current;
00374
00375
00376
00377
00378 for (int x = 0; x < arrayLength; x++) {
00379 jobject jtpt = e->GetObjectArrayElement(jtptArray,x);
00380 if (jtpt == NULL) {
00381 jvr_throw(JVR_THROW_JVR,"NULL element at offset %d in jtptArray",x);
00382 JVR_EXIT; return -1;
00383 }
00384 current = tpt+x;
00385 field = e->GetFieldID(clazz,"tp_type","I");
00386 current->tp_type = (unsigned short) e->GetIntField(jtpt,field);
00387 field = e->GetFieldID(clazz,"tp_termno","I");
00388 current->tp_termno = (unsigned short) e->GetIntField(jtpt,field);
00389 field = e->GetFieldID(clazz,"tp_length","I");
00390 current->tp_length = (unsigned short) e->GetIntField(jtpt,field);
00391 field = e->GetFieldID(clazz,"tp_flags","I");
00392 current->tp_flags = (unsigned short) e->GetIntField(jtpt,field);
00393 field = e->GetFieldID(clazz,"tp_data","I");
00394 current->tp_data = (unsigned short) e->GetIntField(jtpt,field);
00395 field = e->GetFieldID(clazz,"rfu","I");
00396 current->rfu = (unsigned short) e->GetIntField(jtpt,field);
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408 }
00409 JVR_EXIT; return 0;
00410 }
00411
00412
00413
00414
00415 int jvr_convert_tngen_j2n (JNIEnv *e, jobject jtngen, TN_GEN *tngen) {
00416 JVR_ENTER;
00417
00418 if (jtngen == NULL) { jvr_throw(JVR_THROW_JVR,"jtngen argument cannot be null"); JVR_EXIT; return -1; }
00419 if (tngen == NULL) { jvr_throw(JVR_THROW_JVR,"tngen argument cannot be null"); JVR_EXIT; return -1; }
00420
00421 jclass clazz = tn_gen_class;
00422 jfieldID field;
00423
00424 field = e->GetFieldID(clazz,"tg_dflag","I");
00425 tngen->tg_dflag = (unsigned short) e->GetIntField(jtngen,field);
00426 field = e->GetFieldID(clazz,"tg_freq1","I");
00427 tngen->tg_freq1 = (unsigned short) e->GetIntField(jtngen,field);
00428 field = e->GetFieldID(clazz,"tg_freq2","I");
00429 tngen->tg_freq2 = (unsigned short) e->GetIntField(jtngen,field);
00430 field = e->GetFieldID(clazz,"tg_ampl1","I");
00431 tngen->tg_ampl1 = (short) e->GetIntField(jtngen,field);
00432 field = e->GetFieldID(clazz,"tg_ampl2","I");
00433 tngen->tg_ampl2 = (short) e->GetIntField(jtngen,field);
00434 field = e->GetFieldID(clazz,"tg_dur","I");
00435 tngen->tg_dur = (short) e->GetIntField(jtngen,field);
00436
00437 JVR_EXIT; return 0;
00438 }
00439
00440
00441
00442
00443 int jvr_convert_tngencad_j2n(JNIEnv *e, jobject jtngencad, TN_GENCAD *tngencad) {
00444 JVR_ENTER;
00445
00446 if (jtngencad == NULL) { jvr_throw(JVR_THROW_JVR,"jtngencad argument cannot be null"); JVR_EXIT; return -1; }
00447 if (tngencad == NULL) { jvr_throw(JVR_THROW_JVR,"tngencad argument cannot be null"); JVR_EXIT; return -1; }
00448
00449 jclass clazz = tn_gencad_class;
00450 jfieldID field;
00451
00452 field = e->GetFieldID(clazz,"cycles","I");
00453 tngencad->cycles = e->GetIntField(jtngencad,field);
00454 field = e->GetFieldID(clazz,"numsegs","I");
00455 tngencad->numsegs = e->GetIntField(jtngencad,field);
00456
00457 field = e->GetFieldID(clazz,"offtime","[I");
00458 jintArray intArray = (jintArray) e->GetObjectField(jtngencad,field);
00459 jint *intBuf = e->GetIntArrayElements(intArray,NULL);
00460 for (int x = 0; x < tngencad->numsegs; x++) {
00461 tngencad->offtime[x] = intBuf[x];
00462 }
00463 e->ReleaseIntArrayElements(intArray,intBuf,0);
00464
00465 field = e->GetFieldID(clazz,"tone","[Lnet/threebit/jvr/TN_GEN;");
00466 jobjectArray jtngenArray = (jobjectArray) e->GetObjectField(jtngencad,field);
00467 if (jtngenArray == NULL) { jvr_throw(JVR_THROW_JVR,"tone member cannot be null"); JVR_EXIT; return -1; }
00468 for (int x = 0; x < tngencad->numsegs; x++) {
00469 jobject jtngen = e->GetObjectArrayElement(jtngenArray,x);
00470 if (jvr_convert_tngen_j2n(e,jtngen,&tngencad->tone[x]) == -1) {
00471
00472 JVR_EXIT; return -1;
00473 }
00474 }
00475
00476 JVR_EXIT; return 0;
00477 }
00478
00479
00480
00481
00482 int jvr_convert_dxxpb_j2n (JNIEnv *e, jobject jxpb, DX_XPB *xpb) {
00483 JVR_ENTER;
00484
00485 if (jxpb == NULL) { jvr_throw(JVR_THROW_JVR,"jxpb argument cannot be null"); JVR_EXIT; return -1; }
00486 if (xpb == NULL) { jvr_throw(JVR_THROW_JVR,"xpb argument cannot be null"); JVR_EXIT; return -1; }
00487
00488 xpb->wFileFormat = e->GetIntField(jxpb,dx_xpb_wFileFormat);
00489 xpb->nSamplesPerSec = e->GetLongField(jxpb,dx_xpb_nSamplesPerSec);
00490 xpb->wBitsPerSample = e->GetLongField(jxpb,dx_xpb_wBitsPerSample);
00491 xpb->wDataFormat = e->GetLongField(jxpb,dx_xpb_wDataFormat);
00492
00493 JVR_EXIT; return 0;
00494 }
00495
00496 extern DX_IOTT jvr_iott_buff[JVR_IOTT_SIZE];
00497 extern int jvr_iott_alloc[JVR_IOTT_SIZE];
00498 extern int jvr_iott_ready;
00499
00500
00501
00502
00503 int jvr_convert_dxiott_j2n(JNIEnv *e, jobjectArray jiottArray, DX_IOTT **iottp) {
00504 JVR_ENTER;
00505
00506 if (jiottArray == NULL) { jvr_throw(JVR_THROW_JVR,"jiottArray argument cannot be null"); JVR_EXIT; return -1; }
00507 if (iottp == NULL) { jvr_throw(JVR_THROW_JVR,"iottp argument cannot be null"); JVR_EXIT; return -1; }
00508 int length = e->GetArrayLength(jiottArray);
00509 if (length == 0) { jvr_throw(JVR_THROW_JVR,"jiottArray has length 0"); JVR_EXIT; return -1; }
00510 if (length > JVR_IOTT_SIZE) {
00511 jvr_throw(JVR_THROW_JVR,"Length of jiottArray (%d) cannot exceed JVR_IOTT_SIZE (%d)",length,JVR_IOTT_SIZE);
00512 JVR_EXIT; return -1;
00513 }
00514
00515 jclass clazz = dx_iott_class;
00516 jfieldID field;
00517 int offset;
00518 DX_IOTT *current = NULL;
00519 DX_IOTT *prev = NULL;
00520
00521 for (int x = 0; x < length; x++) {
00522
00523 jobject jiott = e->GetObjectArrayElement(jiottArray,x);
00524 if (jiott == NULL) { jvr_throw(JVR_THROW_JVR,"jiottArray contains NULL element at offset %d",x); JVR_EXIT; return -1; }
00525 field = e->GetFieldID(clazz,"offset","I");
00526 offset = e->GetIntField(jiott,field);
00527 if (offset == -1) { jvr_throw(JVR_THROW_JVR,"DX_IOTT object at offset %d has no native-context allocation",x); JVR_EXIT; return -1; }
00528 current = (DX_IOTT*) &jvr_iott_alloc[JVR_IOTT_SIZE];
00529 if (x == 0) {
00530
00531
00532 *iottp = current;
00533 }
00534
00535 current = *iottp;
00536 current->io_prevp = prev;
00537 if (prev != NULL) {
00538 prev->io_nextp = current;
00539 }
00540
00541 field = e->GetFieldID(clazz,"io_type","I");
00542 current->io_type = (unsigned short) e->GetIntField(jiott,field);
00543 if ((current->io_type & IO_CONT) || (current->io_type & IO_EOT) || (current->io_type & IO_LINK)) {
00544 jvr_throw(
00545 JVR_THROW_JVR,
00546 "DX_IOTT.io_type at offset %d included IO_EOT, IO_CONT or IO_LINK. These are managed by JVR automatically. Do not include them.",x);
00547 JVR_EXIT; return -1;
00548 }
00549 field = e->GetFieldID(clazz,"rfu","I");
00550 current->rfu = (unsigned short) e->GetIntField(jiott,field);
00551 field = e->GetFieldID(clazz,"io_fhandle","I");
00552 current->io_fhandle = e->GetIntField(jiott,field);
00553 field = e->GetFieldID(clazz,"io_offset","J");
00554 current->io_offset = (unsigned long) e->GetLongField(jiott,field);
00555 field = e->GetFieldID(clazz,"io_length","J");
00556 current->io_length = e->GetLongField(jiott,field);
00557 current->io_bufp = NULL;
00558 if (x == (length-1)) {
00559 current->io_type = current->io_type | IO_EOT;
00560 current->io_nextp = NULL;
00561 }
00562 else {
00563 current->io_type = current->io_type | IO_LINK;
00564 }
00565 }
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591 JVR_EXIT; return 0;
00592 }
00593
00594
00595
00596
00597 int jvr_convert_mscdtarray_j2n (JNIEnv *e, jobjectArray jmscdtArray, MS_CDT *cdt, int *numParties) {
00598 JVR_ENTER;
00599 if (jmscdtArray == NULL) { jvr_throw(JVR_THROW_JVR,"jmscdtArray argument cannot be null"); JVR_EXIT; return -1; }
00600 if (cdt == NULL) { jvr_throw(JVR_THROW_JVR,"cdt argument cannot be null"); JVR_EXIT; return -1; }
00601 if (numParties == NULL) { jvr_throw(JVR_THROW_JVR,"numParties argument cannot be null"); JVR_EXIT; return -1; }
00602 int length = e->GetArrayLength(jmscdtArray);
00603 if (length == 0) {
00604 jvr_throw(JVR_THROW_JVR,"MS_CDT array cannot have length zero");
00605 JVR_EXIT; return -1;
00606 }
00607 if (length >= JVR_MSCDT_MAXSIZE) {
00608 jvr_throw(JVR_THROW_JVR,"MS_CDT array has length %d, which exceeds maximum of %d",length,JVR_MSCDT_MAXSIZE);
00609 JVR_EXIT; return -1;
00610 }
00611 for (int x = 0; x < length; x++) {
00612
00613 MS_CDT *current = (cdt+x);
00614 jobject jmscdt = e->GetObjectArrayElement(jmscdtArray,x);
00615 if (jvr_convert_mscdt_j2n (e, jmscdt, current) == -1) {
00616 JVR_EXIT;
00617 return -1;
00618 }
00619 }
00620 *numParties = length;
00621 JVR_EXIT; return 0;
00622 }
00623
00624
00625
00626
00627 int jvr_convert_mscdtarray_n2j (JNIEnv *e, jobjectArray jmscdtArray, MS_CDT *cdt, int numParties) {
00628 JVR_ENTER;
00629 if (jmscdtArray == NULL) { jvr_throw(JVR_THROW_JVR,"jmscdtArray argument cannot be null"); JVR_EXIT; return -1; }
00630 if (cdt == NULL) { jvr_throw(JVR_THROW_JVR,"cdt argument cannot be null"); JVR_EXIT; return -1; }
00631
00632 int length = e->GetArrayLength(jmscdtArray);
00633 if (length != numParties) {
00634 jvr_throw(JVR_THROW_JVR,"Supplied MS_CDT array length (%d) not equal to numparties (%d)",length,numParties);
00635 JVR_EXIT; return -1;
00636 }
00637
00638 for (int x = 0; x < numParties; x++) {
00639 MS_CDT *current = (cdt+x);
00640 jobject jmscdt = e->GetObjectArrayElement(jmscdtArray,x);
00641 if (jvr_convert_mscdt_n2j(e,jmscdt,current) == -1) {
00642 JVR_EXIT;
00643 return -1;
00644 }
00645 }
00646
00647 JVR_EXIT; return 0;
00648 }
00649
00650
00651
00652
00653 int jvr_convert_mscdt_n2j (JNIEnv *e, jobject jmscdt, MS_CDT *cdt) {
00654 JVR_ENTER;
00655
00656 if (cdt == NULL) {jvr_throw(JVR_THROW_JVR,"cdt argument cannot be null"); JVR_EXIT; return -1; }
00657 if (jmscdt == NULL) {jvr_throw(JVR_THROW_JVR,"jmscdt argument cannot be null"); JVR_EXIT; return -1; }
00658
00659 e->SetIntField(jmscdt,ms_cdt_chan_num,cdt->chan_num);
00660 e->SetIntField(jmscdt,ms_cdt_chan_sel,cdt->chan_sel);
00661 e->SetIntField(jmscdt,ms_cdt_chan_attr,cdt->chan_attr);
00662
00663 JVR_EXIT;
00664 return 0;
00665 }
00666
00667
00668
00669
00670 int jvr_convert_mscdt_j2n (JNIEnv *e, jobject jmscdt, MS_CDT *cdt) {
00671 JVR_ENTER;
00672 cdt->chan_num = e->GetIntField(jmscdt,ms_cdt_chan_num);
00673 cdt->chan_sel = e->GetIntField(jmscdt,ms_cdt_chan_sel);
00674 cdt->chan_attr = e->GetIntField(jmscdt,ms_cdt_chan_attr);
00675 JVR_EXIT;
00676 return 0;
00677 }
00678
00679
00680
00681
00682 int jvr_convert_metaevent_n2j (JNIEnv *e, jobject jmeta, METAEVENT *meta) {
00683 JVR_ENTER;
00684 if (jmeta == NULL) { jvr_throw(JVR_THROW_JVR,"jmeta argument cannot be null"); JVR_EXIT; return -1; }
00685 if (meta == NULL) { jvr_throw(JVR_THROW_JVR,"meta argument cannot be null"); JVR_EXIT; return -1; }
00686
00687 e->SetLongField(jmeta,metaevent_magicno,(long) meta->magicno);
00688 e->SetLongField(jmeta,metaevent_flags,meta->flags);
00689
00690
00691 e->SetObjectField(
00692 jmeta,
00693 metaevent_evtdata,
00694 jvr_convert_evtdatap_n2j(
00695 e,
00696 meta->evttype,
00697 meta->evtlen,
00698 meta->evtdatap,
00699 meta
00700 )
00701 );
00702 e->SetLongField(jmeta,metaevent_evtlen,meta->evtlen);
00703 e->SetLongField(jmeta,metaevent_evtdev,meta->evtdev);
00704 e->SetLongField(jmeta,metaevent_evttype,meta->evttype);
00705 e->SetLongField(jmeta,metaevent_linedev,meta->linedev);
00706 e->SetLongField(jmeta,metaevent_crn,meta->crn);
00707
00708
00709
00710
00711
00712
00713 e->SetIntField(jmeta,metaevent_cclibid,meta->cclibid);
00714 e->SetIntField(jmeta,metaevent_rfu1,meta->rfu1);
00715
00716
00717 jobject jgcInfo = NULL;
00718 if (meta->flags & GCME_GC_EVENT) {
00719 GC_INFO gcInfo;
00720 if (gc_ResultInfo(meta, &gcInfo) != GC_SUCCESS) {
00721 jvr_throw(JVR_THROW_DG,"gc_ResultInfo() failed!");
00722 JVR_EXIT; return -1;
00723 }
00724 jgcInfo = e->NewObject(gc_info_class,gc_info_init);
00725 if (jgcInfo == NULL) {
00726 e->ExceptionDescribe();
00727
00728
00729 JVR_EXIT; return -1;
00730 }
00731 if (jvr_convert_gcinfo_n2j(e,jgcInfo,&gcInfo) == -1) {
00732 JVR_EXIT; return -1;
00733 }
00734 }
00735 e->SetObjectField(jmeta,metaevent_gcInfo,jgcInfo);
00736
00737 JVR_EXIT; return 0;
00738 }
00739
00740
00741
00742
00743 jobject jvr_convert_evtdatap_n2j (JNIEnv *e, long type, long len, void *datap, METAEVENT *meta) {
00744 JVR_ENTER;
00745
00746
00747 if (datap == NULL) { JVR_EXIT; return NULL; }
00748
00749 if (type == TDX_CST || type == TDX_SETHOOK) {
00750 DX_CST *cstp = (DX_CST*) datap;
00751 jobject jcst = e->NewObject(dx_cst_class,dx_cst_init);
00752 e->SetIntField(jcst, dx_cst_cst_event,cstp->cst_event);
00753 e->SetIntField(jcst, dx_cst_cst_data,cstp->cst_data);
00754 JVR_EXIT; return jcst;
00755 }
00756
00757 switch (len) {
00758 case 0:
00759 JVR_EXIT; return NULL;
00760 case 1: {
00761 char *cdatap = (char*) datap;
00762 jobject ret = e->NewObject(integer_class,integer_init,*cdatap);
00763 JVR_EXIT;
00764 return ret;
00765 }
00766 case 2: {
00767 short *sdatap = (short*) datap;
00768 if (*sdatap >= 0) {
00769 jobject ret = e->NewObject(integer_class,integer_init, *sdatap);
00770 JVR_EXIT;
00771 return ret;
00772 }
00773 else {
00774
00775 jobject ret = e->NewObject(integer_class,integer_init, (unsigned short) *sdatap);
00776 JVR_EXIT;
00777 return ret;
00778 }
00779 }
00780 case 4: {
00781 int *idatap = (int*) datap;
00782 jobject ret = e->NewObject(integer_class,integer_init, *idatap);
00783 JVR_EXIT;
00784 return ret;
00785 }
00786 case 8: {
00787 long *ldatap = (long*) datap;
00788 jobject ret = e->NewObject(long_class,long_init, *ldatap);
00789 JVR_EXIT;
00790 return ret;
00791 }
00792 case 12: {
00793 byte *cdatap = (byte*) datap;
00794 jbyteArray ret = e->NewByteArray(12);
00795 jbyte *byteBuf = e->GetByteArrayElements(ret,NULL);
00796 for (int x = 0; x < 12; x++) {
00797 byteBuf[x] = cdatap[x];
00798 }
00799 e->ReleaseByteArrayElements(ret,byteBuf,0);
00800 return ret;
00801 }
00802 case 16: {
00803
00804
00805
00806
00807
00808 JVR_EXIT; return NULL;
00809 }
00810 default:
00811 char buffer[1024];
00812 snprintf(buffer,1000,"Unhandled condition: type=%ld len=%ld (%s:%d)",(long int)type,(long int)len,__FILE__,__LINE__);
00813 jobject ret = e->NewStringUTF(buffer);
00814 JVR_EXIT;
00815 return ret;
00816 }
00817
00818 JVR_EXIT;
00819 }
00820
00821
00822
00823
00824 int jvr_convert_gcinfo_n2j (JNIEnv *e, jobject jgcInfo, GC_INFO *gcInfo) {
00825 JVR_ENTER;
00826 if (jgcInfo == NULL) {
00827 jvr_throw(JVR_THROW_JVR,"jgcInfo argument cannot be null");
00828 JVR_EXIT; return -1;
00829 }
00830 if (gcInfo == NULL) { jvr_throw(JVR_THROW_JVR,"gcInfo argument cannot be null"); JVR_EXIT; return -1; }
00831 e->SetObjectField(jgcInfo,gc_info_gcMsg,e->NewStringUTF(gcInfo->gcMsg));
00832 e->SetObjectField(jgcInfo,gc_info_ccLibName,e->NewStringUTF(gcInfo->ccLibName));
00833 e->SetObjectField(jgcInfo,gc_info_ccMsg,e->NewStringUTF(gcInfo->ccMsg));
00834 e->SetObjectField(jgcInfo,gc_info_additionalInfo,e->NewStringUTF(gcInfo->additionalInfo));
00835 e->SetIntField(jgcInfo,gc_info_gcValue,gcInfo->gcValue);
00836 e->SetIntField(jgcInfo,gc_info_ccLibId,gcInfo->ccLibId);
00837 e->SetLongField(jgcInfo,gc_info_ccValue,gcInfo->ccValue);
00838 JVR_EXIT; return 0;
00839 }
00840
00841
00842
00843
00844 int jvr_convert_ctdevinfo_n2j (JNIEnv *e, jobject jdevinfo, CT_DEVINFO *devinfo) {
00845 JVR_ENTER;
00846 if (devinfo == NULL) { jvr_throw(JVR_THROW_JVR,"devinfo argument cannot be null"); JVR_EXIT; return -1; }
00847 if (jdevinfo == NULL) { jvr_throw(JVR_THROW_JVR,"jdevinfo argument cannot be null"); JVR_EXIT; return -1; }
00848
00849 jclass clazz = ct_devinfo_class;
00850 jfieldID field;
00851
00852 e->SetLongField(jdevinfo, e->GetFieldID(clazz,"ct_prodid","J"), devinfo->ct_prodid);
00853 e->SetIntField(jdevinfo, e->GetFieldID(clazz,"ct_devfamily","I"), devinfo->ct_devfamily);
00854 e->SetIntField(jdevinfo, e->GetFieldID(clazz,"ct_devmode","I"), devinfo->ct_devmode);
00855 e->SetIntField(jdevinfo, e->GetFieldID(clazz,"ct_nettype","I"), devinfo->ct_nettype);
00856 e->SetIntField(jdevinfo, e->GetFieldID(clazz,"ct_busmode","I"), devinfo->ct_busmode);
00857 e->SetIntField(jdevinfo, e->GetFieldID(clazz,"ct_busencoding","I"), devinfo->ct_busencoding);
00858
00859 jintArray intArray = e->NewIntArray(7);
00860 e->SetObjectField(jdevinfo,e->GetFieldID(clazz,"ct_rfu","[I"),intArray);
00861
00862 jint *intBuf = e->GetIntArrayElements(intArray,NULL);
00863 for (int x = 0; x < 7; x++) {
00864 intBuf[x] = devinfo->ct_rfu[x];
00865 }
00866 e->ReleaseIntArrayElements(intArray,intBuf,0);
00867 JVR_EXIT;
00868 }
00869
00870
00871
00872
00873 int jvr_convert_gccallackblk_j2n(JNIEnv *e, jobject jcallack, GC_CALLACK_BLK *callack) {
00874 JVR_ENTER;
00875 if (jcallack == NULL) { jvr_throw(JVR_THROW_JVR,"jcallack argument cannot be null"); JVR_EXIT; return -1; }
00876 if (callack == NULL) { jvr_throw(JVR_THROW_JVR,"callack argument cannot be null"); JVR_EXIT; return -1; }
00877
00878 jclass clazz = gc_callack_blk_class;
00879 callack->type = e->GetLongField(jcallack, e->GetFieldID(clazz,"type","J"));
00880 if (callack->type != GCACK_SERVICE_INFO) {
00881 jvr_throw(JVR_THROW_JVR,"JVR only supports GCACK_SERVICE_INFO at this time. Sorry. Care to donate an ISDN test environment?");
00882 JVR_EXIT; return -1;
00883 }
00884
00885 callack->service.info.info_len = e->GetIntField(jcallack, e->GetFieldID(clazz,"info_len","I"));
00886 callack->service.info.info_type = e->GetIntField(jcallack, e->GetFieldID(clazz,"info_type","I"));
00887 JVR_EXIT;
00888 return 0;
00889 }
00890
00891
00892
00893
00894 int jvr_convert_ieblk_j2n (JNIEnv *e, jobject jieblk, IE_BLK *ieblk) {
00895 JVR_ENTER;
00896 if (jieblk == NULL) { jvr_throw(JVR_THROW_JVR,"jieblk argument cannot be null"); JVR_EXIT; return -1; }
00897 if (ieblk == NULL) { jvr_throw(JVR_THROW_JVR,"ieblk argument cannot be null"); JVR_EXIT; return -1; }
00898
00899 ieblk->length = (short) e->GetIntField(jieblk,ie_blk_length);
00900 if (ieblk->length >= MAXLEN_IEDATA) {
00901 jvr_throw(JVR_THROW_JVR,"length (%d) exceeds MAXLEN_IEDATA (%d)",ieblk->length,MAXLEN_IEDATA);
00902 JVR_EXIT; return -1;
00903 }
00904
00905 jintArray intArray = (jintArray) e->GetObjectField(jieblk,ie_blk_data);
00906 jint *intBuf = e->GetIntArrayElements(intArray,NULL);
00907 for (int x = 0; x < ieblk->length; x++) {
00908 ieblk->data[x] = (char) intBuf[x];
00909 }
00910 e->ReleaseIntArrayElements(intArray,intBuf,0);
00911 JVR_EXIT;
00912 return 0;
00913 }
00914
00915
00916
00917
00918 int jvr_convert_gcparm_j2n (JNIEnv *e, jobject jgcparm, GC_PARM *gcparm) {
00919 JVR_ENTER;
00920 if (jgcparm == NULL) { jvr_throw(JVR_THROW_JVR,"jgcparm argument cannot be null"); JVR_EXIT; return -1; }
00921 if (gcparm == NULL) { jvr_throw(JVR_THROW_JVR,"gcparm argument cannot be null"); JVR_EXIT; return -1; }
00922
00923 if (e->GetBooleanField(jgcparm, gc_parm_isString)) {
00924 jvr_throw(JVR_THROW_JVR,"GC_PARM objects with String values are not implemented yet.");
00925 JVR_EXIT;
00926 return -1;
00927 }
00928 gcparm->longvalue = (long) e->GetLongField(jgcparm, gc_parm_nvalue);
00929 JVR_EXIT;
00930 return 0;
00931 }
00932
00933
00934
00935
00936 int jvr_convert_intValue (JNIEnv *e, jobject intObject) {
00937 JVR_ENTER;
00938 if (intObject == NULL) { jvr_throw(JVR_THROW_JVR,"Cannot convert from NULL java.lang.Integer"); }
00939 int i = e->CallIntMethod(intObject,integer_intvalue);
00940 JVR_EXIT;
00941 return i;
00942 }
00943
00944
00945
00946
00947
00948
00949
00950 #define PUT_INT(k,v) (e->CallObjectMethod(map,putMethod,e->NewStringUTF(k), e->NewObject(intClass, intInit, v)))
00951
00952
00953
00954
00955
00956
00957 JNIEXPORT jobject JNICALL Java_net_threebit_jvr_jvr_importSymbols
00958 (JNIEnv *e, jclass c)
00959 {
00960 JVR_ENTER;
00961
00962 if (initializeJNIFields(e) == -1) { JVR_EXIT; return NULL; }
00963
00964
00965 jclass mapClass = hashmap_class;
00966 jmethodID putMethod = e->GetMethodID(mapClass, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
00967 jobject map = e->NewObject(mapClass, e->GetMethodID(mapClass, "<init>", "()V"));
00968
00969
00970 jclass intClass = integer_class;
00971 jmethodID intInit = e->GetMethodID(intClass, "<init>", "(I)V");
00972
00973 #ifdef DG_USER1_ASCII
00974 PUT_INT("DG_USER1_ASCII",DG_USER1_ASCII);
00975 #endif
00976 #ifdef DG_USER2_ASCII
00977 PUT_INT("DG_USER2_ASCII",DG_USER2_ASCII);
00978 #endif
00979 #ifdef DG_USER3_ASCII
00980 PUT_INT("DG_USER3_ASCII",DG_USER3_ASCII);
00981 #endif
00982 #ifdef DG_USER4_ASCII
00983 PUT_INT("DG_USER4_ASCII",DG_USER4_ASCII);
00984 #endif
00985 #ifdef DG_USER5_ASCII
00986 PUT_INT("DG_USER5_ASCII",DG_USER5_ASCII);
00987 #endif
00988
00989
00990
00991 #include "symbolput.cpp"
00992 JVR_EXIT; return map;
00993 }
00994
00995
00996
00997
00998
00999
01000 JNIEXPORT void JNICALL Java_net_threebit_jvr_jvr_initEventModel
01001 (JNIEnv *e, jclass c)
01002 {
01003 JVR_ENTER;
01004
01005 if (e->GetJavaVM(&vm) < 0) {
01006 jvr_throw(JVR_THROW_JVR,"GetJavaVM failed");
01007 JVR_EXIT; return;
01008 }
01009
01010 #ifdef WIN32
01011 if (sr_enbhdlr(EV_ANYDEV, EV_ANYEVT,&jvr_eventHandler) == -1) {
01012 jvr_throw(JVR_THROW_DG,"sr_enbhdlr() failed: (%d) %s",ATDV_LASTERR(SRL_DEVICE),ATDV_ERRMSGP(SRL_DEVICE));
01013 JVR_EXIT; return;
01014 }
01015 #endif
01016
01017 #ifdef LINUX
01018 int par = SR_SIGMODE;
01019 if (sr_setparm(SRL_DEVICE, SR_MODEID, &par ) == -1 ) {
01020 jvr_throw(JVR_THROW_DG,"sr_enbhdlr() failed: (%d) %s",ATDV_LASTERR(SRL_DEVICE),ATDV_ERRMSGP(SRL_DEVICE));
01021 JVR_EXIT; return;
01022 }
01023 if (sr_enbhdlr(EV_ANYDEV, EV_ANYEVT,&jvr_eventHandler) == -1) {
01024 jvr_throw(JVR_THROW_DG,"sr_enbhdlr() failed: (%d) %s",ATDV_LASTERR(SRL_DEVICE),ATDV_ERRMSGP(SRL_DEVICE));
01025 JVR_EXIT; return;
01026 }
01027 #endif
01028 JVR_EXIT;
01029 }
01030
01031
01032
01033
01034 void jvr_setdebuglevel (int level) {
01035 jvrDebugLevel = level;
01036 }
01037
01038
01039
01040
01041 int jvr_getdebuglevel() {
01042 return jvrDebugLevel;
01043 }
01044
01045
01046
01047
01048
01049
01050 JNIEXPORT void JNICALL Java_net_threebit_jvr_jvr_setDebugLevel
01051 (JNIEnv *e, jclass c, jint level) {
01052 jvr_setdebuglevel(level);
01053 }
01054
01055
01056
01057
01058
01059
01060 JNIEXPORT jint JNICALL Java_net_threebit_jvr_jvr_getDebugLevel
01061 (JNIEnv *, jclass) {
01062 return jvr_getdebuglevel();
01063 }
01064
01065
01066
01067
01068
01069
01070 JNIEXPORT void JNICALL Java_net_threebit_jvr_jvr_logNoise
01071 (JNIEnv *e, jclass c) {
01072 JVR_EELOG("NOISE");
01073 }
01074
01075
01076
01077
01078 JavaVM* jvr_getVM() {
01079 return vm;
01080 }