OSDN Git Service

sjlj jumbo patch
[pf3gnuchains/gcc-fork.git] / libjava / gcj / javaprims.h
1 // javaprims.h - Main external header file for libgcj.  -*- c++ -*-
2
3 /* Copyright (C) 1998, 1999  Cygnus Solutions
4
5    This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10
11 #ifndef __JAVAPRIMS_H__
12 #define __JAVAPRIMS_H__
13
14 // FIXME: this is a hack until we get a proper gcjh.
15 // It is needed to work around system header files that define TRUE
16 // and FALSE.
17 #undef TRUE
18 #define TRUE TRUE
19 #undef FALSE
20 #define FALSE FALSE
21
22 // To force selection of correct types that will mangle consistently
23 // across platforms.
24 extern "Java"
25 {
26   typedef __java_byte jbyte;
27   typedef __java_short jshort;
28   typedef __java_int jint;
29   typedef __java_long jlong;
30   typedef __java_float jfloat;
31   typedef __java_double jdouble;
32   typedef __java_char jchar;
33   typedef __java_boolean jboolean;
34   typedef jint jsize;
35
36   // The following class declarations are automatically generated by
37   // the `classes.pl' script.
38   namespace java
39   {
40     namespace io
41     {
42       class BufferedInputStream;
43       class BufferedOutputStream;
44       class BufferedReader;
45       class BufferedWriter;
46       class ByteArrayInputStream;
47       class ByteArrayOutputStream;
48       class CharArrayReader;
49       class CharArrayWriter;
50       class CharConversionException;
51       class DataInput;
52       class DataInputStream;
53       class DataOutput;
54       class DataOutputStream;
55       class EOFException;
56       class File;
57       class FileDescriptor;
58       class FileInputStream;
59       class FileNotFoundException;
60       class FileOutputStream;
61       class FileReader;
62       class FileWriter;
63       class FilenameFilter;
64       class FilterInputStream;
65       class FilterOutputStream;
66       class FilterReader;
67       class FilterWriter;
68       class IOException;
69       class InputStream;
70       class InputStreamReader;
71       class InterruptedIOException;
72       class LineNumberInputStream;
73       class LineNumberReader;
74       class OutputStream;
75       class OutputStreamWriter;
76       class PipedInputStream;
77       class PipedOutputStream;
78       class PipedReader;
79       class PipedWriter;
80       class PrintStream;
81       class PrintWriter;
82       class PushbackInputStream;
83       class PushbackReader;
84       class RandomAccessFile;
85       class Reader;
86       class SequenceInputStream;
87       class Serializable;
88       class StreamTokenizer;
89       class StringBufferInputStream;
90       class StringReader;
91       class StringWriter;
92       class SyncFailedException;
93       class UTFDataFormatException;
94       class UnsupportedEncodingException;
95       class Writer;
96     }
97
98     namespace lang
99     {
100       class AbstractMethodError;
101       class ArithmeticException;
102       class ArrayIndexOutOfBoundsException;
103       class ArrayStoreException;
104       class Boolean;
105       class Byte;
106       class Character;
107       class Class;
108       class ClassCastException;
109       class ClassCircularityError;
110       class ClassFormatError;
111       class ClassLoader;
112       class ClassNotFoundException;
113       class CloneNotSupportedException;
114       class Cloneable;
115       class Comparable;
116       class Compiler;
117       class ConcreteProcess;
118       class Double;
119       class Error;
120       class Exception;
121       class ExceptionInInitializerError;
122       class FirstThread;
123       class Float;
124       class IllegalAccessError;
125       class IllegalAccessException;
126       class IllegalArgumentException;
127       class IllegalMonitorStateException;
128       class IllegalStateException;
129       class IllegalThreadStateException;
130       class IncompatibleClassChangeError;
131       class IndexOutOfBoundsException;
132       class InstantiationError;
133       class InstantiationException;
134       class Integer;
135       class InternalError;
136       class InterruptedException;
137       class LinkageError;
138       class Long;
139       class Math;
140       class NegativeArraySizeException;
141       class NoClassDefFoundError;
142       class NoSuchFieldError;
143       class NoSuchFieldException;
144       class NoSuchMethodError;
145       class NoSuchMethodException;
146       class NullPointerException;
147       class Number;
148       class NumberFormatException;
149       class Object;
150       class OutOfMemoryError;
151       class Process;
152       class Runnable;
153       class Runtime;
154       class RuntimeException;
155       class SecurityException;
156       class SecurityManager;
157       class Short;
158       class StackOverflowError;
159       class String;
160       class StringBuffer;
161       class StringIndexOutOfBoundsException;
162       class System;
163       class Thread;
164       class ThreadDeath;
165       class ThreadGroup;
166       class Throwable;
167       class UnknownError;
168       class UnsatisfiedLinkError;
169       class UnsupportedOperationException;
170       class VerifyError;
171       class VirtualMachineError;
172       class Void;
173       namespace reflect
174       {
175         class AccessibleObject;
176         class Array;
177         class Constructor;
178         class Field;
179         class InvocationTargetException;
180         class Member;
181         class Method;
182         class Modifier;
183       }
184     }
185
186     namespace util
187     {
188       class BitSet;
189       class Calendar;
190       class ConcurrentModificationException;
191       class Date;
192       class Dictionary;
193       class EmptyStackException;
194       class Enumeration;
195       class EventListener;
196       class EventObject;
197       class GregorianCalendar;
198       class Hashtable;
199       class HashtableEntry;
200       class HashtableEnumeration;
201       class ListResourceBundle;
202       class Locale;
203       class MissingResourceException;
204       class NoSuchElementException;
205       class Observable;
206       class Observer;
207       class Properties;
208       class PropertyResourceBundle;
209       class Random;
210       class ResourceBundle;
211       class SimpleTimeZone;
212       class Stack;
213       class StringTokenizer;
214       class TimeZone;
215       class TooManyListenersException;
216       class Vector;
217       class VectorEnumeration;
218       namespace jar
219       {
220         class JarEntry;
221         class JarFile;
222         class JarInputStream;
223       }
224
225       namespace zip
226       {
227         class Adler32;
228         class CRC32;
229         class CheckedInputStream;
230         class CheckedOutputStream;
231         class Checksum;
232         class DataFormatException;
233         class Deflater;
234         class DeflaterOutputStream;
235         class GZIPInputStream;
236         class GZIPOutputStream;
237         class Inflater;
238         class InflaterInputStream;
239         class ZipConstants;
240         class ZipEntry;
241         class ZipEnumeration;
242         class ZipException;
243         class ZipFile;
244         class ZipInputStream;
245         class ZipOutputStream;
246       }
247     }
248   }
249 };
250
251 typedef struct java::lang::Object* jobject;
252 typedef class java::lang::Class* jclass;
253 typedef class java::lang::Throwable* jthrowable;
254 typedef class java::lang::String* jstring;
255 struct _Jv_JNIEnv;
256
257 typedef struct _Jv_Field *jfieldID;
258 typedef struct _Jv_Method *jmethodID;
259
260 extern "C" jobject _Jv_AllocObject (jclass, jint);
261 extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
262 extern "C" jstring _Jv_AllocString(jsize);
263 extern "C" jstring _Jv_NewString (const jchar*, jsize);
264 extern "C" jchar* _Jv_GetStringChars (jstring str);
265 extern "C" jint _Jv_MonitorEnter (jobject);
266 extern "C" jint _Jv_MonitorExit (jobject);
267 extern "C" jstring _Jv_NewStringLatin1(const char*, jsize);
268 extern "C" jsize _Jv_GetStringUTFLength (jstring);
269 extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
270
271 extern "C" void _Jv_Throw (void *) __attribute__ ((__noreturn__));
272 extern "C" void _Jv_Sjlj_Throw (void *) __attribute__ ((__noreturn__));
273 extern "C" void* _Jv_Malloc (jsize);
274 extern "C" void _Jv_Free (void*);
275
276 typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
277 typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
278
279 typedef union {
280   jobject o;
281   jint i;                       // Also stores smaller integral types.
282   jfloat f;
283   jint ia[1];                   // Half of _Jv_word2.
284   void* p;
285
286   // these are things we will store in the constant 
287   jclass                     clazz;
288   jstring                    string;
289   struct _Jv_Field          *field;
290   struct _Jv_Utf8Const      *utf8;
291   struct _Jv_ResolvedMethod *rmethod;
292 } _Jv_word;
293
294 typedef union {
295   jint ia[2];
296   jlong l;
297   jdouble d;
298 } _Jv_word2;                              
299
300 struct _Jv_Utf8Const
301 {
302   _Jv_ushort hash;
303   _Jv_ushort length;    /* In bytes, of data portion, without final '\0'. */
304   char data[1];         /* In Utf8 format, with final '\0'. */
305 };
306
307 #endif /* __JAVAPRIMS_H__ */