gcc/libjava/include/java-array.h

80 lines
2.3 KiB
C
Raw Normal View History

1999-04-07 16:42:40 +02:00
// java-array.h - Header file for CNI arrays. -*- c++ -*-
/* Copyright (C) 1998, 1999 Cygnus Solutions
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
#ifndef __JAVA_ARRAY_H__
#define __JAVA_ARRAY_H__
#pragma interface
#include <java/lang/Object.h>
extern "Java" {
class __JArray : public java::lang::Object
{
public:
int length;
friend jsize JvGetArrayLength (__JArray*);
};
template<class T>
class JArray : public __JArray
{
T data[0];
public:
friend T* elements<>(JArray<T>& x);
friend T* elements<>(JArray<T>* x);
// T* getData() { return data; }
// T& operator[](jint i) { return data[i]; }
};
template<class T>
T* elements(JArray<T>& x) { return x.data; }
template<class T>
T* elements(JArray<T>* x) { return x->data; }
}; // end extern "Java"
/* These typesdefs match those in JNI. */
typedef __JArray *jarray;
typedef JArray<jobject> *jobjectArray;
typedef JArray<jboolean> *jbooleanArray;
typedef JArray<jbyte> *jbyteArray;
typedef JArray<jchar> *jcharArray;
typedef JArray<jshort> *jshortArray;
typedef JArray<jint> *jintArray;
typedef JArray<jlong> *jlongArray;
typedef JArray<jfloat> *jfloatArray;
typedef JArray<jdouble> *jdoubleArray;
typedef JArray<jstring> *jstringArray;
// Temporary work-around for gcjh bug. FIXME
typedef JArray<jcharArray> *jobjectArrayjchar;
extern "C" jbooleanArray JvNewBooleanArray (jint length);
extern "C" jbyteArray JvNewByteArray (jint length);
extern "C" jcharArray JvNewCharArray (jint length);
extern "C" jshortArray JvNewShortArray (jint length);
extern "C" jintArray JvNewIntArray (jint length);
extern "C" jlongArray JvNewLongArray (jint length);
extern "C" jfloatArray JvNewFloatArray (jint length);
extern "C" jdoubleArray JvNewDoubleArray (jint length);
extern "C" jobjectArray _Jv_NewObjectArray(jsize length, jclass, jobject init);
inline jobjectArray JvNewObjectArray (jsize length, jclass cls, jobject init)
{ return _Jv_NewObjectArray (length, cls, init); }
extern "C" jstringArray JvConvertArgv(int argc, const char **argv);
extern "C" void JvRunMain (jclass klass, int argc, const char **argv);
natClassLoader.cc (_Jv_PrepareCompiledClass): Renamed from _Jv_InternClassStrings. * java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Renamed from _Jv_InternClassStrings. * prims.cc (_Jv_RunMain): New function. (JvRunMain): Remove gij-support. * gij.cc (main): Use _Jv_RunMain. * java/util/zip/ZipFile.java: Call readDirectory in constructor. * interpret.cc (PUSHA, PUSHI, PUSHF, PUSHL, PUSHD): Don't store argument in temp variable. (continue1): For all op_x2y insns, use temp variable for intermediate value. Also remove some comments. * java/lang/natClass.cc (newInstance): Call _Jv_InitClass. (forName): Don't call _Jv_InitClass. * java/lang/Class.java (getResource,getResourceAsStream): Implement. * java/util/zip/ZipEntry.java (ZipEntry(ZipEntry)): New construcor. * java/util/jar/JarInputStream.java: New file. * java/util/jar/JarEntry.java: New file. * java/util/jar/JarFile.java: New file. * java/net/URLClassLoader.java: New file. * java/net/JarURLConnection.java: New file. * gnu/gcj/protocol/jar/Handler.java: New file. * gnu/gcj/protocol/jar/Connection.java: New file. * java/security/SecureClassLoader.java: New file. * java/lang/ClassLoader.java (parent): New variable. (ClassLoader (ClassLoader)): new constructor. (findClass): New method. (loadClass): Add default 1.2 implementation. (getSystemResourceAsBytes, getResourceAsBytes): Removed. (readfully): Removed. * gnu/gcj/runtime/VMClassLoader.java: Moved from java/lang. (findSystemClass): New method. (VMClassLoader): Constructor rewritten. (init): New method. All other methods removed. * java/lang/natClassLoader.cc: Change use of java::lang::VMClassLoader to gnu::gcj::runtime::VMClassLoader. (_Jv_InternClassStrings): Use _Jv_ResolvePoolEntry. Also handle class entries. (VMClassLoader::findSystemClass): renamed from findBootClass. * Makefile.am: Add new files. (FirstThread.h, ThreadGroup.h): Add _Jv_Main friend. * Makefile.in: Rebuilt. From-SVN: r28748
1999-08-18 16:16:42 +02:00
void _Jv_RunMain (const char* name, int argc, const char **argv);
1999-04-07 16:42:40 +02:00
inline jsize JvGetArrayLength (jarray array) { return array->length; }
#endif /* __JAVA_ARRAY_H__ */