Makefile.am: Add new classes
[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 CharSequence;
138 class Character;
139 class Character$Subset;
140 class Character$UnicodeBlock;
141 class Class;
142 class ClassCastException;
143 class ClassCircularityError;
144 class ClassFormatError;
145 class ClassLoader;
146 class ClassNotFoundException;
147 class CloneNotSupportedException;
148 class Cloneable;
149 class Comparable;
150 class Compiler;
151 class ConcreteProcess;
152 class Double;
153 class Error;
154 class Exception;
155 class ExceptionInInitializerError;
156 class Float;
157 class IllegalAccessError;
158 class IllegalAccessException;
159 class IllegalArgumentException;
160 class IllegalMonitorStateException;
161 class IllegalStateException;
162 class IllegalThreadStateException;
163 class IncompatibleClassChangeError;
164 class IndexOutOfBoundsException;
165 class InstantiationError;
166 class InstantiationException;
167 class Integer;
168 class InternalError;
169 class InterruptedException;
170 class LinkageError;
171 class Long;
172 class Math;
173 class NegativeArraySizeException;
174 class NoClassDefFoundError;
175 class NoSuchFieldError;
176 class NoSuchFieldException;
177 class NoSuchMethodError;
178 class NoSuchMethodException;
179 class NullPointerException;
180 class Number;
181 class NumberFormatException;
182 class Object;
183 class OutOfMemoryError;
184 class Package;
185 class Process;
186 class Runnable;
187 class Runtime;
188 class RuntimeException;
189 class RuntimePermission;
190 class SecurityContext;
191 class SecurityException;
192 class SecurityManager;
193 class Short;
194 class StackOverflowError;
195 class String;
196 class String$CaseInsensitiveComparator;
197 class StringBuffer;
198 class StringIndexOutOfBoundsException;
199 class System;
200 class Thread;
201 class ThreadDeath;
202 class ThreadGroup;
203 class ThreadLocal;
204 class ThreadLocal$Value;
205 class Throwable;
206 class UnknownError;
207 class UnsatisfiedLinkError;
208 class UnsupportedClassVersionError;
209 class UnsupportedOperationException;
210 class VMClassLoader;
211 class VMSecurityManager;
212 class VerifyError;
213 class VirtualMachineError;
214 class Void;
215 namespace ref
216 {
217 class PhantomReference;
218 class Reference;
219 class ReferenceQueue;
220 class SoftReference;
221 class WeakReference;
222 };
223
224 namespace reflect
225 {
226 class AccessibleObject;
227 class Array;
228 class Constructor;
229 class Field;
230 class InvocationTargetException;
231 class Member;
232 class Method;
233 class Modifier;
234 class ReflectPermission;
235 };
236 };
237
238 namespace util
239 {
240 class AbstractCollection;
241 class AbstractList;
242 class AbstractList$AbstractListItr;
243 class AbstractMap;
244 class AbstractSequentialList;
245 class AbstractSet;
246 class ArrayList;
247 class Arrays;
248 class Arrays$ListImpl;
249 class BasicMapEntry;
250 class BitSet;
251 class Calendar;
252 class Collection;
253 class Collections;
254 class Collections$ReverseComparator;
255 class Collections$SynchronizedCollection;
256 class Collections$SynchronizedIterator;
257 class Collections$SynchronizedList;
258 class Collections$SynchronizedListIterator;
259 class Collections$SynchronizedMap;
260 class Collections$SynchronizedSet;
261 class Collections$SynchronizedSortedMap;
262 class Collections$SynchronizedSortedSet;
263 class Collections$UnmodifiableCollection;
264 class Collections$UnmodifiableIterator;
265 class Collections$UnmodifiableList;
266 class Collections$UnmodifiableListIterator;
267 class Collections$UnmodifiableMap;
268 class Collections$UnmodifiableSet;
269 class Collections$UnmodifiableSortedMap;
270 class Collections$UnmodifiableSortedSet;
271 class Comparator;
272 class ConcurrentModificationException;
273 class Date;
274 class Dictionary;
275 class EmptyStackException;
276 class Enumeration;
277 class EventListener;
278 class EventObject;
279 class GregorianCalendar;
280 class HashMap;
281 class HashMap$Entry;
282 class HashMap$HashIterator;
283 class HashSet;
284 class Hashtable;
285 class Hashtable$Entry;
286 class Hashtable$Enumerator;
287 class Hashtable$HashIterator;
288 class IdentityHashMap;
289 class IdentityHashMap$IdentityIterator;
290 class Iterator;
291 class LinkedList;
292 class LinkedList$Entry;
293 class LinkedList$LinkedListItr;
294 class List;
295 class ListIterator;
296 class ListResourceBundle;
297 class Locale;
298 class Map;
299 class Map$Entry;
300 class MissingResourceException;
301 class NoSuchElementException;
302 class Observable;
303 class Observer;
304 class Properties;
305 class PropertyPermission;
306 class PropertyResourceBundle;
307 class Random;
308 class ResourceBundle;
309 class Set;
310 class SimpleTimeZone;
311 class SortedMap;
312 class SortedSet;
313 class Stack;
314 class StringTokenizer;
315 class SubList;
316 class TimeZone;
317 class Timer;
318 class Timer$Scheduler;
319 class Timer$TaskQueue;
320 class TimerTask;
321 class TooManyListenersException;
322 class TreeMap;
323 class TreeMap$Node;
324 class TreeMap$SubMap;
325 class TreeMap$TreeIterator;
326 class TreeMap$VerifyResult;
327 class TreeSet;
328 class Vector;
329 class WeakHashMap;
330 class WeakHashMap$Entry;
331 class WeakHashMap$WeakBucket;
332 class WeakHashMap$WeakEntrySet;
333 namespace jar
334 {
335 class Attributes;
336 class Attributes$Name;
337 class JarEntry;
338 class JarException;
339 class JarFile;
340 class JarFile$JarEnumeration;
341 class JarInputStream;
342 class JarOutputStream;
343 class Manifest;
344 };
345
346 namespace zip
347 {
348 class Adler32;
349 class CRC32;
350 class CheckedInputStream;
351 class CheckedOutputStream;
352 class Checksum;
353 class DataFormatException;
354 class Deflater;
355 class DeflaterOutputStream;
356 class GZIPInputStream;
357 class GZIPOutputStream;
358 class Inflater;
359 class InflaterInputStream;
360 class ZipConstants;
361 class ZipEntry;
362 class ZipEnumeration;
363 class ZipException;
364 class ZipFile;
365 class ZipInputStream;
366 class ZipOutputStream;
367 };
368 };
369 };
370 };
371
372 typedef struct java::lang::Object* jobject;
373 typedef class java::lang::Class* jclass;
374 typedef class java::lang::Throwable* jthrowable;
375 typedef class java::lang::String* jstring;
376 struct _Jv_JNIEnv;
377
378 typedef struct _Jv_Field *jfieldID;
379 typedef struct _Jv_Method *jmethodID;
380
381 extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__));
382 #ifdef JV_HASH_SYNCHRONIZATION
383 extern "C" jobject _Jv_AllocPtrFreeObject (jclass, jint)
384 __attribute__((__malloc__));
385 #else
386 // Collector still needs to scan sync_info
387 static inline jobject _Jv_AllocPtrFreeObject (jclass klass, jint sz)
388 {
389 return _Jv_AllocObject(klass, sz);
390 }
391 #endif
392 extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
393 extern "C" jstring _Jv_AllocString(jsize) __attribute__((__malloc__));
394 extern "C" jstring _Jv_NewString (const jchar*, jsize)
395 __attribute__((__malloc__));
396 extern jint _Jv_FormatInt (jchar* bufend, jint num);
397 extern "C" jchar* _Jv_GetStringChars (jstring str);
398 extern "C" void _Jv_MonitorEnter (jobject);
399 extern "C" void _Jv_MonitorExit (jobject);
400 extern "C" jstring _Jv_NewStringLatin1(const char*, jsize)
401 __attribute__((__malloc__));
402 extern "C" jsize _Jv_GetStringUTFLength (jstring);
403 extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
404
405 extern jint _Jv_CreateJavaVM (void* /*vm_args*/);
406
407 void
408 _Jv_ThreadRun (java::lang::Thread* thread);
409 jint
410 _Jv_AttachCurrentThread(java::lang::Thread* thread);
411 extern "C" java::lang::Thread*
412 _Jv_AttachCurrentThread(jstring name, java::lang::ThreadGroup* group);
413 extern "C" jint _Jv_DetachCurrentThread (void);
414
415 extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));
416 extern "C" void* _Jv_Malloc (jsize) __attribute__((__malloc__));
417 extern "C" void* _Jv_Realloc (void *, jsize);
418 extern "C" void _Jv_Free (void*);
419 extern void (*_Jv_RegisterClassHook) (jclass cl);
420 extern "C" void _Jv_RegisterClassHookDefault (jclass);
421
422 typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
423 typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
424
425 struct _Jv_Utf8Const
426 {
427 _Jv_ushort hash;
428 _Jv_ushort length; /* In bytes, of data portion, without final '\0'. */
429 char data[1]; /* In Utf8 format, with final '\0'. */
430 };
431
432
433 #endif /* __JAVAPRIMS_H__ */