Imported GNU Classpath 0.92
[gcc.git] / libjava / gcj / cni.h
index 4e96f9fe7e1a756ed1be62652e7423b03ba69ae1..b94260b8465bd53ccaec7680f823dc7a6ec2daad 100644 (file)
@@ -1,8 +1,8 @@
 // gcj/cni.h -*- c++ -*-
-// This file describes the Cygnus Native Interface, CNI.
+// This file describes the Compiled Native Interface, CNI.
 // It provides a nicer interface to many of the things in gcj/javaprims.h.
 
-/* Copyright (C) 1998, 1999  Cygnus Solutions
+/* Copyright (C) 1998, 1999, 2002  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -17,21 +17,12 @@ details.  */
 #include <java/lang/Class.h>
 
 #include <gcj/array.h>
+#include <gcj/javaprims.h>
 
-extern inline jobject
-JvAllocObject (jclass cls)
-{
-  return _Jv_AllocObject (cls, cls->size());
-}
-
-extern inline jobject
-JvAllocObject (jclass cls, jsize sz)
-{
-  return _Jv_AllocObject (cls, sz);
-}
+#include <string.h>
 
-extern "C" jstring _Jv_NewStringUTF (const char *bytes);
 extern "C" void _Jv_InitClass (jclass);
+extern "C" void *_Jv_AllocBytes (jsize size) __attribute__((__malloc__));
 
 extern inline void
 JvInitClass (jclass cls)
@@ -39,6 +30,12 @@ JvInitClass (jclass cls)
   return _Jv_InitClass (cls);
 }
 
+extern inline void *
+JvAllocBytes (jsize sz)
+{
+  return _Jv_AllocBytes (sz);
+}
+
 extern inline jstring
 JvAllocString (jsize sz)
 {
@@ -93,11 +90,6 @@ JvNewStringUTF (const char *bytes)
   return _Jv_NewStringUTF (bytes);
 }
 
-extern class _Jv_PrimClass _Jv_byteClass, _Jv_shortClass, _Jv_intClass,
-  _Jv_longClass, _Jv_booleanClass, _Jv_charClass, _Jv_floatClass,
-  _Jv_doubleClass, _Jv_voidClass;
-#define JvPrimClass(TYPE) ((jclass) & _Jv_##TYPE##Class)
-
 class JvSynchronize
 {
 private:
@@ -109,18 +101,6 @@ public:
     { _Jv_MonitorExit (obj); }
 };
 
-#ifdef SJLJ_EXCEPTIONS
-#define _Jv_Throw _Jv_Sjlj_Throw
-#endif
-
-// Throw some exception.
-extern void JvThrow (jobject obj) __attribute__ ((__noreturn__));
-extern inline void
-JvThrow (jobject obj)
-{
-  _Jv_Throw ((void *) obj);
-}
-
 /* Call malloc, but throw exception if insufficient memory. */
 extern inline void *
 JvMalloc (jsize size)
@@ -128,9 +108,42 @@ JvMalloc (jsize size)
   return _Jv_Malloc (size);
 }
 
+extern inline void *
+JvRealloc (void *ptr, jsize size)
+{
+  return _Jv_Realloc (ptr, size);
+}
+
 extern inline void
 JvFree (void *ptr)
 {
   return _Jv_Free (ptr);
 }
+
+typedef struct _Jv_VMOption JvVMOption;
+typedef struct _Jv_VMInitArgs JvVMInitArgs;
+
+extern inline jint
+JvCreateJavaVM (JvVMInitArgs* vm_args)
+{
+  return _Jv_CreateJavaVM (vm_args);
+}
+
+extern inline java::lang::Thread*
+JvAttachCurrentThread (jstring name, java::lang::ThreadGroup* group)
+{
+  return _Jv_AttachCurrentThread (name, group);
+}
+
+extern inline java::lang::Thread*
+JvAttachCurrentThreadAsDaemon (jstring name, java::lang::ThreadGroup* group)
+{
+  return _Jv_AttachCurrentThreadAsDaemon (name, group);
+}
+
+extern inline jint
+JvDetachCurrentThread (void)
+{
+  return _Jv_DetachCurrentThread ();
+}
 #endif /* __GCJ_CNI_H__ */