[multiple changes]
[gcc.git] / libjava / gcj / javaprims.h
1 // javaprims.h - Main external header file for libgcj. -*- c++ -*-
2
3 /* Copyright (C) 1998, 1999, 2000 Free Software Foundation
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 // Force C++ compiler to use Java-style exceptions.
15 #pragma GCC java_exceptions
16
17 // FIXME: this is a hack until we get a proper gcjh.
18 // It is needed to work around system header files that define TRUE
19 // and FALSE.
20 #undef TRUE
21 #define TRUE TRUE
22 #undef FALSE
23 #define FALSE FALSE
24
25 // To force selection of correct types that will mangle consistently
26 // across platforms.
27 extern "Java"
28 {
29 typedef __java_byte jbyte;
30 typedef __java_short jshort;
31 typedef __java_int jint;
32 typedef __java_long jlong;
33 typedef __java_float jfloat;
34 typedef __java_double jdouble;
35 typedef __java_char jchar;
36 typedef __java_boolean jboolean;
37 typedef jint jsize;
38
39 // The following class declarations are automatically generated by
40 // the `classes.pl' script.
41 namespace java
42 {
43 namespace io
44 {
45 class BufferedInputStream;
46 class BufferedOutputStream;
47 class BufferedReader;
48 class BufferedWriter;
49 class ByteArrayInputStream;
50 class ByteArrayOutputStream;
51 class CharArrayReader;
52 class CharArrayWriter;
53 class CharConversionException;
54 class DataInput;
55 class DataInputStream;
56 class DataOutput;
57 class DataOutputStream;
58 class EOFException;
59 class Externalizable;
60 class File;
61 class FileDescriptor;
62 class FileFilter;
63 class FileInputStream;
64 class FileNotFoundException;
65 class FileOutputStream;
66 class FilePermission;
67 class FileReader;
68 class FileWriter;
69 class FilenameFilter;
70 class FilterInputStream;
71 class FilterOutputStream;
72 class FilterReader;
73 class FilterWriter;
74 class IOException;
75 class InputStream;
76 class InputStreamReader;
77 class InterfaceComparator;
78 class InterruptedIOException;
79 class InvalidClassException;
80 class InvalidObjectException;
81 class LineNumberInputStream;
82 class LineNumberReader;
83 class MemberComparator;
84 class NotActiveException;
85 class NotSerializableException;
86 class ObjectInput;
87 class ObjectInputStream;
88 class ObjectInputStream$GetField;
89 class ObjectInputValidation;
90 class ObjectOutput;
91 class ObjectOutputStream;
92 class ObjectOutputStream$PutField;
93 class ObjectStreamClass;
94 class ObjectStreamConstants;
95 class ObjectStreamException;
96 class ObjectStreamField;
97 class OptionalDataException;
98 class OutputStream;
99 class OutputStreamWriter;
100 class PipedInputStream;
101 class PipedOutputStream;
102 class PipedReader;
103 class PipedWriter;
104 class PrintStream;
105 class PrintWriter;
106 class PushbackInputStream;
107 class PushbackReader;
108 class RandomAccessFile;
109 class Reader;
110 class SequenceInputStream;
111 class Serializable;
112 class SerializablePermission;
113 class StreamCorruptedException;
114 class StreamTokenizer;
115 class StringBufferInputStream;
116 class StringReader;
117 class StringWriter;
118 class SyncFailedException;
119 class UTFDataFormatException;
120 class UnsupportedEncodingException;
121 class ValidatorAndPriority;
122 class WriteAbortedException;
123 class Writer;
124 };
125
126 namespace lang
127 {
128 class AbstractMethodError;
129 class ArithmeticException;
130 class ArrayIndexOutOfBoundsException;
131 class ArrayStoreException;
132 class Boolean;
133 class Byte;
134 class CPlusPlusDemangler;
135 class Character;
136 class Character$Subset;
137 class Character$UnicodeBlock;
138 class Class;
139 class ClassCastException;
140 class ClassCircularityError;
141 class ClassFormatError;
142 class ClassLoader;
143 class ClassNotFoundException;
144 class CloneNotSupportedException;
145 class Cloneable;
146 class Comparable;
147 class Compiler;
148 class ConcreteProcess;
149 class Double;
150 class Error;
151 class Exception;
152 class ExceptionInInitializerError;
153 class Float;
154 class IllegalAccessError;
155 class IllegalAccessException;
156 class IllegalArgumentException;
157 class IllegalMonitorStateException;
158 class IllegalStateException;
159 class IllegalThreadStateException;
160 class IncompatibleClassChangeError;
161 class IndexOutOfBoundsException;
162 class InstantiationError;
163 class InstantiationException;
164 class Integer;
165 class InternalError;
166 class InterruptedException;
167 class LinkageError;
168 class Long;
169 class Math;
170 class NegativeArraySizeException;
171 class NoClassDefFoundError;
172 class NoSuchFieldError;
173 class NoSuchFieldException;
174 class NoSuchMethodError;
175 class NoSuchMethodException;
176 class NullPointerException;
177 class Number;
178 class NumberFormatException;
179 class Object;
180 class OutOfMemoryError;
181 class Package;
182 class Process;
183 class Runnable;
184 class Runtime;
185 class RuntimeException;
186 class RuntimePermission;
187 class SecurityException;
188 class SecurityManager;
189 class Short;
190 class StackOverflowError;
191 class String;
192 class StringBuffer;
193 class StringIndexOutOfBoundsException;
194 class System;
195 class Thread;
196 class ThreadDeath;
197 class ThreadGroup;
198 class Throwable;
199 class UnknownError;
200 class UnsatisfiedLinkError;
201 class UnsupportedOperationException;
202 class VerifyError;
203 class VirtualMachineError;
204 class Void;
205 namespace ref
206 {
207 class PhantomReference;
208 class Reference;
209 class ReferenceQueue;
210 class SoftReference;
211 class WeakReference;
212 };
213
214 namespace reflect
215 {
216 class AccessibleObject;
217 class Array;
218 class Constructor;
219 class Field;
220 class InvocationTargetException;
221 class Member;
222 class Method;
223 class Modifier;
224 class ReflectPermission;
225 };
226 };
227
228 namespace util
229 {
230 class AbstractCollection;
231 class AbstractList;
232 class AbstractList$AbstractListItr;
233 class AbstractMap;
234 class AbstractSequentialList;
235 class AbstractSet;
236 class ArrayList;
237 class Arrays;
238 class Arrays$ListImpl;
239 class BasicMapEntry;
240 class BitSet;
241 class Calendar;
242 class Collection;
243 class Collections;
244 class Collections$ReverseComparator;
245 class Collections$SynchronizedCollection;
246 class Collections$SynchronizedIterator;
247 class Collections$SynchronizedList;
248 class Collections$SynchronizedListIterator;
249 class Collections$SynchronizedMap;
250 class Collections$SynchronizedSet;
251 class Collections$SynchronizedSortedMap;
252 class Collections$SynchronizedSortedSet;
253 class Collections$UnmodifiableCollection;
254 class Collections$UnmodifiableIterator;
255 class Collections$UnmodifiableList;
256 class Collections$UnmodifiableListIterator;
257 class Collections$UnmodifiableMap;
258 class Collections$UnmodifiableSet;
259 class Collections$UnmodifiableSortedMap;
260 class Collections$UnmodifiableSortedSet;
261 class Comparator;
262 class ConcurrentModificationException;
263 class Date;
264 class Dictionary;
265 class EmptyStackException;
266 class Enumeration;
267 class EventListener;
268 class EventObject;
269 class GregorianCalendar;
270 class HashMap;
271 class HashMap$Entry;
272 class HashMap$HashIterator;
273 class HashSet;
274 class Hashtable;
275 class Hashtable$Entry;
276 class Hashtable$Enumerator;
277 class Hashtable$HashIterator;
278 class Iterator;
279 class LinkedList;
280 class LinkedList$Entry;
281 class LinkedList$LinkedListItr;
282 class List;
283 class ListIterator;
284 class ListResourceBundle;
285 class Locale;
286 class Map;
287 class Map$Entry;
288 class MissingResourceException;
289 class NoSuchElementException;
290 class Observable;
291 class Observer;
292 class Properties;
293 class PropertyPermission;
294 class PropertyResourceBundle;
295 class Random;
296 class ResourceBundle;
297 class Set;
298 class SimpleTimeZone;
299 class SortedMap;
300 class SortedSet;
301 class Stack;
302 class StringTokenizer;
303 class SubList;
304 class TimeZone;
305 class Timer;
306 class Timer$Scheduler;
307 class Timer$TaskQueue;
308 class TimerTask;
309 class TooManyListenersException;
310 class TreeMap;
311 class TreeMap$Node;
312 class TreeMap$SubMap;
313 class TreeMap$TreeIterator;
314 class TreeMap$VerifyResult;
315 class TreeSet;
316 class Vector;
317 class WeakHashMap;
318 class WeakHashMap$Entry;
319 class WeakHashMap$WeakBucket;
320 class WeakHashMap$WeakEntrySet;
321 namespace jar
322 {
323 class Attributes;
324 class Attributes$Name;
325 class JarEntry;
326 class JarException;
327 class JarFile;
328 class JarFile$JarEnumeration;
329 class JarInputStream;
330 class JarOutputStream;
331 class Manifest;
332 };
333
334 namespace zip
335 {
336 class Adler32;
337 class CRC32;
338 class CheckedInputStream;
339 class CheckedOutputStream;
340 class Checksum;
341 class DataFormatException;
342 class Deflater;
343 class DeflaterOutputStream;
344 class GZIPInputStream;
345 class GZIPOutputStream;
346 class Inflater;
347 class InflaterInputStream;
348 class ZipConstants;
349 class ZipEntry;
350 class ZipEnumeration;
351 class ZipException;
352 class ZipFile;
353 class ZipInputStream;
354 class ZipOutputStream;
355 };
356 };
357 };
358 };
359
360 typedef struct java::lang::Object* jobject;
361 typedef class java::lang::Class* jclass;
362 typedef class java::lang::Throwable* jthrowable;
363 typedef class java::lang::String* jstring;
364 struct _Jv_JNIEnv;
365
366 typedef struct _Jv_Field *jfieldID;
367 typedef struct _Jv_Method *jmethodID;
368
369 extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__));
370 extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
371 extern "C" jstring _Jv_AllocString(jsize) __attribute__((__malloc__));
372 extern "C" jstring _Jv_NewString (const jchar*, jsize)
373 __attribute__((__malloc__));
374 extern "C" jchar* _Jv_GetStringChars (jstring str);
375 extern "C" jint _Jv_MonitorEnter (jobject);
376 extern "C" jint _Jv_MonitorExit (jobject);
377 extern "C" jstring _Jv_NewStringLatin1(const char*, jsize)
378 __attribute__((__malloc__));
379 extern "C" jsize _Jv_GetStringUTFLength (jstring);
380 extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
381
382 extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));
383 extern "C" void* _Jv_Malloc (jsize) __attribute__((__malloc__));
384 extern "C" void* _Jv_Realloc (void *, jsize);
385 extern "C" void _Jv_Free (void*);
386
387 typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
388 typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
389
390 struct _Jv_Utf8Const
391 {
392 _Jv_ushort hash;
393 _Jv_ushort length; /* In bytes, of data portion, without final '\0'. */
394 char data[1]; /* In Utf8 format, with final '\0'. */
395 };
396
397 #endif /* __JAVAPRIMS_H__ */