1 // gcj/cni.h -*- c++ -*-
2 // This file describes the Cygnus Native Interface, CNI.
3 // It provides a nicer interface to many of the things in gcj/javaprims.h.
5 /* Copyright (C) 1998, 1999 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>
24 JvAllocObject (jclass cls
)
26 return _Jv_AllocObject (cls
, cls
->size());
30 JvAllocObject (jclass cls
, jsize sz
)
32 return _Jv_AllocObject (cls
, sz
);
35 extern "C" jstring
_Jv_NewStringUTF (const char *bytes
);
36 extern "C" void _Jv_InitClass (jclass
);
39 JvInitClass (jclass cls
)
41 return _Jv_InitClass (cls
);
45 JvAllocString (jsize sz
)
47 return _Jv_AllocString (sz
);
51 JvNewString (const jchar
*chars
, jsize len
)
53 return _Jv_NewString (chars
, len
);
57 JvNewStringLatin1 (const char *bytes
, jsize len
)
59 return _Jv_NewStringLatin1 (bytes
, len
);
63 JvNewStringLatin1 (const char *bytes
)
65 return _Jv_NewStringLatin1 (bytes
, strlen (bytes
));
69 _Jv_GetStringChars (jstring str
)
71 return (jchar
*)((char*) str
->data
+ str
->boffset
);
75 JvGetStringChars (jstring str
)
77 return _Jv_GetStringChars (str
);
81 JvGetStringUTFLength (jstring string
)
83 return _Jv_GetStringUTFLength (string
);
87 JvGetStringUTFRegion (jstring str
, jsize start
, jsize len
, char *buf
)
89 return _Jv_GetStringUTFRegion (str
, start
, len
, buf
);
93 JvNewStringUTF (const char *bytes
)
95 return _Jv_NewStringUTF (bytes
);
103 JvSynchronize (const jobject
&o
) : obj (o
)
104 { _Jv_MonitorEnter (obj
); }
106 { _Jv_MonitorExit (obj
); }
109 /* Call malloc, but throw exception if insufficient memory. */
111 JvMalloc (jsize size
)
113 return _Jv_Malloc (size
);
119 return _Jv_Free (ptr
);
121 #endif /* __GCJ_CNI_H__ */