mips-protos.h (mips_output_external): Make it return void.
[official-gcc.git] / libjava / gcj / cni.h
blobb94260b8465bd53ccaec7680f823dc7a6ec2daad
1 // gcj/cni.h -*- c++ -*-
2 // This file describes the Compiled Native Interface, CNI.
3 // It provides a nicer interface to many of the things in gcj/javaprims.h.
5 /* Copyright (C) 1998, 1999, 2002 Free Software Foundation
7 This file is part of libgcj.
9 This software is copyrighted work licensed under the terms of the
10 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 details. */
13 #ifndef __GCJ_CNI_H__
14 #define __GCJ_CNI_H__
16 #include <java/lang/Object.h>
17 #include <java/lang/Class.h>
19 #include <gcj/array.h>
20 #include <gcj/javaprims.h>
22 #include <string.h>
24 extern "C" void _Jv_InitClass (jclass);
25 extern "C" void *_Jv_AllocBytes (jsize size) __attribute__((__malloc__));
27 extern inline void
28 JvInitClass (jclass cls)
30 return _Jv_InitClass (cls);
33 extern inline void *
34 JvAllocBytes (jsize sz)
36 return _Jv_AllocBytes (sz);
39 extern inline jstring
40 JvAllocString (jsize sz)
42 return _Jv_AllocString (sz);
45 extern inline jstring
46 JvNewString (const jchar *chars, jsize len)
48 return _Jv_NewString (chars, len);
51 extern inline jstring
52 JvNewStringLatin1 (const char *bytes, jsize len)
54 return _Jv_NewStringLatin1 (bytes, len);
57 extern inline jstring
58 JvNewStringLatin1 (const char *bytes)
60 return _Jv_NewStringLatin1 (bytes, strlen (bytes));
63 extern inline jchar *
64 _Jv_GetStringChars (jstring str)
66 return (jchar*)((char*) str->data + str->boffset);
69 extern inline jchar*
70 JvGetStringChars (jstring str)
72 return _Jv_GetStringChars (str);
75 extern inline jsize
76 JvGetStringUTFLength (jstring string)
78 return _Jv_GetStringUTFLength (string);
81 extern inline jsize
82 JvGetStringUTFRegion (jstring str, jsize start, jsize len, char *buf)
84 return _Jv_GetStringUTFRegion (str, start, len, buf);
87 extern inline jstring
88 JvNewStringUTF (const char *bytes)
90 return _Jv_NewStringUTF (bytes);
93 class JvSynchronize
95 private:
96 jobject obj;
97 public:
98 JvSynchronize (const jobject &o) : obj (o)
99 { _Jv_MonitorEnter (obj); }
100 ~JvSynchronize ()
101 { _Jv_MonitorExit (obj); }
104 /* Call malloc, but throw exception if insufficient memory. */
105 extern inline void *
106 JvMalloc (jsize size)
108 return _Jv_Malloc (size);
111 extern inline void *
112 JvRealloc (void *ptr, jsize size)
114 return _Jv_Realloc (ptr, size);
117 extern inline void
118 JvFree (void *ptr)
120 return _Jv_Free (ptr);
123 typedef struct _Jv_VMOption JvVMOption;
124 typedef struct _Jv_VMInitArgs JvVMInitArgs;
126 extern inline jint
127 JvCreateJavaVM (JvVMInitArgs* vm_args)
129 return _Jv_CreateJavaVM (vm_args);
132 extern inline java::lang::Thread*
133 JvAttachCurrentThread (jstring name, java::lang::ThreadGroup* group)
135 return _Jv_AttachCurrentThread (name, group);
138 extern inline java::lang::Thread*
139 JvAttachCurrentThreadAsDaemon (jstring name, java::lang::ThreadGroup* group)
141 return _Jv_AttachCurrentThreadAsDaemon (name, group);
144 extern inline jint
145 JvDetachCurrentThread (void)
147 return _Jv_DetachCurrentThread ();
149 #endif /* __GCJ_CNI_H__ */