interpret.cc (_Jv_InterpMethod::run): Don't use libffi types, they were meant to...
[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, 2003 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 VMObjectStreamClass;
124 class ValidatorAndPriority;
125 class WriteAbortedException;
126 class Writer;
127 }
128
129 namespace lang
130 {
131 class AbstractMethodError;
132 class ArithmeticException;
133 class ArrayIndexOutOfBoundsException;
134 class ArrayStoreException;
135 class AssertionError;
136 class Boolean;
137 class Byte;
138 class CharSequence;
139 class Character;
140 class Character$Subset;
141 class Character$UnicodeBlock;
142 class Class;
143 class ClassCastException;
144 class ClassCircularityError;
145 class ClassFormatError;
146 class ClassLoader;
147 class ClassNotFoundException;
148 class CloneNotSupportedException;
149 class Cloneable;
150 class Comparable;
151 class Compiler;
152 class ConcreteProcess;
153 class Double;
154 class Error;
155 class Exception;
156 class ExceptionInInitializerError;
157 class Float;
158 class IllegalAccessError;
159 class IllegalAccessException;
160 class IllegalArgumentException;
161 class IllegalMonitorStateException;
162 class IllegalStateException;
163 class IllegalThreadStateException;
164 class IncompatibleClassChangeError;
165 class IndexOutOfBoundsException;
166 class InheritableThreadLocal;
167 class InstantiationError;
168 class InstantiationException;
169 class Integer;
170 class InternalError;
171 class InterruptedException;
172 class LinkageError;
173 class Long;
174 class Math;
175 class NegativeArraySizeException;
176 class NoClassDefFoundError;
177 class NoSuchFieldError;
178 class NoSuchFieldException;
179 class NoSuchMethodError;
180 class NoSuchMethodException;
181 class NullPointerException;
182 class Number;
183 class NumberFormatException;
184 class Object;
185 class OutOfMemoryError;
186 class Package;
187 class Process;
188 class Runnable;
189 class Runtime;
190 class RuntimeException;
191 class RuntimePermission;
192 class SecurityContext;
193 class SecurityException;
194 class SecurityManager;
195 class Short;
196 class StackOverflowError;
197 class StackTraceElement;
198 class StrictMath;
199 class String;
200 class String$CaseInsensitiveComparator;
201 class StringBuffer;
202 class StringIndexOutOfBoundsException;
203 class System;
204 class Thread;
205 class ThreadDeath;
206 class ThreadGroup;
207 class ThreadLocal;
208 class Throwable;
209 class UnknownError;
210 class UnsatisfiedLinkError;
211 class UnsupportedClassVersionError;
212 class UnsupportedOperationException;
213 class VMClassLoader;
214 class VMSecurityManager;
215 class VMThrowable;
216 class VerifyError;
217 class VirtualMachineError;
218 class Void;
219 namespace ref
220 {
221 class PhantomReference;
222 class Reference;
223 class ReferenceQueue;
224 class SoftReference;
225 class WeakReference;
226 }
227
228 namespace reflect
229 {
230 class AccessibleObject;
231 class Array;
232 class Constructor;
233 class Field;
234 class InvocationHandler;
235 class InvocationTargetException;
236 class Member;
237 class Method;
238 class Modifier;
239 class Proxy;
240 class Proxy$ClassFactory;
241 class Proxy$ProxyData;
242 class Proxy$ProxySignature;
243 class Proxy$ProxyType;
244 class ReflectPermission;
245 class UndeclaredThrowableException;
246 }
247 }
248
249 namespace util
250 {
251 class AbstractCollection;
252 class AbstractList;
253 class AbstractMap;
254 class AbstractMap$BasicMapEntry;
255 class AbstractSequentialList;
256 class AbstractSet;
257 class ArrayList;
258 class Arrays;
259 class Arrays$ArrayList;
260 class BitSet;
261 class Calendar;
262 class Collection;
263 class Collections;
264 class Collections$CopiesList;
265 class Collections$EmptyList;
266 class Collections$EmptyMap;
267 class Collections$EmptySet;
268 class Collections$ReverseComparator;
269 class Collections$SingletonList;
270 class Collections$SingletonMap;
271 class Collections$SingletonSet;
272 class Collections$SynchronizedCollection;
273 class Collections$SynchronizedIterator;
274 class Collections$SynchronizedList;
275 class Collections$SynchronizedListIterator;
276 class Collections$SynchronizedMap;
277 class Collections$SynchronizedMapEntry;
278 class Collections$SynchronizedRandomAccessList;
279 class Collections$SynchronizedSet;
280 class Collections$SynchronizedSortedMap;
281 class Collections$SynchronizedSortedSet;
282 class Collections$UnmodifiableCollection;
283 class Collections$UnmodifiableEntrySet;
284 class Collections$UnmodifiableIterator;
285 class Collections$UnmodifiableList;
286 class Collections$UnmodifiableListIterator;
287 class Collections$UnmodifiableMap;
288 class Collections$UnmodifiableRandomAccessList;
289 class Collections$UnmodifiableSet;
290 class Collections$UnmodifiableSortedMap;
291 class Collections$UnmodifiableSortedSet;
292 class Comparator;
293 class ConcurrentModificationException;
294 class Date;
295 class Dictionary;
296 class EmptyStackException;
297 class Enumeration;
298 class EventListener;
299 class EventListenerProxy;
300 class EventObject;
301 class GregorianCalendar;
302 class HashMap;
303 class HashMap$HashEntry;
304 class HashMap$HashIterator;
305 class HashSet;
306 class Hashtable;
307 class Hashtable$Enumerator;
308 class Hashtable$HashEntry;
309 class Hashtable$HashIterator;
310 class IdentityHashMap;
311 class IdentityHashMap$IdentityEntry;
312 class IdentityHashMap$IdentityIterator;
313 class Iterator;
314 class LinkedHashMap;
315 class LinkedHashMap$LinkedHashEntry;
316 class LinkedHashSet;
317 class LinkedList;
318 class LinkedList$Entry;
319 class LinkedList$LinkedListItr;
320 class List;
321 class ListIterator;
322 class ListResourceBundle;
323 class Locale;
324 class Map;
325 class Map$Entry;
326 class Map$Map;
327 class MissingResourceException;
328 class MyResources;
329 class NoSuchElementException;
330 class Observable;
331 class Observer;
332 class Properties;
333 class PropertyPermission;
334 class PropertyPermissionCollection;
335 class PropertyResourceBundle;
336 class Random;
337 class RandomAccess;
338 class RandomAccessSubList;
339 class ResourceBundle;
340 class Set;
341 class SimpleTimeZone;
342 class SortedMap;
343 class SortedSet;
344 class Stack;
345 class StringTokenizer;
346 class SubList;
347 class TimeZone;
348 class Timer;
349 class Timer$Scheduler;
350 class Timer$TaskQueue;
351 class TimerTask;
352 class TooManyListenersException;
353 class TreeMap;
354 class TreeMap$Node;
355 class TreeMap$SubMap;
356 class TreeMap$TreeIterator;
357 class TreeSet;
358 class Vector;
359 class WeakHashMap;
360 class WeakHashMap$WeakBucket;
361 class WeakHashMap$WeakEntry;
362 class WeakHashMap$WeakEntrySet;
363 namespace jar
364 {
365 class Attributes;
366 class Attributes$Name;
367 class JarEntry;
368 class JarException;
369 class JarFile;
370 class JarFile$JarEnumeration;
371 class JarInputStream;
372 class JarOutputStream;
373 class Manifest;
374 }
375
376 namespace logging
377 {
378 class ConsoleHandler;
379 class ErrorManager;
380 class FileHandler;
381 class Filter;
382 class Formatter;
383 class Handler;
384 class Level;
385 class LogManager;
386 class LogRecord;
387 class Logger;
388 class LoggingPermission;
389 class MemoryHandler;
390 class SimpleFormatter;
391 class SocketHandler;
392 class StreamHandler;
393 class XMLFormatter;
394 }
395
396 namespace prefs
397 {
398 class AbstractPreferences;
399 class BackingStoreException;
400 class InvalidPreferencesFormatException;
401 class NodeChangeEvent;
402 class NodeChangeListener;
403 class PreferenceChangeEvent;
404 class PreferenceChangeListener;
405 class Preferences;
406 class PreferencesFactory;
407 }
408
409 namespace regex
410 {
411 class Matcher;
412 class Pattern;
413 class PatternSyntaxException;
414 }
415
416 namespace zip
417 {
418 class Adler32;
419 class CRC32;
420 class CheckedInputStream;
421 class CheckedOutputStream;
422 class Checksum;
423 class DataFormatException;
424 class Deflater;
425 class DeflaterOutputStream;
426 class GZIPInputStream;
427 class GZIPOutputStream;
428 class Inflater;
429 class InflaterInputStream;
430 class ZipConstants;
431 class ZipEntry;
432 class ZipException;
433 class ZipFile;
434 class ZipFile$PartialInputStream;
435 class ZipFile$ZipEntryEnumeration;
436 class ZipInputStream;
437 class ZipOutputStream;
438 }
439 }
440 }
441 }
442
443 typedef struct java::lang::Object* jobject;
444 typedef class java::lang::Class* jclass;
445 typedef class java::lang::Throwable* jthrowable;
446 typedef class java::lang::String* jstring;
447 struct _Jv_JNIEnv;
448
449 typedef struct _Jv_Field *jfieldID;
450 typedef struct _Jv_Method *jmethodID;
451
452 extern "C" jobject _Jv_AllocObject (jclass, jint) __attribute__((__malloc__));
453 extern "C" jobject _Jv_AllocObjectNoFinalizer (jclass, jint) __attribute__((__malloc__));
454 extern "C" jobject _Jv_AllocObjectNoInitNoFinalizer (jclass, jint) __attribute__((__malloc__));
455 #ifdef JV_HASH_SYNCHRONIZATION
456 extern "C" jobject _Jv_AllocPtrFreeObject (jclass, jint)
457 __attribute__((__malloc__));
458 #else
459 // Collector still needs to scan sync_info
460 static inline jobject _Jv_AllocPtrFreeObject (jclass klass, jint sz)
461 {
462 return _Jv_AllocObject(klass, sz);
463 }
464 #endif
465 extern "C" jboolean _Jv_IsInstanceOf(jobject, jclass);
466 extern "C" jstring _Jv_AllocString(jsize) __attribute__((__malloc__));
467 extern "C" jstring _Jv_NewString (const jchar*, jsize)
468 __attribute__((__malloc__));
469 extern jint _Jv_FormatInt (jchar* bufend, jint num);
470 extern "C" jchar* _Jv_GetStringChars (jstring str);
471 extern "C" void _Jv_MonitorEnter (jobject);
472 extern "C" void _Jv_MonitorExit (jobject);
473 extern "C" jstring _Jv_NewStringLatin1(const char*, jsize)
474 __attribute__((__malloc__));
475 extern "C" jsize _Jv_GetStringUTFLength (jstring);
476 extern "C" jsize _Jv_GetStringUTFRegion (jstring, jsize, jsize, char *);
477
478 extern jint _Jv_CreateJavaVM (void* /*vm_args*/);
479
480 void
481 _Jv_ThreadRun (java::lang::Thread* thread);
482 jint
483 _Jv_AttachCurrentThread(java::lang::Thread* thread);
484 extern "C" java::lang::Thread*
485 _Jv_AttachCurrentThread(jstring name, java::lang::ThreadGroup* group);
486 extern "C" java::lang::Thread*
487 _Jv_AttachCurrentThreadAsDaemon(jstring name, java::lang::ThreadGroup* group);
488 extern "C" jint _Jv_DetachCurrentThread (void);
489
490 extern "C" void _Jv_Throw (jthrowable) __attribute__ ((__noreturn__));
491 extern "C" void* _Jv_Malloc (jsize) __attribute__((__malloc__));
492 extern "C" void* _Jv_Realloc (void *, jsize);
493 extern "C" void _Jv_Free (void*);
494 extern void (*_Jv_RegisterClassHook) (jclass cl);
495 extern "C" void _Jv_RegisterClassHookDefault (jclass);
496
497 typedef unsigned short _Jv_ushort __attribute__((__mode__(__HI__)));
498 typedef unsigned int _Jv_uint __attribute__((__mode__(__SI__)));
499 typedef unsigned int _Jv_ulong __attribute__((__mode__(__DI__)));
500
501 struct _Jv_Utf8Const
502 {
503 _Jv_ushort hash;
504 _Jv_ushort length; /* In bytes, of data portion, without final '\0'. */
505 char data[1]; /* In Utf8 format, with final '\0'. */
506 };
507
508
509 #endif /* __JAVAPRIMS_H__ */