Showing the changes to java/pkg2/java/io/ObjectStreamClass_L.b (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,164 @@ | |||
| 1 | implement ObjectStreamClass_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 "ObjectStreamClass_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 | getClassAccess_rClass_I( p0 : JClass) : int | ||
| 54 | {#>> | ||
| 55 | return (jni->GetClassFlags(p0) & JNI->ACC_WRITTEN_FLAGS); | ||
| 56 | }#<< | ||
| 57 | |||
| 58 | getMethodSignatures_rClass_aString( p0 : JClass) : JArrayJString | ||
| 59 | {#>> | ||
| 60 | # Return an array of Strings containing the method names and signatures. | ||
| 61 | return (jni->GetMethodSignatures(p0, 0)); | ||
| 62 | }#<< | ||
| 63 | |||
| 64 | getMethodAccess_rClass_rString_I( p0 : JClass,p1 : JString) : int | ||
| 65 | {#>> | ||
| 66 | return (jni->GetMethodFlags(p0, p1.str) & JNI->ACC_WRITTEN_FLAGS); | ||
| 67 | }#<< | ||
| 68 | |||
| 69 | getFieldSignatures_rClass_aString( p0 : JClass) : JArrayJString | ||
| 70 | {#>> | ||
| 71 | # Return an array of Strings containing the field names and signatures. | ||
| 72 | return (jni->GetFieldSignatures(p0, 0)); | ||
| 73 | }#<< | ||
| 74 | |||
| 75 | getFieldAccess_rClass_rString_I( p0 : JClass,p1 : JString) : int | ||
| 76 | {#>> | ||
| 77 | return (jni->GetFieldFlags(p0, p1.str) & JNI->ACC_WRITTEN_FLAGS); | ||
| 78 | }#<< | ||
| 79 | |||
| 80 | getFields0_rClass_aObjectStreamField( this : ref ObjectStreamClass_obj, p0 : JClass) : JArrayJObject | ||
| 81 | {#>> | ||
| 82 | # | ||
| 83 | # Return an array of ObjectStreamField objects for each non-static and | ||
| 84 | # non-transient field of the specified class. First find and load the | ||
| 85 | # ObjectStreamField class. | ||
| 86 | # | ||
| 87 | junk := this; | ||
| 88 | cl_data := jni->FindClass("java/io/ObjectStreamField"); | ||
| 89 | if (cl_data == nil) | ||
| 90 | jni->FatalError("ObjectStreamClass could not load java/io/ObjectStreamField"); | ||
| 91 | |||
| 92 | # | ||
| 93 | # Get a list of all non-static and non transient fields of this class. If there are | ||
| 94 | # non, jni->GetFieldSignatures() returns an array of length 0. | ||
| 95 | # | ||
| 96 | fields_n_sigs := jni->GetFieldSignatures(p0, (JNI->ACC_STATIC|JNI->ACC_TRANSIENT)); | ||
| 97 | |||
| 98 | MyValueArray := array[4] of ref Value; | ||
| 99 | MyObjectArray := array[len fields_n_sigs.ary] of JObject; | ||
| 100 | |||
| 101 | # | ||
| 102 | # for each non-static and non-transient fields of this class... | ||
| 103 | # call constructor for ObjectStreamField as follows | ||
| 104 | # ObjectStreamField(n, sig, o, t) | ||
| 105 | # where n is field name, sig is first byte of field signature | ||
| 106 | # o is index into class field table and if sig != [ or L, | ||
| 107 | # t is NULL. If sig is [ or L, t is signature. | ||
| 108 | # For each of those constructors that are created, stuff them into | ||
| 109 | # an array entry. | ||
| 110 | # | ||
| 111 | for (i:=0; i < len fields_n_sigs.ary; i++) { | ||
| 112 | # | ||
| 113 | # Each entry in fields_n_sigs.ary is of the format <name> <sig> where name is | ||
| 114 | # the name of the field and signature is its full signature. Seperate them | ||
| 115 | # out and format a call instruction to call the constructor for ObjectStreamField. | ||
| 116 | # | ||
| 117 | (name, full_sig) := str_mod->splitl((fields_n_sigs.ary[i]).str, " "); | ||
| 118 | full_sig = full_sig[1:]; | ||
| 119 | |||
| 120 | MyValueArray[0] = ref Value.TObject(cast->FromJString(jni->NewString(name))); | ||
| 121 | MyValueArray[1] = ref Value.TChar(full_sig[0]); | ||
| 122 | # NOT offset of field in object (but does it matter)??? | ||
| 123 | MyValueArray[2] = ref Value.TInt(i); | ||
| 124 | if ((full_sig[0] == 'L') || (full_sig[0] == '[')) | ||
| 125 | MyValueArray[3] = ref Value.TObject(cast->FromJString(jni->NewString(full_sig))); | ||
| 126 | else | ||
| 127 | MyValueArray[3] = ref Value.TObject(nil); | ||
| 128 | |||
| 129 | jObj := jni->AllocObject(cl_data); | ||
| 130 | (ret, ok) := jni->CallMethod(jObj, "<init>", "(Ljava/lang/String;CILjava/lang/String;)V", MyValueArray); | ||
| 131 | if (ok != JNI->OK) | ||
| 132 | jni->FatalError("ObjectStreamClass could not create ObjectStreamField"); | ||
| 133 | # | ||
| 134 | # make an array of these created objects. | ||
| 135 | # | ||
| 136 | MyObjectArray[i] = jObj; | ||
| 137 | } | ||
| 138 | # | ||
| 139 | # Finally, return the full array. | ||
| 140 | # | ||
| 141 | jary := jni->MkAObject(MyObjectArray); | ||
| 142 | jary.class = cl_data; | ||
| 143 | return jary; | ||
| 144 | }#<< | ||
| 145 | |||
| 146 | getSerialVersionUID_rClass_J( p0 : JClass) : big | ||
| 147 | {#>> | ||
| 148 | ret : big; | ||
| 149 | val : ref Value; | ||
| 150 | val = jni->GetStaticField(p0.class, "serialVersionUID", "J"); | ||
| 151 | if (val != nil) | ||
| 152 | ret = val.Long(); | ||
| 153 | else | ||
| 154 | ret = big 0; | ||
| 155 | return ret; | ||
| 156 | }#<< | ||
| 157 | |||
| 158 | hasWriteObject_rClass_Z( p0 : JClass) : int | ||
| 159 | {#>> | ||
| 160 | if (jni->GetMethodFlags(p0, "writeObject (Ljava/io/ObjectOutputStream;)V") != 0) | ||
| 161 | return JNI->TRUE; | ||
| 162 | else | ||
| 163 | return JNI->FALSE; | ||
| 164 | }#<< | ||