Java Code Examples for com.apple.jobjc.Invoke.FunCall#init()
The following examples show how to use
com.apple.jobjc.Invoke.FunCall#init() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IntroTest.java From hottub with GNU General Public License v2.0 | 6 votes |
public void testCore(){ // pass security check and get ahold of a runtime (should cache this) final JObjCRuntime RUNTIME = JObjCRuntime.getInstance(); final NativeArgumentBuffer ARGS = JObjCRuntime.getInstance().getThreadLocalState(); // create a funcall (should cache this) final FunCall fc = new FunCall(RUNTIME, "sin", DoubleCoder.INST, DoubleCoder.INST); // start function call fc.init(ARGS); // push an arg DoubleCoder.INST.push(ARGS, 3.14159265 / 2.0); // make the call fc.invoke(ARGS); // read the return value double ret = DoubleCoder.INST.pop(ARGS); assertEquals(1.0, ret); }
Example 2
Source File: IntroTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void testCore(){ // pass security check and get ahold of a runtime (should cache this) final JObjCRuntime RUNTIME = JObjCRuntime.getInstance(); final NativeArgumentBuffer ARGS = JObjCRuntime.getInstance().getThreadLocalState(); // create a funcall (should cache this) final FunCall fc = new FunCall(RUNTIME, "sin", DoubleCoder.INST, DoubleCoder.INST); // start function call fc.init(ARGS); // push an arg DoubleCoder.INST.push(ARGS, 3.14159265 / 2.0); // make the call fc.invoke(ARGS); // read the return value double ret = DoubleCoder.INST.pop(ARGS); assertEquals(1.0, ret); }
Example 3
Source File: FunctionTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void testInvokeOneParam() throws Throwable { final FunCall getHomeDirFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSHomeDirectory", PointerCoder.INST); getHomeDirFxn.init(nativeBuffer); getHomeDirFxn.invoke(nativeBuffer); final long homeDirPtr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(homeDirPtr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(homeDirPtr)); final FunCall getTypeOfFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSLog", PointerCoder.INST, PointerCoder.INST); getTypeOfFxn.init(nativeBuffer); PrimitivePointerCoder.INST.push(runtime, nativeBuffer, homeDirPtr); getTypeOfFxn.invoke(nativeBuffer); // long typePtr = PointerCoder.pointer_coder.popPtr(nativeBuffer); // System.out.println("0x" + Long.toHexString(typePtr) + ": " + TestUtils.getDescriptionForPtr(typePtr)); }
Example 4
Source File: IntroTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void testCore(){ // pass security check and get ahold of a runtime (should cache this) final JObjCRuntime RUNTIME = JObjCRuntime.getInstance(); final NativeArgumentBuffer ARGS = JObjCRuntime.getInstance().getThreadLocalState(); // create a funcall (should cache this) final FunCall fc = new FunCall(RUNTIME, "sin", DoubleCoder.INST, DoubleCoder.INST); // start function call fc.init(ARGS); // push an arg DoubleCoder.INST.push(ARGS, 3.14159265 / 2.0); // make the call fc.invoke(ARGS); // read the return value double ret = DoubleCoder.INST.pop(ARGS); assertEquals(1.0, ret); }
Example 5
Source File: IntroTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void testCore(){ // pass security check and get ahold of a runtime (should cache this) final JObjCRuntime RUNTIME = JObjCRuntime.getInstance(); final NativeArgumentBuffer ARGS = JObjCRuntime.getInstance().getThreadLocalState(); // create a funcall (should cache this) final FunCall fc = new FunCall(RUNTIME, "sin", DoubleCoder.INST, DoubleCoder.INST); // start function call fc.init(ARGS); // push an arg DoubleCoder.INST.push(ARGS, 3.14159265 / 2.0); // make the call fc.invoke(ARGS); // read the return value double ret = DoubleCoder.INST.pop(ARGS); assertEquals(1.0, ret); }
Example 6
Source File: FunctionTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public void testInvokeOneParam() throws Throwable { final FunCall getHomeDirFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSHomeDirectory", PointerCoder.INST); getHomeDirFxn.init(nativeBuffer); getHomeDirFxn.invoke(nativeBuffer); final long homeDirPtr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(homeDirPtr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(homeDirPtr)); final FunCall getTypeOfFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSLog", PointerCoder.INST, PointerCoder.INST); getTypeOfFxn.init(nativeBuffer); PrimitivePointerCoder.INST.push(runtime, nativeBuffer, homeDirPtr); getTypeOfFxn.invoke(nativeBuffer); // long typePtr = PointerCoder.pointer_coder.popPtr(nativeBuffer); // System.out.println("0x" + Long.toHexString(typePtr) + ": " + TestUtils.getDescriptionForPtr(typePtr)); }
Example 7
Source File: IntroTest.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void testCore(){ // pass security check and get ahold of a runtime (should cache this) final JObjCRuntime RUNTIME = JObjCRuntime.getInstance(); final NativeArgumentBuffer ARGS = JObjCRuntime.getInstance().getThreadLocalState(); // create a funcall (should cache this) final FunCall fc = new FunCall(RUNTIME, "sin", DoubleCoder.INST, DoubleCoder.INST); // start function call fc.init(ARGS); // push an arg DoubleCoder.INST.push(ARGS, 3.14159265 / 2.0); // make the call fc.invoke(ARGS); // read the return value double ret = DoubleCoder.INST.pop(ARGS); assertEquals(1.0, ret); }
Example 8
Source File: FunctionTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void testInvokeOneParam() throws Throwable { final FunCall getHomeDirFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSHomeDirectory", PointerCoder.INST); getHomeDirFxn.init(nativeBuffer); getHomeDirFxn.invoke(nativeBuffer); final long homeDirPtr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(homeDirPtr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(homeDirPtr)); final FunCall getTypeOfFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSLog", PointerCoder.INST, PointerCoder.INST); getTypeOfFxn.init(nativeBuffer); PrimitivePointerCoder.INST.push(runtime, nativeBuffer, homeDirPtr); getTypeOfFxn.invoke(nativeBuffer); // long typePtr = PointerCoder.pointer_coder.popPtr(nativeBuffer); // System.out.println("0x" + Long.toHexString(typePtr) + ": " + TestUtils.getDescriptionForPtr(typePtr)); }
Example 9
Source File: FunctionTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void testInvokeOneParam() throws Throwable { final FunCall getHomeDirFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSHomeDirectory", PointerCoder.INST); getHomeDirFxn.init(nativeBuffer); getHomeDirFxn.invoke(nativeBuffer); final long homeDirPtr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(homeDirPtr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(homeDirPtr)); final FunCall getTypeOfFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSLog", PointerCoder.INST, PointerCoder.INST); getTypeOfFxn.init(nativeBuffer); PrimitivePointerCoder.INST.push(runtime, nativeBuffer, homeDirPtr); getTypeOfFxn.invoke(nativeBuffer); // long typePtr = PointerCoder.pointer_coder.popPtr(nativeBuffer); // System.out.println("0x" + Long.toHexString(typePtr) + ": " + TestUtils.getDescriptionForPtr(typePtr)); }
Example 10
Source File: FunctionTest.java From hottub with GNU General Public License v2.0 | 6 votes |
public void testInvokeOneParam() throws Throwable { final FunCall getHomeDirFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSHomeDirectory", PointerCoder.INST); getHomeDirFxn.init(nativeBuffer); getHomeDirFxn.invoke(nativeBuffer); final long homeDirPtr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(homeDirPtr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(homeDirPtr)); final FunCall getTypeOfFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSLog", PointerCoder.INST, PointerCoder.INST); getTypeOfFxn.init(nativeBuffer); PrimitivePointerCoder.INST.push(runtime, nativeBuffer, homeDirPtr); getTypeOfFxn.invoke(nativeBuffer); // long typePtr = PointerCoder.pointer_coder.popPtr(nativeBuffer); // System.out.println("0x" + Long.toHexString(typePtr) + ": " + TestUtils.getDescriptionForPtr(typePtr)); }
Example 11
Source File: FunctionTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public void testInvokeOneParam() throws Throwable { final FunCall getHomeDirFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSHomeDirectory", PointerCoder.INST); getHomeDirFxn.init(nativeBuffer); getHomeDirFxn.invoke(nativeBuffer); final long homeDirPtr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(homeDirPtr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(homeDirPtr)); final FunCall getTypeOfFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSLog", PointerCoder.INST, PointerCoder.INST); getTypeOfFxn.init(nativeBuffer); PrimitivePointerCoder.INST.push(runtime, nativeBuffer, homeDirPtr); getTypeOfFxn.invoke(nativeBuffer); // long typePtr = PointerCoder.pointer_coder.popPtr(nativeBuffer); // System.out.println("0x" + Long.toHexString(typePtr) + ": " + TestUtils.getDescriptionForPtr(typePtr)); }
Example 12
Source File: FunctionTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public void testInvokeOneParam() throws Throwable { final FunCall getHomeDirFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSHomeDirectory", PointerCoder.INST); getHomeDirFxn.init(nativeBuffer); getHomeDirFxn.invoke(nativeBuffer); final long homeDirPtr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(homeDirPtr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(homeDirPtr)); final FunCall getTypeOfFxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSLog", PointerCoder.INST, PointerCoder.INST); getTypeOfFxn.init(nativeBuffer); PrimitivePointerCoder.INST.push(runtime, nativeBuffer, homeDirPtr); getTypeOfFxn.invoke(nativeBuffer); // long typePtr = PointerCoder.pointer_coder.popPtr(nativeBuffer); // System.out.println("0x" + Long.toHexString(typePtr) + ": " + TestUtils.getDescriptionForPtr(typePtr)); }
Example 13
Source File: FunctionTest.java From hottub with GNU General Public License v2.0 | 5 votes |
public void testInvokeNoParams() throws Throwable { final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSFullUserName", PointerCoder.INST); fxn.init(nativeBuffer); fxn.invoke(nativeBuffer); final long ptr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(ptr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(ptr)); }
Example 14
Source File: FunctionTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void testInvokeNoParams() throws Throwable { final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSFullUserName", PointerCoder.INST); fxn.init(nativeBuffer); fxn.invoke(nativeBuffer); final long ptr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(ptr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(ptr)); }
Example 15
Source File: FunctionTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public void testInvokeNoParams() throws Throwable { final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSFullUserName", PointerCoder.INST); fxn.init(nativeBuffer); fxn.invoke(nativeBuffer); final long ptr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(ptr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(ptr)); }
Example 16
Source File: FunctionTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void testInvokeNoParams() throws Throwable { final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSFullUserName", PointerCoder.INST); fxn.init(nativeBuffer); fxn.invoke(nativeBuffer); final long ptr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(ptr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(ptr)); }
Example 17
Source File: FunctionTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void testInvokeNoParams() throws Throwable { final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getFoundation(), "NSFullUserName", PointerCoder.INST); fxn.init(nativeBuffer); fxn.invoke(nativeBuffer); final long ptr = PrimitivePointerCoder.INST.pop(nativeBuffer); System.out.println("0x" + Long.toHexString(ptr) + ": " + UnsafeRuntimeAccess.getDescriptionForPtr(ptr)); }
Example 18
Source File: FunctionTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void testInvokeNoParamNoReturn() throws Throwable { final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSBeep", VoidCoder.INST); fxn.init(nativeBuffer); fxn.invoke(nativeBuffer); }
Example 19
Source File: FunctionTest.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void testInvokeNoParamNoReturn() throws Throwable { final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSBeep", VoidCoder.INST); fxn.init(nativeBuffer); fxn.invoke(nativeBuffer); }
Example 20
Source File: FunctionTest.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void testInvokeNoParamNoReturn() throws Throwable { final FunCall fxn = UnsafeRuntimeAccess.createFunCall(TestUtils.getAppKit(), "NSBeep", VoidCoder.INST); fxn.init(nativeBuffer); fxn.invoke(nativeBuffer); }