当前位置: 首页>>代码示例>>C++>>正文


C++ LONG_TO_PTR函数代码示例

本文整理汇总了C++中LONG_TO_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ LONG_TO_PTR函数的具体用法?C++ LONG_TO_PTR怎么用?C++ LONG_TO_PTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LONG_TO_PTR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Java_aura_rt_VM_newDoubleArray

DoubleArray* Java_aura_rt_VM_newDoubleArray(Env* env, Class* c, jlong address, jint size) {
    DoubleArray* array = rvmNewDoubleArray(env, size);
    if (array) {
        memcpy(array->values, LONG_TO_PTR(address), size * sizeof(jdouble));
    }
    return array;
}
开发者ID:Zubnix,项目名称:aura,代码行数:7,代码来源:aura_rt_VM.c

示例2: Java_org_robovm_rt_VM_newFloatArray

FloatArray* Java_org_robovm_rt_VM_newFloatArray(Env* env, Class* c, jlong address, jint size) {
    FloatArray* array = rvmNewFloatArray(env, size);
    if (array) {
        memcpy(array->values, LONG_TO_PTR(address), size * sizeof(jfloat));
    }
    return array;
}
开发者ID:tobium,项目名称:robovm,代码行数:7,代码来源:org_robovm_rt_VM.c

示例3: Java_java_lang_Thread_internalGetStackTrace

ObjectArray* Java_java_lang_Thread_internalGetStackTrace(Env* env, Class* cls, JavaThread* threadObj) {
    Thread* thread = (Thread*) LONG_TO_PTR(threadObj->threadPtr);
    CallStack* callStack = NULL;
    if (thread) {
        callStack = rvmCaptureCallStackForThread(env, thread);
    }
    return rvmCallStackToStackTraceElements(env, callStack, 0);
}
开发者ID:Andorion,项目名称:robovm,代码行数:8,代码来源:java_lang_Thread.c

示例4: Java_java_lang_Thread_internalSetPriority

void Java_java_lang_Thread_internalSetPriority(Env* env, Class* cls, JavaThread* threadObj, jint priority) {
    rvmLockThreadsList();
    Thread* thread = (Thread*) LONG_TO_PTR(threadObj->threadPtr);
    if (thread) {
        rvmChangeThreadPriority(env, thread, priority);
    }
    rvmUnlockThreadsList();
}
开发者ID:Andorion,项目名称:robovm,代码行数:8,代码来源:java_lang_Thread.c

示例5: Java_java_lang_Thread_internalInterrupt

void Java_java_lang_Thread_internalInterrupt(Env* env, Class* cls, JavaThread* threadObj) {
    rvmLockThreadsList();
    Thread* thread = (Thread*) LONG_TO_PTR(threadObj->threadPtr);
    if (thread) {
        rvmThreadInterrupt(env, thread);
    }
    rvmUnlockThreadsList();
}
开发者ID:Andorion,项目名称:robovm,代码行数:8,代码来源:java_lang_Thread.c

示例6: Java_java_lang_Thread_internalSetName

void Java_java_lang_Thread_internalSetName(Env* env, Class* cls, JavaThread* threadObj, Object* threadName) {
    rvmLockThreadsList();
    Thread* thread = (Thread*) LONG_TO_PTR(threadObj->threadPtr);
    if (thread) {
        rvmThreadNameChanged(env, thread);
    }
    rvmUnlockThreadsList();
}
开发者ID:Andorion,项目名称:robovm,代码行数:8,代码来源:java_lang_Thread.c

示例7: Java_java_lang_reflect_Method_getExceptionTypes

ObjectArray* Java_java_lang_reflect_Method_getExceptionTypes(Env* env, Class* clazz, jlong methodPtr) {
    Method* method = (Method*) LONG_TO_PTR(methodPtr);
    Class* java_lang_reflect_Proxy = rvmFindClassUsingLoader(env, "java/lang/reflect/Proxy", NULL);
    if (method->clazz->superclass == java_lang_reflect_Proxy) {
        return rvmAttributeGetExceptions(env, ((ProxyMethod*) method)->proxiedMethod);
    }
    return rvmAttributeGetExceptions(env, method);
}
开发者ID:bugvm,项目名称:bugvm,代码行数:8,代码来源:java_lang_reflect_Method.c

示例8: Java_java_lang_Thread_internalGetState

jint Java_java_lang_Thread_internalGetState(Env* env, Class* cls, JavaThread* threadObj) {
    rvmLockThreadsList();
    Thread* thread = (Thread*) LONG_TO_PTR(threadObj->threadPtr);
    jint status = THREAD_ZOMBIE; // If thread==NULL we assume the thread has been finished
    if (thread) {
        status = thread->status;
    }
    rvmUnlockThreadsList();
    return status;
}
开发者ID:Andorion,项目名称:robovm,代码行数:10,代码来源:java_lang_Thread.c

示例9: Java_java_lang_Thread_internalIsInterrupted

jboolean Java_java_lang_Thread_internalIsInterrupted(Env* env, Class* cls, JavaThread* threadObj) {
    rvmLockThreadsList();
    Thread* thread = (Thread*) LONG_TO_PTR(threadObj->threadPtr);
    jboolean interrupted = FALSE;
    if (thread) {
        interrupted = thread->interrupted;
    }
    rvmUnlockThreadsList();
    return interrupted;
}
开发者ID:Andorion,项目名称:robovm,代码行数:10,代码来源:java_lang_Thread.c

示例10: getFieldFromFieldObject

Field* getFieldFromFieldObject(Env* env, Object* fieldObject) {
    if (!java_lang_reflect_Field) {
        java_lang_reflect_Field = rvmFindClassUsingLoader(env, "java/lang/reflect/Field", NULL);
        if (!java_lang_reflect_Field) return NULL;
    }
    if (!java_lang_reflect_Field_field) {
        java_lang_reflect_Field_field = rvmGetInstanceField(env, java_lang_reflect_Field, "field", "J");
        if (!java_lang_reflect_Field_field) return NULL;
    }
    return (Field*) LONG_TO_PTR(rvmGetLongInstanceFieldValue(env, fieldObject, java_lang_reflect_Field_field));
}
开发者ID:Arcnor,项目名称:robovm,代码行数:11,代码来源:reflection_helpers.c

示例11: getMethodFromMethodObject

Method* getMethodFromMethodObject(Env* env, Object* methodObject) {
    if (!java_lang_reflect_Method) {
        java_lang_reflect_Method = rvmFindClassUsingLoader(env, "java/lang/reflect/Method", NULL);
        if (!java_lang_reflect_Method) return NULL;
    }
    if (!java_lang_reflect_Method_method) {
        java_lang_reflect_Method_method = rvmGetInstanceField(env, java_lang_reflect_Method, "method", "J");
        if (!java_lang_reflect_Method_method) return NULL;
    }
    return (Method*) LONG_TO_PTR(rvmGetLongInstanceFieldValue(env, methodObject, java_lang_reflect_Method_method));
}
开发者ID:Arcnor,项目名称:robovm,代码行数:11,代码来源:reflection_helpers.c

示例12: Java_aura_rt_VM_newBooleanArray

BooleanArray* Java_aura_rt_VM_newBooleanArray(Env* env, Class* c, jlong address, jint size) {
    BooleanArray* array = rvmNewBooleanArray(env, size);
    if (array) {
        jbyte* data = (jbyte*) LONG_TO_PTR(address);
        jint i = 0;
        for (i = 0; i < size; i++) {
            array->values[i] = *data ? TRUE : FALSE;
            data++;
        }
    }
    return array;
}
开发者ID:Zubnix,项目名称:aura,代码行数:12,代码来源:aura_rt_VM.c

示例13: Java_java_lang_Throwable_nativeGetStackTrace

ObjectArray* Java_java_lang_Throwable_nativeGetStackTrace(Env* env, Object* thiz, jlong stackState) {
    CallStack* callStack = (CallStack*) LONG_TO_PTR(stackState);
    if (!callStack) {
        return rvmCallStackToStackTraceElements(env, NULL, 0);
    }

    jint index = 0;
    jint first = 0;
    Method* m = rvmGetNextCallStackMethod(env, callStack, &index);
    if (m && m->clazz == java_lang_Throwable && !strcmp(m->name, "nativeFillInStackTrace")) {
        // Skip Throwable.nativeFillInStackTrace()
        rvmGetNextCallStackMethod(env, callStack, &index); // Skip Throwable.fillInStackTrace()
        m = rvmGetNextCallStackMethod(env, callStack, &index);
        first = index;
        if (m) {
            Class* clazz = m->clazz;
            if (clazz == java_lang_Throwable && METHOD_IS_CONSTRUCTOR(m)) {
                // fillInStackTrace() was called from the constructor of Throwable
                // Skip all constructors until the constructor of thiz->clazz
                Class* superclass = java_lang_Object;
                while (m && METHOD_IS_CONSTRUCTOR(m) && clazz != thiz->clazz && clazz->superclass == superclass) {
                    m = rvmGetNextCallStackMethod(env, callStack, &index);
                    if (m && m->clazz != clazz) {
                        superclass = clazz;
                        clazz = m->clazz;
                    }
                    first = index - 1;
                }
                // We're now at the constructor of thiz->clazz which called super(). 
                // Skip all constructors belonging to thiz->clazz to get to the method which created the throwable
                while (m && METHOD_IS_CONSTRUCTOR(m) && clazz == thiz->clazz) {
                    m = rvmGetNextCallStackMethod(env, callStack, &index);
                    if (m) clazz = m->clazz;
                    first = index - 1;
                }
            }
        }
    }

    return rvmCallStackToStackTraceElements(env, callStack, first);
}
开发者ID:AlexeyBychkov,项目名称:robovm,代码行数:41,代码来源:java_lang_Throwable.c

示例14: rvmThrow

void rvmThrow(Env* env, Object* e) {
    // TODO: Check that e != NULL?
    if (env->throwable) {
        rvmAbort("rvmThrow() called with env->throwable already set");
    }
    if (IS_TRACE_ENABLED) {
        jlong stackState = rvmGetLongInstanceFieldValue(env, e, stackStateField);
        CallStack* callStack = (CallStack*) LONG_TO_PTR(stackState);
        if (!callStack || callStack->length == 0) {
            TRACEF("Throwing a %s with empty call stack", e->clazz->name);
        } else {
            TRACEF("Throwing a %s. Call stack:", e->clazz->name);
            Method* m;
            jint index = 0;
            while ((m = rvmGetNextCallStackMethod(env, callStack, &index)) != NULL) {
                TRACEF("    %s.%s%s", m->clazz->name, m->name, m->desc);
            }
        }
    }
    env->throwable = e;
}
开发者ID:John-Chan,项目名称:robovm,代码行数:21,代码来源:exception.c

示例15: Java_java_lang_reflect_Constructor_internalNewInstance

Object* Java_java_lang_reflect_Constructor_internalNewInstance(Env* env, JClass* clazz, jlong methodPtr, ObjectArray* parameterTypes, ObjectArray* args) {
    Method* method = (Method*) LONG_TO_PTR(methodPtr);

    /*
     * The Java code has already checked that the constructor is accessible
     * to the the caller, that the class can be instatiated and that the number 
     * of arguments are correct. The args array is never null.
     */

    jvalue* jvalueArgs = validateAndUnwrapArgs(env, parameterTypes, args);
    if (!jvalueArgs) return NULL;

    Object* o = rvmNewObjectA(env, method->clazz, method, jvalueArgs);
    if (!o) {
        Object* exception = rvmExceptionOccurred(env);
        if (exception->clazz != java_lang_ExceptionInInitializerError) {
            throwInvocationTargetException(env, rvmExceptionOccurred(env));
        }
        return NULL;
    }
    return o;
}
开发者ID:MichaelFreimueller,项目名称:robovm,代码行数:22,代码来源:java_lang_reflect_Constructor.c


注:本文中的LONG_TO_PTR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。