OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 package org.dartlang; |
| 6 |
| 7 /** |
| 8 * A static class that wraps access to the Dart VM shared library. |
| 9 * For expedience we pass the following types as Java primitives |
| 10 * |
| 11 * Dart_Handle <-> int. (It's a pointer.) |
| 12 * Dart_Isolate <-> int. (It's a pointer.) |
| 13 * |
| 14 */ |
| 15 public class Dart { |
| 16 static { |
| 17 System.loadLibrary("dart_so"); |
| 18 } |
| 19 /** Start Dart runtime. |
| 20 * @return main isolate, or 0 if there was an error. |
| 21 */ |
| 22 public static native int dartStart(String[] args); |
| 23 public static native int dartFinish(int main_isolate); |
| 24 |
| 25 public static native boolean IsError(int handle); |
| 26 public static native boolean IsApiError(int handle); |
| 27 public static native boolean IsUnhandledExceptionError(int handle); |
| 28 public static native boolean IsCompilationError(int handle); |
| 29 public static native boolean IsFatalError(int handle); |
| 30 public static native String GetError(int handle); |
| 31 public static native boolean ErrorHasException(int handle); |
| 32 public static native int ErrorGetException(int handle); |
| 33 public static native int ErrorGetStacktrace(int handle); |
| 34 public static native int NewApiError(String message); |
| 35 |
| 36 public static native void EnterScope(); |
| 37 public static native void ExitScope(); |
| 38 public static native void ShutdownIsolate(); |
| 39 |
| 40 public static native int CurrentIsolate(); |
| 41 public static native void EnterIsolate(int isolate); |
| 42 public static native void ExitIsolate(); |
| 43 |
| 44 public static native int RootLibrary(); |
| 45 public static native int LoadLibrary(int url, int source); |
| 46 public static native int LoadSource(int library, int url, int source); |
| 47 |
| 48 public static native int New(int clazz, int constructor_name, int[] arguments)
; |
| 49 public static native int Invoke(int target, int name, int[] arguments); |
| 50 public static native int GetField(int container, int name); |
| 51 public static native int SetField(int container, int name, int value); |
| 52 |
| 53 public static native int ToString(int object); |
| 54 public static native String StringToJavaString(int str); |
| 55 |
| 56 public static native boolean IdentityEquals(int obj1, int obj2); |
| 57 |
| 58 public static native int RunLoop(); |
| 59 |
| 60 public static native int Null(); |
| 61 public static native boolean IsNull(int handle); |
| 62 |
| 63 public static native int NewString(String string); |
| 64 public static native int NewInteger(long value); |
| 65 public static native int NewBoolean(boolean value); |
| 66 public static native int NewDouble(double value); |
| 67 public static native int NewList(int length); |
| 68 public static native int ListLength(int list); |
| 69 public static native int ListGetAt(int list, int index); |
| 70 public static native int ListSetAt(int list, int index, int value); |
| 71 } |
OLD | NEW |