Changeset 25245 for main/trunk/greenstone2/common-src/indexers
- Timestamp:
- 2012-03-21T20:15:19+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/common-src/indexers/mgpp/jni/MGPPSearchWrapperImpl.cpp
r25244 r25245 35 35 #include "GSDLQueryParser.h" 36 36 #include "MGQuery.h" 37 38 // turning on debugging 39 #define _DEBUG 37 40 38 41 MGPPSearchData::MGPPSearchData() { … … 162 165 Java_org_greenstone_mgpp_MGPPSearchWrapper_initCppSide (JNIEnv *j_env, jobject j_obj){ 163 166 167 #ifdef _DEBUG 168 cerr << "**** JNI debugging for GS3. initCppSide: SetLongField()\n"; 169 #endif 170 164 171 MGPPSearchData * data = new MGPPSearchData(); 172 173 #ifdef _DEBUG 174 fprintf (stderr, "1a. data before SetLongField() is: %ld and as hex: %lX\n", data, data); 175 fprintf (stderr, "1b. FID_mgpp_data before SetLongField() is: %ld and as hex: %lX\n", FID_mgpp_data, FID_mgpp_data); 176 #endif 177 165 178 j_env->SetLongField(j_obj, FID_mgpp_data, (long)data); 179 180 #ifdef _DEBUG 181 fprintf (stderr, "1a. data after SetLongField() is: %ld and as hex: %lX\n", data, data); 182 fprintf (stderr, "1b. FID_mgpp_data after SetLongField() is: %ld and as hex: %lX\n", FID_mgpp_data, FID_mgpp_data); 183 #endif 166 184 167 185 return true; … … 177 195 JNIEXPORT jboolean JNICALL 178 196 Java_org_greenstone_mgpp_MGPPSearchWrapper_loadIndexData (JNIEnv *j_env, jobject j_obj, jstring j_index_name) { 197 #ifdef _DEBUG 198 fprintf (stderr, "in loadIndexData\n"); 199 #endif 179 200 180 201 jlong data_ptr = j_env->GetLongField(j_obj, FID_mgpp_data); 202 203 #ifdef _DEBUG 204 fprintf (stderr, "1. data_ptr at start is: %ld and as hex: %lX\n", data_ptr, data_ptr); 205 #endif 206 181 207 MGPPSearchData * data = (MGPPSearchData *)data_ptr; 182 208 … … 210 236 Java_org_greenstone_mgpp_MGPPSearchWrapper_unloadIndexData (JNIEnv *j_env, jobject j_obj) { 211 237 238 #ifdef _DEBUG 239 fprintf (stderr, "in unloadIndexData\n"); 240 #endif 241 212 242 jlong data_ptr = j_env->GetLongField(j_obj, FID_mgpp_data); 243 244 #ifdef _DEBUG 245 fprintf (stderr, "1. data_ptr at start is: %ld and as hex: %lX\n", data_ptr, data_ptr); 246 #endif 247 213 248 MGPPSearchData * data = (MGPPSearchData *)data_ptr; 214 249 … … 428 463 jobject j_obj, 429 464 jstring j_level){ 465 // print to stderr start of setReturnLevel, print out FID.. 466 // %ld or %x -> need to print out pointer - 467 // Later consider field containing unsignedlong instead of long 468 469 #ifdef _DEBUG 470 cerr << "In MGPPSearchWrapperImpl.setReturnLevel()\n"; 471 fprintf (stderr, "1. FID_mgpp_data at start is: %ld and as hex: %lX\n", FID_mgpp_data, FID_mgpp_data); 472 #endif 430 473 431 474 jlong data_ptr = j_env->GetLongField(j_obj, FID_mgpp_data); 432 MGPPSearchData * data = (MGPPSearchData *)j_env->GetLongField(j_obj, FID_mgpp_data); 433 434 475 476 #ifdef _DEBUG 477 fprintf (stderr, "1a. data_ptr at start is: %ld and as hex: %lX\n", data_ptr, data_ptr); 478 #endif 479 480 MGPPSearchData * data = (MGPPSearchData *)j_env->GetLongField(j_obj, FID_mgpp_data); 481 482 #ifdef _DEBUG 483 fprintf (stderr, "2a. FID_mgpp_data after data instantiation: %ld and as hex: %lX\n", FID_mgpp_data, FID_mgpp_data); 484 fprintf (stderr, "2b. Pointer value of data upon inst: %ld and as hex: %lX\n", data, data); 485 #endif 486 487 // print out FID again.. as long decimal and as hex 488 // %ld or %x -> need to print out pointer - 489 // in the C code in the Setlong bit in this file 490 // And the place on the java side, maybe in the configure 491 // org.greenstone.gsdl3.service.GS2MGPPSearch.configure(Lorg/w3c/dom/Element;Lorg/w3c/dom/Element;)Z+18 492 // find out what value we're SETTING the value of the pointer to 435 493 const char * level = j_env->GetStringUTFChars(j_level, NULL); 436 494 if (level==NULL) { 437 495 return; // exception already thrown 438 496 } 497 498 #ifdef _DEBUG 499 fprintf (stderr, "3a. FID_mgpp_data after level: %ld and as hex: %lX\n", FID_mgpp_data, FID_mgpp_data); 500 fprintf (stderr, "3b. Pointer value of data after level: %ld and as hex: %lX\n", data, data); 501 #endif 439 502 440 503 data->level.clear(); 504 505 #ifdef _DEBUG 506 fprintf (stderr, "4a. FID_mgpp_data after data->level.clear(): %ld and as hex: %lX\n", FID_mgpp_data, FID_mgpp_data); 507 fprintf (stderr, "4b. Pointer value of data after level.clear(): %ld and as hex: %lX\n", data, data); 508 #endif 509 441 510 SetCStr(data->level, level); 511 512 #ifdef _DEBUG 513 fprintf (stderr, "5a. FID_mgpp_data after SetCStr on data: %ld and as hex: %lX\n", FID_mgpp_data, FID_mgpp_data); 514 fprintf (stderr, "5b. Pointer value of data after SetCStr: %ld and as hex: %lX\n", data, data); 515 #endif 442 516 443 517 // release the java stuff 444 518 j_env->ReleaseStringUTFChars(j_level, level); 519 520 #ifdef _DEBUG 521 fprintf (stderr, "5a. FID_mgpp_data at end of setReturnLevel: %ld and as hex: %lX\n", FID_mgpp_data, FID_mgpp_data); 522 fprintf (stderr, "5b. Pointer value of data at end of SetReturnLevel: %ld and as hex: %lX\n", data, data); 523 #endif 445 524 446 525 }
Note:
See TracChangeset
for help on using the changeset viewer.