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