FACT++  1.0
JNIEXPORT jint JNICALL Java_dim_ObjectDescriptor_addFieldToObjectDescriptor ( JNIEnv *  env,
jclass  nativeClass,
jlong  desc,
jstring  fieldName,
jstring  fieldType,
jint  offset 
)

Definition at line 2424 of file dim_jni.c.

References objectDescriptorEntry_struct::array, objectDescriptorEntry_struct::arrayOffset, DBGe, dim_Dbg_DESCRIPTORS, f_boolean, f_byte, f_char, f_double, f_float, f_int, f_long, f_short, f_skip, objectDescriptorEntry_struct::fieldID, getNextDescriptorEntry(), Java_dim_ObjectDescriptor_deleteObjectDescriptor(), objectDescriptorEntry_struct::length, objectDescriptorEntry_struct::offset, and objectDescriptorEntry_struct::type.

Referenced by getNextDescriptorEntry().

2425 {
2426 // FieldType field_type = f_int;
2428  const char* name = (*env)->GetStringUTFChars(env, fieldName, 0);
2429  const char* type = (*env)->GetStringUTFChars(env, fieldType, 0);
2430  jfieldID fieldID = (*env)->GetFieldID(env, ((objectDescriptor_type*) desc)->objectClass, name, type);
2431 
2432  // TODO throw an error if there is no such FieldID
2433 
2434  DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.addFieldToObjectDescriptor %08lx Field %s Type %s\n", (dim_long) desc, name, type);
2435  // TODO: if(entry==NULL) throw out-of-memory exception, set length to 0
2436 
2437  // TODO: if(fieldType == "I") field_type = f_int; etc
2438 
2439  if(nativeClass){}
2440  entry->type =f_skip;
2441  entry->length =0;
2442  entry->offset =offset;
2443  entry->fieldID =fieldID;
2444  entry->array =0;
2445  entry->arrayOffset =0;
2446 
2447  switch (*type)
2448  {
2449  case 'Z':
2450  {
2451  entry->type =f_boolean;
2452  entry->length =sizeof(jboolean);
2453  break;
2454  }
2455  case 'B':
2456  {
2457  entry->type =f_byte;
2458  entry->length =sizeof(jbyte);
2459  break;
2460  }
2461 
2462  case 'C':
2463  {
2464  entry->type =f_char;
2465  entry->length =sizeof(jchar);
2466  break;
2467  }
2468 
2469  case 'S':
2470  {
2471  entry->type =f_short;
2472  entry->length =sizeof(jshort);
2473  break;
2474  }
2475 
2476  case 'I':
2477  {
2478  entry->type =f_int;
2479  entry->length =sizeof(jint);
2480  break;
2481  }
2482 
2483  case 'J':
2484  {
2485  entry->type =f_long;
2486  entry->length =sizeof(jlong);
2487  break;
2488  }
2489 
2490  case 'F':
2491  {
2492  entry->type =f_float;
2493  entry->length =sizeof(jfloat);
2494  break;
2495  }
2496 
2497  case 'D':
2498  {
2499  entry->type =f_double;
2500  entry->length =sizeof(jdouble);
2501  break;
2502  }
2503 
2504  //case '[':
2505  //{
2506  // // TODO deal with array types
2507  //}
2508  default :
2509  {
2510  printf("DimJNI: addFieldToObjectDescriptor - type %s not yet supported. (field %s)\n", name, type);
2511  }
2512  }
2513 
2514 
2515  (*env)->ReleaseStringUTFChars(env, fieldName, name);
2516  (*env)->ReleaseStringUTFChars(env, fieldType, type);
2517  return entry->length;
2518 }
objectDescriptorEntry_type * getNextDescriptorEntry(objectDescriptor_type *descriptor)
Definition: dim_jni.c:2402
#define dim_Dbg_DESCRIPTORS
Definition: dim_jni.h:60
int type
long dim_long
Definition: dim_common.h:57
#define DBGe(test)
Definition: dim_jni.c:64
if(extraDns) new Dns

+ Here is the call graph for this function:

+ Here is the caller graph for this function: