• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LONG_TO_PTR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Java_java_lang_reflect_Method_getParameterTypes

ObjectArray* Java_java_lang_reflect_Method_getParameterTypes(Env* env, Class* clazz, jlong methodPtr) {
    Method* method = (Method*) LONG_TO_PTR(methodPtr);

    jint argsCount = rvmGetParameterCount(method);

    Class* array_java_lang_Class = rvmFindClassUsingLoader(env, "[Ljava/lang/Class;", NULL);
    if (!array_java_lang_Class) return NULL;
    ObjectArray* paramTypes = rvmNewObjectArray(env, argsCount, NULL, array_java_lang_Class, NULL);
    if (!paramTypes) return NULL;

    const char* desc = method->desc;
    const char* s;
    jint i = 0;
    while ((s = rvmGetNextParameterType(&desc))) {
        char* paramTypeName = rvmAllocateMemoryAtomic(env, desc - s + 1);
        if (!paramTypeName) return NULL;
        strncpy(paramTypeName, s, desc - s);
        Class* paramType = rvmFindClassByDescriptor(env, paramTypeName, method->clazz->classLoader);
        if (!paramType) return NULL;
        paramTypes->values[i++] = (Object*) paramType;
    }

    return paramTypes;
}
开发者ID:bugvm,项目名称:bugvm,代码行数:24,代码来源:java_lang_reflect_Method.c


示例17: Java_aura_rt_VM_getBoolean

jboolean Java_aura_rt_VM_getBoolean(Env* env, Class* c, jlong address) {
    return *((jboolean*) LONG_TO_PTR(address));
}
开发者ID:Zubnix,项目名称:aura,代码行数:3,代码来源:aura_rt_VM.c


示例18: Java_aura_rt_VM_setPointer

void Java_aura_rt_VM_setPointer(Env* env, Class* c, jlong address, jlong value) {
    *((void**) LONG_TO_PTR(address)) = LONG_TO_PTR(value);
}
开发者ID:Zubnix,项目名称:aura,代码行数:3,代码来源:aura_rt_VM.c


示例19: Java_aura_rt_VM_newStringUTF

Object* Java_aura_rt_VM_newStringUTF(Env* env, Class* c, jlong address) {
    return rvmNewStringUTF(env, (char*) LONG_TO_PTR(address), -1);
}
开发者ID:Zubnix,项目名称:aura,代码行数:3,代码来源:aura_rt_VM.c


示例20: Java_aura_rt_VM_setBoolean

void Java_aura_rt_VM_setBoolean(Env* env, Class* c, jlong address, jboolean value) {
    *((jboolean*) LONG_TO_PTR(address)) = value;
}
开发者ID:Zubnix,项目名称:aura,代码行数:3,代码来源:aura_rt_VM.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOOKUP函数代码示例发布时间:2022-05-30
下一篇:
C++ LONGS_EQUAL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap