/** Native code component of XMValueNative.java. See corresponding Java class for docs regarding
    JNI methods.
    @author  J. Czechowski IV
    @since   NeXtMidas 2.7.1
    Changing all instances of XMValue::XMValue to just XMValue to work with the GFC compilers Since NeXtMidas 3.9.1
 */
#include "nxm_sys_libxm_XMValueNative.h"
#include <midas.h>
#include "xmcompat.h"

#if XM_SYS_VERSION_AT_LEAST(4,6,0)
#include <new>
#include <iostream>
#include <utility>
#include <string>
#include <mjackets.h>
#include <tables.h>
#include <string.h>
#include "midas/xmvalue.hh"

using namespace std;
typedef union {
  XMValue* xmvalue;
  jlong             pointer;
} pointer_union_t;

/** Gets the XMValue pointed at by the pointer stored in Java. */
static XMValue* asXMValue (jlong pointer) {
  pointer_union_t ptr;
  ptr.pointer = pointer;
  return ptr.xmvalue;
}

/** Convert a pointer to an XMObject to something we can store in Java.
    This method should only be called by "newPointer" and "..._init".
 */
static jlong asPointer (XMValue* val) {
  pointer_union_t ptr;
  ptr.pointer = 0;      // make sure any extra bits are zero'ed out
  ptr.xmvalue = val;
  return ptr.pointer;
}

/** Creates a new pointer we can use for the given object data. This effectively creates a new
    XMValue object and assigns the content of the val passed in to it. This is required since
    any XMValue that is created on the stack (i.e. in a method) is automatically cleaned up
    when no longer referencable (i.e. as soon as we go back into Java). By using "new" we can
    create an instance on the heap that will remain until we "delete" it. All pointers to an
    XMValue that we pass to Java must be created by either this method or the "..._init" method
    (immediately below). Since we need to clean up the memory when done, the Java "finalize()"
    method will call "..._free" to delete the object from the heap.
 */
static jlong newPointer (XMValue val) {
  XMValue *xmv;
  xmv = new XMValue;
  *xmv = val;
  return asPointer(xmv);
}

/** This code taken from XMidas.c */
static void checkMapping () {
  // Amit Nithian (5/31/2007) - Prevents segmentation faults by forcefully
  //   mapping to the control widgets shared memory buffer before getting
  //   the result parameter. This prevents the segmentation fault when
  //   trying to access a result parameter associated with a CTAG.
  static int bMapped = FALSE; // Have we mapped to the controls section?
  if (!bMapped && (Mc->mode != 0) && (Mt->nwidget >= 0)) {
    fprintf(stderr, "XmValueNative.cc: Mapping to LS_cntrl_widgets\n");
    m_map_section(LS_cntrl_widgets,2);
    bMapped = TRUE;
  }
}

#define CPP2J_STRING(str) env->NewStringUTF(str)
#define J2CPP_STRING(str) j2cppString(env,str)
static string j2cppString (JNIEnv *env, jstring str) {
  jsize len = env->GetStringUTFLength(str);
  char buf[len+1];
  env->GetStringUTFRegion(str, 0, len, buf);
  buf[len] = '\0';
  string s (buf, len);
  return s;
}

#endif

////////////////////////////////////////////////////////////////////////////////////////////////////
// JNI Methods (X-Midas 4.6 and later)
////////////////////////////////////////////////////////////////////////////////////////////////////
#if XM_SYS_VERSION_AT_LEAST(4,6,0)

// SUPPORT CHECK
JNIEXPORT jboolean JNICALL Java_nxm_sys_libxm_XMValueNative_isSupported (JNIEnv *env, jclass clazz) {
  return TRUE;
}

// RESULTS SET/GET
JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_vrfind0 (JNIEnv *env, jclass clazz, jstring name) {
  checkMapping();
  string           str = J2CPP_STRING(name);
  XMValue val;
  jint found = m_vrfind(str, val);
  return (found == 0)? 0 : newPointer(val);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_vrslt (JNIEnv *env, jclass clazz, jstring name, jlong pntr) {
  checkMapping();
  string            str = J2CPP_STRING(name);
  XMValue *val = asXMValue(pntr);
  XMValue  xmv;
  xmv = *val; // Usa a copy so NeXtMidas can delete it's version w/o affecting X-Midas results table
  m_vrslt(str, xmv);
}

// BASIC XMVALUE FUNCTIONS
JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_init (JNIEnv *env, jclass clazz) {
  XMValue *xmv;
  xmv = new XMValue;
  return asPointer(xmv);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_free (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  delete xmv;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValuea (JNIEnv *env, jclass clazz, jlong pointer, jstring v) {
  XMValue *xmv = asXMValue(pointer);
  *xmv = J2CPP_STRING(v);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueb (JNIEnv *env, jclass clazz, jlong pointer, jbyte v) {
  XMValue *xmv = asXMValue(pointer);
  *xmv = v;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValuei (JNIEnv *env, jclass clazz, jlong pointer, jshort v) {
  XMValue *xmv = asXMValue(pointer);
  *xmv = v;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValuel (JNIEnv *env, jclass clazz, jlong pointer, jint v) {
  XMValue *xmv = asXMValue(pointer);
  *xmv = v;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValuex (JNIEnv *env, jclass clazz, jlong pointer, jlong v) {
  XMValue *xmv = asXMValue(pointer);
  *xmv = (int_8)v; // NTN: need to cast to int_8 since XMValue does NOT have = operator for jlong
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValuef (JNIEnv *env, jclass clazz, jlong pointer, jfloat v) {
  XMValue *xmv = asXMValue(pointer);
  *xmv = v;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValued (JNIEnv *env, jclass clazz, jlong pointer, jdouble v) {
  XMValue *xmv = asXMValue(pointer);
  *xmv = v;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueB (JNIEnv *env, jclass clazz, jlong pointer, jbyteArray v) {
  XMValue *xmv = asXMValue(pointer);
  jsize len = env->GetArrayLength(v);
  jbyte* array = env->GetByteArrayElements(v, NULL);
  vector<jbyte> vect (array, array+len);
  *xmv = vect;
  env->ReleaseByteArrayElements(v, array, 0);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueI (JNIEnv *env, jclass clazz, jlong pointer, jshortArray v) {
  XMValue *xmv = asXMValue(pointer);
  jsize len = env->GetArrayLength(v);
  jshort* array = env->GetShortArrayElements(v, NULL);
  vector<jshort> vect (array, array+len);
  *xmv = vect;
  env->ReleaseShortArrayElements(v, array, 0);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueL (JNIEnv *env, jclass clazz, jlong pointer, jintArray v) {
  XMValue *xmv = asXMValue(pointer);
  jsize len = env->GetArrayLength(v);
  jint* array = env->GetIntArrayElements(v, NULL);
  vector<jint> vect (array, array+len);
  *xmv = vect;
  env->ReleaseIntArrayElements(v, array, 0);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueX (JNIEnv *env, jclass clazz, jlong pointer, jlongArray v) {
  XMValue *xmv = asXMValue(pointer);
  jsize len = env->GetArrayLength(v);
  jlong* array = env->GetLongArrayElements(v, NULL);
  vector<int_8> vect (array, array+len); // NTN: need to cast to int_8 since XMValue does NOT have = operator for jlong
  *xmv = vect;
  env->ReleaseLongArrayElements(v, array, 0);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueF (JNIEnv *env, jclass clazz, jlong pointer, jfloatArray v) {
  XMValue *xmv = asXMValue(pointer);
  jsize len = env->GetArrayLength(v);
  jfloat* array = env->GetFloatArrayElements(v, NULL);
  vector<jfloat> vect (array, array+len);
  *xmv = vect;
  env->ReleaseFloatArrayElements(v, array, 0);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueD (JNIEnv *env, jclass clazz, jlong pointer, jdoubleArray v) {
  XMValue *xmv = asXMValue(pointer);
  jsize len = env->GetArrayLength(v);
  jdouble* array = env->GetDoubleArrayElements(v, NULL);
  vector<jdouble> vect (array, array+len);
  *xmv = vect;
  env->ReleaseDoubleArrayElements(v, array, 0);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueXMValue (JNIEnv *env, jclass clazz, jlong pointer, jlong pntr) {
  XMValue *xmv = asXMValue(pointer);
  XMValue *val = asXMValue(pntr);
  *xmv = *val;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_addV (JNIEnv *env, jclass clazz, jlong pointer, jlong pntr) {
  XMValue *xmv = asXMValue(pointer);
  XMValue *val = asXMValue(pntr);
  xmv->append(*val);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_addKV (JNIEnv *env, jclass clazz, jlong pointer, jstring key, jlong pntr) {
  XMValue *xmv = asXMValue(pointer);
  XMValue *val = asXMValue(pntr);
  XMValue::KVPair pair(J2CPP_STRING(key), *val);
  xmv->append(pair);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_putKV (JNIEnv *env, jclass clazz, jlong pointer, jstring key, jlong pntr) {
  XMValue *xmv = asXMValue(pointer);
  XMValue *val = asXMValue(pntr);
  (*xmv)[J2CPP_STRING(key)] = *val;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setIV (JNIEnv *env, jclass clazz, jlong pointer, jint index, jlong pntr) {
  XMValue *xmv = asXMValue(pointer);
  XMValue *val = asXMValue(pntr);
  (*xmv)[index-1] = *val;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setIKV (JNIEnv *env, jclass clazz, jlong pointer, jint index, jstring key, jlong pntr) {
  XMValue *xmv = asXMValue(pointer);
  XMValue *val = asXMValue(pntr);
  XMValue::KVPair pair(J2CPP_STRING(key), *val);
  xmv->as<XMValue::KVList>().at(index-1) = pair;
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueT (JNIEnv *env, jclass clazz, jlong pointer, jchar type) {
  XMValue *xmv = asXMValue(pointer);
  xmv->assign((XMValue::Type_t)type);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_setValueTSV (JNIEnv *env, jclass clazz, jlong pointer, jchar type, jint size, jdouble val) {
  XMValue *xmv = asXMValue(pointer);
  xmv->assign((XMValue::Type_t)type, (size_t)size, val);
}

JNIEXPORT void JNICALL Java_nxm_sys_libxm_XMValueNative_clear (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  xmv->clear();
}

JNIEXPORT jchar JNICALL Java_nxm_sys_libxm_XMValueNative_getType (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  return (jchar)xmv->type();
}

JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_size (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  return (jlong)xmv->size();
}

JNIEXPORT jboolean JNICALL Java_nxm_sys_libxm_XMValueNative_isScalar (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  return (xmv->impl() == XMValue::IMP_NONE);
}

JNIEXPORT jboolean JNICALL Java_nxm_sys_libxm_XMValueNative_containsKey (JNIEnv *env, jclass clazz, jlong pointer, jstring key) {
  XMValue *xmv = asXMValue(pointer);
  return xmv->has_key(J2CPP_STRING(key));
}

JNIEXPORT jdouble JNICALL Java_nxm_sys_libxm_XMValueNative_toD (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  return xmv->to<jdouble>();
}

JNIEXPORT jfloat JNICALL Java_nxm_sys_libxm_XMValueNative_toF (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  return xmv->to<jfloat>();
}

JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_toX (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  return xmv->to<int_8>();// NTN: need to cast to int_8 since XMValue does NOT have to<jlong>() method
}

JNIEXPORT jint JNICALL Java_nxm_sys_libxm_XMValueNative_toL (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  return xmv->to<jint>();
}

JNIEXPORT jshort JNICALL Java_nxm_sys_libxm_XMValueNative_toI (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  return xmv->to<jshort>();
}

JNIEXPORT jbyte JNICALL Java_nxm_sys_libxm_XMValueNative_toB (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  return xmv->to<jbyte>();
}

JNIEXPORT jstring JNICALL Java_nxm_sys_libxm_XMValueNative_toA (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  string str = xmv->to<string>();
  return CPP2J_STRING(str.c_str());
}

JNIEXPORT jstring JNICALL Java_nxm_sys_libxm_XMValueNative_toZ (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  string str = xmv->to<string>();
  return CPP2J_STRING(str.c_str());
}

JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_getI (JNIEnv *env, jclass clazz, jlong pointer, jint index) {
  XMValue *xmv = asXMValue(pointer);
  XMValue  val = xmv->at(index-1);
  return newPointer(val);
}

JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_getK (JNIEnv *env, jclass clazz, jlong pointer, jstring key) {
  XMValue *xmv = asXMValue(pointer);
  XMValue  val = (*xmv)[J2CPP_STRING(key)];
  return newPointer(val);
}

JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_vectorize (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  XMValue  val = xmv->vectorize();
  return newPointer(val);
}

JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_tablize (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  XMValue  val = xmv->tablize();
  return newPointer(val);
}

JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_keys (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  XMValue  val = xmv->keys();
  return newPointer(val);
}

JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_items (JNIEnv *env, jclass clazz, jlong pointer) {
  XMValue *xmv = asXMValue(pointer);
  XMValue  val = xmv->items();
  return newPointer(val);
}

JNIEXPORT jstring JNICALL Java_nxm_sys_libxm_XMValueNative_getKey (JNIEnv *env, jclass clazz, jlong pointer, jint index) {
  XMValue *xmv = asXMValue(pointer);
  XMValue::KVPair  pair = xmv->as<XMValue::KVList>().at(index-1); // <-- Not sure if this is "public API"
  return CPP2J_STRING(pair.first.c_str());
}

JNIEXPORT jlong JNICALL Java_nxm_sys_libxm_XMValueNative_getVal (JNIEnv *env, jclass clazz, jlong pointer, jint index) {
  XMValue *xmv = asXMValue(pointer);
  XMValue::KVPair  pair = xmv->as<XMValue::KVList>().at(index-1); // <-- Not sure if this is "public API"
  return newPointer(pair.second);
}

#else
////////////////////////////////////////////////////////////////////////////////////////////////////
// JNI Method Stubs (X-Midas 4.4 and earlier)
////////////////////////////////////////////////////////////////////////////////////////////////////
// SUPPORT CHECK
JNIEXPORT jboolean JNICALL Java_nxm_sys_libxm_XMValueNative_isSupported     (JNIEnv *env, jclass clazz) { return FALSE; }
// RESULTS SET/GET
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_vrfind0         (JNIEnv *env, jclass clazz, jstring name) { return 0; }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_vrslt           (JNIEnv *env, jclass clazz, jstring name, jlong pntr) { }
// BASIC XMVALUE FUNCTIONS
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_init            (JNIEnv *env, jclass clazz) { return 0; }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_free            (JNIEnv *env, jclass clazz, jlong pointer) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValuea       (JNIEnv *env, jclass clazz, jlong pointer, jstring      v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueb       (JNIEnv *env, jclass clazz, jlong pointer, jbyte        v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValuei       (JNIEnv *env, jclass clazz, jlong pointer, jshort       v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValuel       (JNIEnv *env, jclass clazz, jlong pointer, jint         v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValuex       (JNIEnv *env, jclass clazz, jlong pointer, jlong        v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValuef       (JNIEnv *env, jclass clazz, jlong pointer, jfloat       v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValued       (JNIEnv *env, jclass clazz, jlong pointer, jdouble      v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueB       (JNIEnv *env, jclass clazz, jlong pointer, jbyteArray   v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueI       (JNIEnv *env, jclass clazz, jlong pointer, jshortArray  v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueL       (JNIEnv *env, jclass clazz, jlong pointer, jintArray    v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueX       (JNIEnv *env, jclass clazz, jlong pointer, jlongArray   v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueF       (JNIEnv *env, jclass clazz, jlong pointer, jfloatArray  v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueD       (JNIEnv *env, jclass clazz, jlong pointer, jdoubleArray v) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueXMValue (JNIEnv *env, jclass clazz, jlong pointer, jlong     pntr) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_addV            (JNIEnv *env, jclass clazz, jlong pointer, jlong     pntr) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_addKV           (JNIEnv *env, jclass clazz, jlong pointer, jstring key, jlong pntr) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_putKV           (JNIEnv *env, jclass clazz, jlong pointer, jstring key, jlong pntr) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setIV           (JNIEnv *env, jclass clazz, jlong pointer, jint index, jlong pntr) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setIKV          (JNIEnv *env, jclass clazz, jlong pointer, jint index, jstring key, jlong pntr) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueT       (JNIEnv *env, jclass clazz, jlong pointer, jchar type) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_setValueTSV     (JNIEnv *env, jclass clazz, jlong pointer, jchar type, jint size, jdouble val) { }
JNIEXPORT void     JNICALL Java_nxm_sys_libxm_XMValueNative_clear           (JNIEnv *env, jclass clazz, jlong pointer) { }
JNIEXPORT jchar    JNICALL Java_nxm_sys_libxm_XMValueNative_getType         (JNIEnv *env, jclass clazz, jlong pointer) { return ' '; }
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_size            (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jboolean JNICALL Java_nxm_sys_libxm_XMValueNative_containsKey     (JNIEnv *env, jclass clazz, jlong pointer, jstring key) { return FALSE; }
JNIEXPORT jdouble  JNICALL Java_nxm_sys_libxm_XMValueNative_toD             (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jfloat   JNICALL Java_nxm_sys_libxm_XMValueNative_toF             (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_toX             (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jint     JNICALL Java_nxm_sys_libxm_XMValueNative_toL             (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jshort   JNICALL Java_nxm_sys_libxm_XMValueNative_toI             (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jbyte    JNICALL Java_nxm_sys_libxm_XMValueNative_toB             (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jbyte    JNICALL Java_nxm_sys_libxm_XMValueNative_toO             (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jstring  JNICALL Java_nxm_sys_libxm_XMValueNative_toA             (JNIEnv *env, jclass clazz, jlong pointer) { return NULL; }
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_getI            (JNIEnv *env, jclass clazz, jlong pointer, jint index) { return 0; }
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_getK            (JNIEnv *env, jclass clazz, jlong pointer, jstring key) { return 0; }
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_vectorize       (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_tablize         (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_keys            (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_items           (JNIEnv *env, jclass clazz, jlong pointer) { return 0; }
JNIEXPORT jstring  JNICALL Java_nxm_sys_libxm_XMValueNative_getKey          (JNIEnv *env, jclass clazz, jlong pointer, jint index) { return 0; }
JNIEXPORT jlong    JNICALL Java_nxm_sys_libxm_XMValueNative_getVal          (JNIEnv *env, jclass clazz, jlong pointer, jint index) { return 0; }

#endif
