OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [gcj/] [array.h] - Blame information for rev 798

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 755 jeremybenn
// array.h - Header file for CNI arrays.  -*- 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 __GCJ_ARRAY_H__
12
#define __GCJ_ARRAY_H__
13
 
14
#include <java/lang/Object.h>
15
 
16
extern "Java" {
17
 
18
class __JArray : public java::lang::Object
19
{
20
protected:
21
  // This is just a hack to work around a warning emitted by the C++
22
  // compiler.  We initialize `length' evilly, but it doesn't know
23
  // that.
24
  __JArray () : length (0)
25
  {
26
  }
27
public:
28
  const jsize length;
29
  friend jsize JvGetArrayLength (__JArray*);
30
};
31
 
32
template<class T>
33
class JArray;
34
 
35
template<class T>
36
inline T* elements(JArray<T>& x);
37
template<class T>
38
inline T* elements(JArray<T>* x);
39
 
40
template<class T>
41
class JArray : public __JArray
42
{
43
  T data[0];
44
public:
45
  friend T* elements<>(JArray<T>& x);
46
  friend T* elements<>(JArray<T>* x);
47
  // T* getData() { return data; }
48
  // T& operator[](jint i) { return data[i]; }
49
};
50
 
51
template<class T>
52
inline T* elements(JArray<T>& x) { return x.data; }
53
template<class T>
54
inline T* elements(JArray<T>* x) { return x->data; }
55
 
56
} // end extern "Java"
57
 
58
/* These typesdefs match those in JNI. */
59
typedef __JArray *jarray;
60
typedef JArray<jobject> *jobjectArray;
61
typedef JArray<jboolean> *jbooleanArray;
62
typedef JArray<jbyte> *jbyteArray;
63
typedef JArray<jchar> *jcharArray;
64
typedef JArray<jshort> *jshortArray;
65
typedef JArray<jint> *jintArray;
66
typedef JArray<jlong> *jlongArray;
67
typedef JArray<jfloat> *jfloatArray;
68
typedef JArray<jdouble> *jdoubleArray;
69
typedef JArray<jstring> *jstringArray;
70
 
71
extern java::lang::Class _Jv_byteClass, _Jv_shortClass, _Jv_intClass,
72
  _Jv_longClass, _Jv_booleanClass, _Jv_charClass, _Jv_floatClass,
73
  _Jv_doubleClass, _Jv_voidClass;
74
/* The definition of this macro cannot be enclosed in parentheses
75
   because "JvPrimClass(x)" is used as a template argument.  */
76
#define JvPrimClass(TYPE) & _Jv_##TYPE##Class
77
 
78
extern "C" jobjectArray _Jv_NewObjectArray(jsize length, jclass, jobject init);
79
extern "C" jobject _Jv_NewPrimArray (jclass eltype, jint count);
80
 
81
extern inline jobjectArray
82
JvNewObjectArray (jsize length, jclass cls, jobject init)
83
{
84
  return _Jv_NewObjectArray (length, cls, init);
85
}
86
 
87
extern inline jcharArray
88
JvNewCharArray (jint length)
89
{
90
  return (jcharArray) _Jv_NewPrimArray (JvPrimClass (char), length);
91
}
92
 
93
extern inline jbooleanArray
94
JvNewBooleanArray (jint length)
95
{
96
  return (jbooleanArray) _Jv_NewPrimArray (JvPrimClass (boolean), length);
97
}
98
 
99
extern inline jbyteArray
100
JvNewByteArray (jint length)
101
{
102
  return (jbyteArray) _Jv_NewPrimArray (JvPrimClass (byte), length);
103
}
104
 
105
extern inline jshortArray
106
JvNewShortArray (jint length)
107
{
108
  return (jshortArray) _Jv_NewPrimArray (JvPrimClass (short), length);
109
}
110
 
111
extern inline jintArray
112
JvNewIntArray (jint length)
113
{
114
  return (jintArray) _Jv_NewPrimArray (JvPrimClass (int), length);
115
}
116
 
117
extern inline jlongArray
118
JvNewLongArray (jint length)
119
{
120
  return (jlongArray) _Jv_NewPrimArray (JvPrimClass (long), length);
121
}
122
 
123
extern inline jfloatArray
124
JvNewFloatArray (jint length)
125
{
126
  return (jfloatArray) _Jv_NewPrimArray (JvPrimClass (float), length);
127
}
128
 
129
extern inline jdoubleArray
130
JvNewDoubleArray (jint length)
131
{
132
  return (jdoubleArray) _Jv_NewPrimArray (JvPrimClass (double), length);
133
}
134
 
135
 
136
extern "C" jstringArray JvConvertArgv(int argc, const char **argv);
137
 
138
inline jsize JvGetArrayLength (jarray array) { return array->length; }
139
 
140
#endif /* __GCJ_ARRAY_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.