boehm.cc: Remove stray semicolon.
[gcc.git] / libjava / gcj / javaprims.h
1 // javaprims.h - Main external header file for libgcj. -*- c++ -*-
2
3 /* Copyright (C) 1998, 1999, 2000, 2001, 2002 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 AssertionError;
135 class Boolean;
136 class Byte;
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 InheritableThreadLocal;
166 class InstantiationError;
167 class InstantiationException;
168 class Integer;
169 class InternalError;
170 class InterruptedException;
171 class LinkageError;
172 class Long;
173 class Math;
174 class NegativeArraySizeException;
175 class NoClassDefFoundError;
176 class NoSuchFieldError;
177 class NoSuchFieldException;
178 class NoSuchMethodError;
179 class NoSuchMethodException;
180 class NullPointerException;
181 class Number;
182 class NumberFormatException;
183 class Object;
184 class OutOfMemoryError;
185 class Package;
186 class Process;
187 class Runnable;
188 class Runtime;
189 class RuntimeException;
190 class RuntimePermission;
191 class SecurityContext;
192 class SecurityException;
193 class SecurityManager;
194 class Short;
195 class StackOverflowError;
196 class StackTraceElement;
197 class StrictMath;
198 class String;
199 class String$CaseInsensitiveComparator;
200 class StringBuffer;
201 class StringIndexOutOfBoundsException;
202 class System;
203 class Thread;
204 class ThreadDeath;
205 class ThreadGroup;
206 class ThreadLocal;
207 class Throwable;
208 class UnknownError;
209 class UnsatisfiedLinkError;
210 class UnsupportedClassVersionError;
211 class UnsupportedOperationException;
212 class VMClassLoader;
213 class VMSecurityManager;
214 class VMThrowable;
215 class VerifyError;
216 class VirtualMachineError;
217 class Void;
218 namespace ref
219 {
220 class PhantomReference;
221 class Reference;
222 class ReferenceQueue;
223 class SoftReference;
224 class WeakReference;
225 }
226
227 namespace reflect
228 {
229 class AccessibleObject;
230 class Array;
231 class Constructor;
232 class Field;
233 class InvocationHandler;
234 class InvocationTargetException;
235 class Member;
236 class Method;
237 class Modifier;
238 class Proxy;
239 class Proxy$ProxyData;
240 class Proxy$ProxyType;
241 class ReflectPermission;
242 class UndeclaredThrowableException;
243 }
244 }
245
246 namespace util
247 {
248 class AbstractCollection;
249 class AbstractList;
250 class AbstractMap;
251 class AbstractMap$BasicMapEntry;
252 class AbstractSequentialList;
253 class AbstractSet;
254 class ArrayList;
255 class Arrays;
256 class Arrays$ArrayList;
257 class BitSet;
258 class Calendar;
259 class Collection;
260 class Collections;
261 class Collections$CopiesList;
262 class Collections$EmptyList;
263 class Collections$EmptyMap;
264 class Collections$EmptySet;
265 class Collections$ReverseComparator;
266 class Collections$SingletonList;
267 class Collections$SingletonMap;
268 class Collections$SingletonSet;
269 class Collections$SynchronizedCollection;
270 class Collections$SynchronizedIterator;
271 class Collections$SynchronizedList;
272 class Collections$SynchronizedListIterator;
273 class Collections$SynchronizedMap;
274 class Collections$SynchronizedMapEntry;
275 class Collections$SynchronizedRandomAccessList;
276 class Collections$SynchronizedSet;
277 class Collections$SynchronizedSortedMap;
278 class Collections$SynchronizedSortedSet;
279 class Collections$UnmodifiableCollection;
280 class Collections$UnmodifiableEntrySet;
281 class Collections$UnmodifiableIterator;
282 class Collections$UnmodifiableList;
283 class Collections$UnmodifiableListIterator;
284 class Collections$UnmodifiableMap;
285 class Collections$UnmodifiableRandomAccessList;
286 class Collections$UnmodifiableSet;
287 class Collections$UnmodifiableSortedMap;
288 class Collections$UnmodifiableSortedSet;
289 class Comparator;
290 class ConcurrentModificationException;
291 class Date;
292 class Dictionary;
293 class EmptyStackException;
294 class Enumeration;
295 class EventListener;
296 class EventListenerProxy;
297 class EventObject;
298 class GregorianCalendar;
299 class HashMap;
300 class HashMap$HashEntry;
301 class HashMap$HashIterator;
302 class HashSet;
303 class Hashtable;
304 class Hashtable$Enumerator;
305 class Hashtable$HashEntry;
306 class Hashtable$HashIterator;
307 class IdentityHashMap;
308 class IdentityHashMap$IdentityEntry;
309 class IdentityHashMap$IdentityIterator;
310 class Iterator;
311 class LinkedHashMap;
312 class LinkedHashMap$LinkedHashEntry;
313 class LinkedHashSet;
314 class LinkedList;
315 class LinkedList$Entry;
316 class LinkedList$LinkedListItr;
317 class List;
318 class ListIterator;
319 class ListResourceBundle;
320 class Locale;
321 class Map;
322 class Map$Entry;
323 class Map$Map;
324 class MissingResourceException;
325 class MyResources;
326 class NoSuchElementException;
327 class Observable;
328 class Observer;
329 class Properties;
330 class PropertyPermission;
331 class PropertyPermissionCollection;
332 class PropertyResourceBundle;
333 class Random;
334 class RandomAccess;
335 class RandomAccessSubList;
336 class ResourceBundle;
337 class ResourceBundle$Security;
338 class Set;
339 class SimpleTimeZone;
340 class SortedMap;
341 class SortedSet;
342 class Stack;
343 class StringTokenizer;
344 class SubList;
345 class TimeZone;
346 class Timer;
347 class Timer$Scheduler;
348 class Timer$TaskQueue;
349 class TimerTask;
350 class TooManyListenersException;
351 class TreeMap;
352 class TreeMap$Node;
353 class TreeMap$SubMap;
354 class TreeMap$TreeIterator;
355 class TreeSet;
356 class Vector;
357 class WeakHashMap;
358 class WeakHashMap$WeakBucket;
359 class WeakHashMap$WeakEntry;
360 class WeakHashMap$WeakEntrySet;
361 namespace jar
362 {
363 class Attributes;
364 class Attributes$Name;
365 class JarEntry;
366 class JarException;
367 class JarFile;
368 class JarFile$JarEnumeration;
369 class JarInputStream;
370 class JarOutputStream;
371 class Manifest;
372 }
373
374 namespace zip
375 {
376 class Adler32;
377 class CRC32;
378 class CheckedInputStream;
379 class CheckedOutputStream;
380 class Checksum;
381 class DataFormatException;
382 class Deflater;
383 class DeflaterOutputStream;
384 class GZIPInputStream;
385 class GZIPOutputStream;
386 class Inflater;
387 class InflaterInputStream;
388 class ZipConstants;
389 class ZipEntry;
390 class ZipException;
391 class ZipFile;
392 class ZipFile$PartialInputStream;
393 class ZipFile$ZipEntryEnumeration;
394 class ZipInputStream;
395 class ZipOutputStream;
396 }
397 }
398 }
399 }
400
401 typedef struct java::lang::Object* jobject;
402 typedef class java::lang::Class* jclass;
403 typedef class java::lang::Throwable* jthrowable;
404 typedef class java::lang::String* jstring;
405 struct _Jv_JNIEnv;
406
407 typedef struct _Jv_Field *jfieldID;
408 typedef struct _Jv_Method *jmethodID;
409
410 extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__));
411 extern "C" jobject _Jv_AllocObjectNoFinalizer (jclass, jint) __attribute__((__malloc__));
412 extern "C" jobject _Jv_AllocObjectNoInitNoFinalizer (jclass, jint) __attribute__((__malloc__));
413 #ifdef JV_HASH_SYNCHRONIZATION
414 extern "C" jobject _Jv_AllocPtrFreeObject (jclass, jint)
415 __attribute__((__malloc__));
416 #else
417 // Collector still needs to scan sync_info
418 static inline jobject _Jv_AllocPtrFreeObject (jclass klass, jint sz)
419 {
420 return _Jv_AllocObject(klass, sz);
421 }
422 #endif
423 extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
424 extern "C" jstring _Jv_AllocString(jsize) __attribute__((__malloc__));
425 extern "C" jstring _Jv_NewString (const jchar*, jsize)
426 __attribute__((__malloc__));
427 extern jint _Jv_FormatInt (jchar* bufend, jint num);
428 extern "C" jchar* _Jv_GetStringChars (jstring str);
429 extern "C" void _Jv_MonitorEnter (jobject);
430 extern "C" void _Jv_MonitorExit (jobject);
431 extern "C" jstring _Jv_NewStringLatin1(const char*, jsize)
432 __attribute__((__malloc__));
433 extern "C" jsize _Jv_GetStringUTFLength (jstring);
434 extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
435
436 extern jint _Jv_CreateJavaVM (void* /*vm_args*/);
437
438 void
439 _Jv_ThreadRun (java::lang::Thread* thread);
440 jint
441 _Jv_AttachCurrentThread(java::lang::Thread* thread);
442 extern "C" java::lang::Thread*
443 _Jv_AttachCurrentThread(jstring name, java::lang::ThreadGroup* group);
444 extern "C" java::lang::Thread*
445 _Jv_AttachCurrentThreadAsDaemon(jstring name, java::lang::ThreadGroup* group);
446 extern "C" jint _Jv_DetachCurrentThread (void);
447
448 extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));
449 extern "C" void* _Jv_Malloc (jsize) __attribute__((__malloc__));
450 extern "C" void* _Jv_Realloc (void *, jsize);
451 extern "C" void _Jv_Free (void*);
452 extern void (*_Jv_RegisterClassHook) (jclass cl);
453 extern "C" void _Jv_RegisterClassHookDefault (jclass);
454
455 typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
456 typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
457
458 struct _Jv_Utf8Const
459 {
460 _Jv_ushort hash;
461 _Jv_ushort length; /* In bytes, of data portion, without final '\0'. */
462 char data[1]; /* In Utf8 format, with final '\0'. */
463 };
464
465
466 #endif /* __JAVAPRIMS_H__ */