History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg2/java/io/ObjectOutputStream_L.b (1 of 18352 files). Show all

Unified · Split

java/pkg2/java/io/ObjectOutputStream_L.b+257−0
@@ -0,0 +1,257 @@
1+implement ObjectOutputStream_L;
2+
3+# javal v1.3 generated file: edit with care
4+
5+include "jni.m";
6+ jni : JNI;
7+ ClassModule,
8+ JString,
9+ JArray,
10+ JArrayI,
11+ JArrayC,
12+ JArrayB,
13+ JArrayS,
14+ JArrayJ,
15+ JArrayF,
16+ JArrayD,
17+ JArrayZ,
18+ JArrayJObject,
19+ JArrayJClass,
20+ JArrayJString,
21+ JClass,
22+ JThread,
23+ JObject : import jni;
24+
25+#>> extra pre includes here
26+ sys : import jni;
27+ str : import jni;
28+ FALSE : import jni;
29+ TRUE : import jni;
30+#<<
31+
32+include "ObjectOutputStream_L.m";
33+
34+#>> extra post includes here
35+include "workdir.m";
36+include "regex.m";
37+str_mod : String;
38+Value : import jni;
39+cast : Cast;
40+#<<
41+
42+init( jni_p : JNI )
43+{
44+ # save java native inteface mod instance
45+ jni = jni_p;
46+ #>>extra initialization here
47+ sys = jni->sys;
48+ str_mod = jni->str;
49+ cast = jni->CastMod();
50+ #<<
51+}
52+
53+outputClassFields_rObject_rClass_aI_V( this : JObject, p0 : JObject,p1 : JClass,p2 : JArrayI)
54+{#>>
55+
56+ class := jni->GetObjectClass(p0);
57+ #p0 the object being outputted
58+ #p1 class being referred to
59+ #p2 fieldSequence array
60+
61+ a : ref Value;
62+ b : int;
63+ #
64+ # get all fields except the transient and static
65+ #
66+ fields_n_sigs := jni->GetFieldSignatures(p1, (JNI->ACC_STATIC|JNI->ACC_TRANSIENT));
67+ #
68+ # for each field, parse out the field name and signature. Then based on the
69+ # signature, call the appropriate write routine.
70+ #
71+ for (i:=0; i < len p2.ary; i += 2) {
72+ fldindex := p2.ary[i+1];
73+
74+ (str_part, tmp_str) := str_mod->splitl((fields_n_sigs.ary[fldindex]).str, " ");
75+ sig_part := tmp_str[1];
76+ #
77+ # get the value of this field and call the write routine
78+ #
79+ argv := array[] of {
80+ jni->GetObjField(p0, str_part, tmp_str[1:])
81+ };
82+ pick v := argv[0] {
83+ TByte =>
84+ argv[0] = ref Value.TInt(v.jbyte);
85+ TChar =>
86+ argv[0] = ref Value.TInt(v.jchar);
87+ TShort =>
88+ argv[0] = ref Value.TInt(v.jshort);
89+ }
90+ case sig_part {
91+ # SIGNATURE_BYTE
92+ 'B' =>
93+ (a, b) = jni->CallMethod(this, "writeByte", "(I)V", argv);
94+ # SIGNATURE_CHAR
95+ 'C' =>
96+ (a, b) = jni->CallMethod(this, "writeChar", "(I)V", argv);
97+ # SIGNATURE_FLOAT
98+ 'F' =>
99+ (a, b) = jni->CallMethod(this, "writeFloat", "(F)V", argv);
100+ # SIGNATURE_DOUBLE
101+ 'D' =>
102+ (a, b) = jni->CallMethod(this, "writeDouble", "(D)V", argv);
103+ # SIGNATURE_INT
104+ 'I' =>
105+ (a, b) = jni->CallMethod(this, "writeInt", "(I)V", argv);
106+ # SIGNATURE_LONG
107+ 'J' =>
108+ (a, b) = jni->CallMethod(this, "writeLong", "(J)V", argv);
109+ # SIGNATURE_SHORT
110+ 'S' =>
111+ (a, b) = jni->CallMethod(this, "writeShort", "(I)V", argv);
112+ # SIGNATURE_BOOLEAN
113+ 'Z' =>
114+ (a, b) = jni->CallMethod(this, "writeBoolean", "(Z)V", argv);
115+ # SIGNATURE_ARRAY
116+ '[' =>
117+ (a, b) = jni->CallMethod(this, "writeObject", "(Ljava/lang/Object;)V", argv);
118+ # SIGNATURE_CLASS
119+ 'L' =>
120+ (a, b) = jni->CallMethod(this, "writeObject", "(Ljava/lang/Object;)V", argv);
121+ }
122+ }
123+}#<<
124+
125+outputArrayValues_rObject_rClass_V( this : JObject, p0 : JObject,p1 : JClass)
126+{#>>
127+ # p0 the array being outputted
128+ # p1 the class name of the elements of the array (this is also the arrays signature)
129+ #
130+ #
131+ # make sure this is an array we have. If so, get the
132+ # length and write it out.
133+ #
134+ if ( jni->IsArray(p0) == JNI->FALSE) {
135+ jni->ThrowException("java.io.InvalidClassException", "Not an array");
136+ }
137+ length := jni->GetArrayLength(cast->ToJArray(p0));
138+ argv := array[1] of ref Value;
139+ argv[0] = ref Value.TInt(length);
140+ (a, b) := jni->CallMethod(this, "writeInt", "(I)V", argv);
141+
142+ #
143+ # dispatch on the signature of the array and print out each element.
144+ #
145+ i : int;
146+ case p1.aryname[1] {
147+ # SIGNATURE_BYTE
148+ 'B' =>
149+ {
150+ JAByte := cast->ToJArrayB(p0);
151+ for (i = 0; i < length; i++) {
152+ argv[0] = ref Value.TInt(int JAByte.ary[i]);
153+ (a, b) = jni->CallMethod(this, "writeByte", "(I)V", argv);
154+ }
155+ }
156+ # SIGNATURE_CHAR
157+ 'C' =>
158+ {
159+ JAChar := cast->ToJArrayI(p0);
160+ for (i = 0; i < length; i++) {
161+ argv[0] = ref Value.TInt(JAChar.ary[i]);
162+ (a, b) = jni->CallMethod(this, "writeChar", "(I)V", argv);
163+ }
164+ }
165+ # SIGNATURE_FLOAT
166+ 'F' =>
167+ {
168+ JAFloat := cast->ToJArrayF(p0);
169+ for (i = 0; i < length; i++) {
170+ argv[0] = ref Value.TFloat(JAFloat.ary[i]);
171+ (a, b) = jni->CallMethod(this, "writeFloat", "(F)V", argv);
172+ }
173+ }
174+ # SIGNATURE_DOUBLE
175+ 'D' =>
176+ {
177+ JADouble := cast->ToJArrayD(p0);
178+ for (i = 0; i < length; i++) {
179+ argv[0] = ref Value.TDouble(JADouble.ary[i]);
180+ (a, b) = jni->CallMethod(this, "writeDouble", "(D)V", argv);
181+ }
182+ }
183+ # SIGNATURE_INT
184+ 'I' =>
185+ {
186+ JAInt := cast->ToJArrayI(p0);
187+ for (i = 0; i < length; i++) {
188+ argv[0] = ref Value.TInt(JAInt.ary[i]);
189+ (a, b) = jni->CallMethod(this, "writeInt", "(I)V", argv);
190+ }
191+ }
192+ # SIGNATURE_LONG
193+ 'J' =>
194+ {
195+ JALong := cast->ToJArrayJ(p0);
196+ for (i = 0; i < length; i++) {
197+ argv[0] = ref Value.TLong(JALong.ary[i]);
198+ (a, b) = jni->CallMethod(this, "writeLong", "(J)V", argv);
199+ }
200+ }
201+ # SIGNATURE_SHORT
202+ 'S' =>
203+ {
204+ JAShort := cast->ToJArrayI(p0);
205+ for (i = 0; i < length; i++) {
206+ argv[0] = ref Value.TInt(JAShort.ary[i]);
207+ (a, b) = jni->CallMethod(this, "writeShort", "(I)V", argv);
208+ }
209+ }
210+ # SIGNATURE_BOOLEAN
211+ 'Z' =>
212+ {
213+ JABool := cast->ToJArrayZ(p0);
214+ for (i = 0; i < length; i++) {
215+ argv[0] = ref Value.TBoolean(int JABool.ary[i]);
216+ (a, b) = jni->CallMethod(this, "writeBoolean", "(Z)V", argv);
217+ }
218+ }
219+ # SIGNATURE_ARRAY
220+ '[' =>
221+ {
222+ JAObj := cast->ToJArrayJObject(p0);
223+ for (i = 0; i < length; i++) {
224+ argv[0] = ref Value.TObject(JAObj.ary[i]);
225+ (a, b) = jni->CallMethod(this, "writeObject", "(Ljava/lang/Object;)V", argv);
226+ }
227+ }
228+ # SIGNATURE_CLASS
229+ 'L' =>
230+ {
231+ JAObj := cast->ToJArrayJObject(p0);
232+ for (i = 0; i < length; i++) {
233+ argv[0] = ref Value.TObject(JAObj.ary[i]);
234+ (a, b) = jni->CallMethod(this, "writeObject", "(Ljava/lang/Object;)V", argv);
235+ }
236+ }
237+ }
238+}#<<
239+
240+invokeObjectWriter_rObject_rClass_Z( this : JObject, p0 : JObject,p1 : JClass) : int
241+{#>>
242+ junk := p1;
243+ #
244+ # call writeObject() on object "p0" with an argument of "this"
245+ #
246+ MyValueArray := array[] of {
247+ ref Value.TObject(this)
248+ };
249+ (a, b) := jni->CallMethod(p0, "writeObject", "(Ljava/io/ObjectOutputStream;)V", MyValueArray);
250+
251+ return b == JNI->OK;
252+}#<<
253+
254+getRefHashCode_rObject_I( p0 : JObject) : int
255+{#>>
256+ return( jni->IdentityHash(p0) );
257+}#<<