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
16 #include <java/lang/Object.h>
17 #include <java/lang/Class.h>
19 #include <gcj/array.h>
23 extern "C" jstring
_Jv_NewStringUTF (const char *bytes
);
24 extern "C" void _Jv_InitClass (jclass
);
27 JvInitClass (jclass cls
)
29 return _Jv_InitClass (cls
);
33 JvAllocString (jsize sz
)
35 return _Jv_AllocString (sz
);
39 JvNewString (const jchar
*chars
, jsize len
)
41 return _Jv_NewString (chars
, len
);
45 JvNewStringLatin1 (const char *bytes
, jsize len
)
47 return _Jv_NewStringLatin1 (bytes
, len
);
51 JvNewStringLatin1 (const char *bytes
)
53 return _Jv_NewStringLatin1 (bytes
, strlen (bytes
));
57 _Jv_GetStringChars (jstring str
)
59 return (jchar
*)((char*) str
->data
+ str
->boffset
);
63 JvGetStringChars (jstring str
)
65 return _Jv_GetStringChars (str
);
69 JvGetStringUTFLength (jstring string
)
71 return _Jv_GetStringUTFLength (string
);
75 JvGetStringUTFRegion (jstring str
, jsize start
, jsize len
, char *buf
)
77 return _Jv_GetStringUTFRegion (str
, start
, len
, buf
);
81 JvNewStringUTF (const char *bytes
)
83 return _Jv_NewStringUTF (bytes
);
91 JvSynchronize (const jobject
&o
) : obj (o
)
92 { _Jv_MonitorEnter (obj
); }
94 { _Jv_MonitorExit (obj
); }
97 /* Call malloc, but throw exception if insufficient memory. */
101 return _Jv_Malloc (size
);
107 return _Jv_Free (ptr
);
111 JvCreateJavaVM (void* vm_args
)
113 return _Jv_CreateJavaVM (vm_args
);
116 extern inline java::lang::Thread
*
117 JvAttachCurrentThread (jstring name
, java::lang::ThreadGroup
* group
)
119 return _Jv_AttachCurrentThread (name
, group
);
122 extern inline java::lang::Thread
*
123 JvAttachCurrentThreadAsDaemon (jstring name
, java::lang::ThreadGroup
* group
)
125 return _Jv_AttachCurrentThreadAsDaemon (name
, group
);
129 JvDetachCurrentThread (void)
131 return _Jv_DetachCurrentThread ();
133 #endif /* __GCJ_CNI_H__ */