Showing the changes to java/pkg/java (8 of 10 files). Show all
Unified · Split
| @@ -0,0 +1,86 @@ | |||
| 1 | implement ClassLoader_L; | ||
| 2 | |||
| 3 | # javal v1.2 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 | JObject : import jni; | ||
| 23 | |||
| 24 | #>> extra pre includes here | ||
| 25 | |||
| 26 | #<< | ||
| 27 | |||
| 28 | include "ClassLoader_L.m"; | ||
| 29 | |||
| 30 | #>> extra post includes here | ||
| 31 | |||
| 32 | #<< | ||
| 33 | |||
| 34 | init( jni_p : JNI ) | ||
| 35 | { | ||
| 36 | # save java native inteface mod instance | ||
| 37 | jni = jni_p; | ||
| 38 | #>>extra initialization here | ||
| 39 | #<< | ||
| 40 | } | ||
| 41 | |||
| 42 | init_V( this : ref ClassLoader_obj) | ||
| 43 | {#>> | ||
| 44 | junk := this; | ||
| 45 | }#<< | ||
| 46 | |||
| 47 | defineClass0_rString_aB_I_I_rClass( this : ref ClassLoader_obj, p0 : JString,p1 : JArrayB,p2 : int,p3 : int) : JClass | ||
| 48 | {#>> | ||
| 49 | junk := (this,p0,p1,p2,p3); | ||
| 50 | jni->ThrowException( "java.lang.ClassNotFoundException", "not implemented" ); | ||
| 51 | return( nil ); | ||
| 52 | }#<< | ||
| 53 | |||
| 54 | resolveClass0_rClass_V( this : ref ClassLoader_obj, p0 : JClass) | ||
| 55 | {#>> | ||
| 56 | junk := (this,p0); | ||
| 57 | jni->FatalError( "resolveClass() not implemented" ); | ||
| 58 | }#<< | ||
| 59 | |||
| 60 | findSystemClass0_rString_rClass( this : ref ClassLoader_obj, p0 : JString) : JClass | ||
| 61 | {#>> | ||
| 62 | junk := (this,p0); | ||
| 63 | jni->FatalError( "findSystemClass() not implemented" ); | ||
| 64 | return( nil ); | ||
| 65 | }#<< | ||
| 66 | |||
| 67 | getSystemResourceAsStream0_rString_rInputStream( p0 : JString) : JObject | ||
| 68 | {#>> | ||
| 69 | junk := p0; | ||
| 70 | jni->FatalError( "getSystemResourceAsStream() not implemented" ); | ||
| 71 | return( nil ); | ||
| 72 | }#<< | ||
| 73 | |||
| 74 | getSystemResourceAsName0_rString_rString( p0 : JString) : JString | ||
| 75 | {#>> | ||
| 76 | junk := p0; | ||
| 77 | jni->FatalError( "getSystemResourceAsName() not implemented" ); | ||
| 78 | return( nil ); | ||
| 79 | }#<< | ||
| 80 | |||
| 81 | registerNatives_V( ) | ||
| 82 | {#>> | ||
| 83 | # currently empty... | ||
| 84 | }#<< | ||
| 85 | |||
| 86 | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # javal v1.2 generated file: edit with care | ||
| 2 | |||
| 3 | ClassLoader_L : module | ||
| 4 | { | ||
| 5 | ClassLoader_obj : adt | ||
| 6 | { | ||
| 7 | cl_mod : ClassModule; | ||
| 8 | initialized : int; | ||
| 9 | classes : JObject; | ||
| 10 | }; | ||
| 11 | |||
| 12 | init : fn( jni_p : JNI ); | ||
| 13 | init_V : fn( this : ref ClassLoader_obj); | ||
| 14 | defineClass0_rString_aB_I_I_rClass : fn( this : ref ClassLoader_obj, p0 : JString,p1 : JArrayB,p2 : int,p3 : int) : JClass; | ||
| 15 | resolveClass0_rClass_V : fn( this : ref ClassLoader_obj, p0 : JClass); | ||
| 16 | findSystemClass0_rString_rClass : fn( this : ref ClassLoader_obj, p0 : JString) : JClass; | ||
| 17 | getSystemResourceAsStream0_rString_rInputStream : fn( p0 : JString) : JObject; | ||
| 18 | getSystemResourceAsName0_rString_rString : fn( p0 : JString) : JString; | ||
| 19 | registerNatives_V : fn( ); | ||
| 20 | |||
| 21 | }; | ||
| @@ -50,9 +50,10 @@ init( jni_p : JNI ) · 49 unmodified lines | |||
| 50 | #<< | 50 | #<< |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | forName_rString_rClass( p0 : JString) : JClass | 53 | forName0_rString_Z_rClassLoader_rClass( p0 : JString, p1 : int, p2 : JObject ) : JClass |
| 54 | {#>> | 54 | {#>> |
| 55 | { | 55 | { |
| 56 | jni->sys->print("forName called for class %s\n", p0.str); | ||
| 56 | if ( p0.str != nil && p0.str[0] == '[' ) | 57 | if ( p0.str != nil && p0.str[0] == '[' ) |
| 57 | return( jni->LookupArrayClass(p0.str) ); | 58 | return( jni->LookupArrayClass(p0.str) ); |
| 58 | else | 59 | else |
| @@ -138,7 +139,7 @@ getName0_rString( this : JClass) : JString · 79 unmodified lines | |||
| 138 | return( jni->NewString( name ) ); | 139 | return( jni->NewString( name ) ); |
| 139 | }#<< | 140 | }#<< |
| 140 | 141 | ||
| 141 | getClassLoader_rClassLoader( this : JClass) : JObject | 142 | getClassLoader0_rClassLoader( this : JClass) : JObject |
| 142 | {#>> | 143 | {#>> |
| 143 | junk := (this); | 144 | junk := (this); |
| 144 | jni->FatalError( "getClassLoader() not implemented" ); | 145 | jni->FatalError( "getClassLoader() not implemented" ); |
| @@ -781,6 +782,5 @@ splitSignature(sig : string) : (string, string) · 636 unmodified lines | |||
| 781 | registerNatives_V( ) | 782 | registerNatives_V( ) |
| 782 | {#>> | 783 | {#>> |
| 783 | # currently empty... | 784 | # currently empty... |
| 784 | jni->sys->print( "Debug pring: registerNatives called\n" ); | ||
| 785 | }#<< | 785 | }#<< |
| 786 | 786 | ||
| @@ -4,7 +4,7 @@ Class_L : module · 3 unmodified lines | |||
| 4 | { | 4 | { |
| 5 | 5 | ||
| 6 | init : fn( jni_p : JNI ); | 6 | init : fn( jni_p : JNI ); |
| 7 | forName_rString_rClass : fn( p0 : JString) : JClass; | 7 | forName0_rString_Z_rClassLoader_rClass : fn( p0 : JString, p1 : int, p2 : JObject ) : JClass; |
| 8 | newInstance_rObject : fn( this : JClass) : JObject; | 8 | newInstance_rObject : fn( this : JClass) : JObject; |
| 9 | isInstance_rObject_Z : fn( this : JClass, p0 : JObject) : int; | 9 | isInstance_rObject_Z : fn( this : JClass, p0 : JObject) : int; |
| 10 | isAssignableFrom_rClass_Z : fn( this : JClass, p0 : JClass) : int; | 10 | isAssignableFrom_rClass_Z : fn( this : JClass, p0 : JClass) : int; |
| @@ -12,7 +12,7 @@ Class_L : module · 1 unmodified line | |||
| 12 | isArray_Z : fn( this : JClass) : int; | 12 | isArray_Z : fn( this : JClass) : int; |
| 13 | isPrimitive_Z : fn( this : JClass) : int; | 13 | isPrimitive_Z : fn( this : JClass) : int; |
| 14 | getName0_rString : fn( this : JClass) : JString; | 14 | getName0_rString : fn( this : JClass) : JString; |
| 15 | getClassLoader_rClassLoader : fn( this : JClass) : JObject; | 15 | getClassLoader0_rClassLoader : fn( this : JClass) : JObject; |
| 16 | getSuperclass_rClass : fn( this : JClass) : JClass; | 16 | getSuperclass_rClass : fn( this : JClass) : JClass; |
| 17 | getInterfaces_aClass : fn( this : JClass) : JArrayJClass; | 17 | getInterfaces_aClass : fn( this : JClass) : JArrayJClass; |
| 18 | getComponentType_rClass : fn( this : JClass) : JClass; | 18 | getComponentType_rClass : fn( this : JClass) : JClass; |
| @@ -73,5 +73,5 @@ wait_J_V( this : JObject, p0 : big) · 72 unmodified lines | |||
| 73 | registerNatives_V( ) | 73 | registerNatives_V( ) |
| 74 | {#>> | 74 | {#>> |
| 75 | # currently empty... | 75 | # currently empty... |
| 76 | # don't actually know what to do here | ||
| 77 | }#<< | 76 | }#<< |
| 77 | |||
| @@ -10,5 +10,5 @@ Object_L : module · 9 unmodified lines | |||
| 10 | notifyAll_V : fn( this : JObject ); | 10 | notifyAll_V : fn( this : JObject ); |
| 11 | wait_J_V : fn( this : JObject, p0 : big); | 11 | wait_J_V : fn( this : JObject, p0 : big); |
| 12 | registerNatives_V : fn( ); | 12 | registerNatives_V : fn( ); |
| 13 | 13 | ||
| 14 | }; | 14 | }; |
| @@ -0,0 +1,138 @@ | |||
| 1 | implement System_L; | ||
| 2 | |||
| 3 | # javal v1.2 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 | JObject : import jni; | ||
| 23 | |||
| 24 | #>> extra pre includes here | ||
| 25 | |||
| 26 | #<< | ||
| 27 | |||
| 28 | include "System_L.m"; | ||
| 29 | |||
| 30 | #>> extra post includes here | ||
| 31 | include "workdir.m"; | ||
| 32 | |||
| 33 | cast : Cast; | ||
| 34 | system_class : JNI->ClassData; # java.lang.System class data | ||
| 35 | |||
| 36 | #<< | ||
| 37 | |||
| 38 | init( jni_p : JNI ) | ||
| 39 | { | ||
| 40 | # save java native inteface mod instance | ||
| 41 | jni = jni_p; | ||
| 42 | #>>extra initialization here | ||
| 43 | system_class = jni->FindClass( "java/lang/System" ); | ||
| 44 | if ( system_class == nil ) | ||
| 45 | jni->InitError( "System_L.init(): failed to find System class" ); | ||
| 46 | |||
| 47 | # we Cast in this module | ||
| 48 | cast = jni->CastMod(); | ||
| 49 | #<< | ||
| 50 | } | ||
| 51 | |||
| 52 | setIn0_rInputStream_V( p0 : JObject) | ||
| 53 | {#>> | ||
| 54 | Value : import JNI; | ||
| 55 | val := ref Value.TObject(p0); | ||
| 56 | jni->SetStaticField( system_class, "in", val ); | ||
| 57 | }#<< | ||
| 58 | |||
| 59 | setOut0_rPrintStream_V( p0 : JObject) | ||
| 60 | {#>> | ||
| 61 | Value : import JNI; | ||
| 62 | val := ref Value.TObject(p0); | ||
| 63 | jni->SetStaticField( system_class, "out", val ); | ||
| 64 | }#<< | ||
| 65 | |||
| 66 | setErr0_rPrintStream_V( p0 : JObject) | ||
| 67 | {#>> | ||
| 68 | Value : import JNI; | ||
| 69 | val := ref Value.TObject(p0); | ||
| 70 | jni->SetStaticField( system_class, "err", val ); | ||
| 71 | }#<< | ||
| 72 | |||
| 73 | currentTimeMillis_J( ) : big | ||
| 74 | {#>> | ||
| 75 | fd := jni->sys->open("#c/time", jni->sys->OREAD); | ||
| 76 | if(fd == nil) | ||
| 77 | return big 0; | ||
| 78 | buf := array[128] of byte; | ||
| 79 | n := jni->sys->read(fd, buf, len buf); | ||
| 80 | if(n < 0) | ||
| 81 | return big 0; | ||
| 82 | |||
| 83 | return ( (big string buf[:n]) / big 1000 ); | ||
| 84 | }#<< | ||
| 85 | |||
| 86 | arraycopy_rObject_I_rObject_I_I_V( p0 : JObject,p1 : int,p2 : JObject,p3 : int,p4 : int) | ||
| 87 | {#>> | ||
| 88 | jni->jldr->arraycopy( cast->ToJArray(p0), p1, cast->ToJArray(p2), p3, p4 ); | ||
| 89 | }#<< | ||
| 90 | |||
| 91 | identityHashCode_rObject_I( p0 : JObject) : int | ||
| 92 | {#>> | ||
| 93 | return( jni->IdentityHash(p0) ); | ||
| 94 | }#<< | ||
| 95 | |||
| 96 | GetUserName_rString( ) : JString | ||
| 97 | {#>> | ||
| 98 | # return the current inferno user | ||
| 99 | # name as a Java String | ||
| 100 | # | ||
| 101 | user_name : string; | ||
| 102 | |||
| 103 | fd := jni->sys->open("#c/user", jni->sys->OREAD); | ||
| 104 | if(fd == nil) | ||
| 105 | user_name = "unknown"; | ||
| 106 | else { | ||
| 107 | buf := array[128] of byte; | ||
| 108 | n := jni->sys->read(fd, buf, len buf); | ||
| 109 | if(n < 0) | ||
| 110 | user_name = "unknown"; | ||
| 111 | else | ||
| 112 | user_name = string buf[:n]; | ||
| 113 | } | ||
| 114 | |||
| 115 | # make java string from user name | ||
| 116 | return( jni->NewString( user_name ) ); | ||
| 117 | }#<< | ||
| 118 | |||
| 119 | GetCWD_rString( ) : JString | ||
| 120 | {#>> | ||
| 121 | # return the current working directory | ||
| 122 | # as a Java String | ||
| 123 | # | ||
| 124 | # this fct is really only called once so | ||
| 125 | # just load Workdir right here | ||
| 126 | wdir := load Workdir Workdir->PATH; | ||
| 127 | if ( wdir == nil ) | ||
| 128 | jni->InitError( jni->sys->sprint( "java.lang.System: could not load %s: %r", Workdir->PATH ) ); | ||
| 129 | |||
| 130 | return( jni->NewString( wdir->init() ) ); | ||
| 131 | }#<< | ||
| 132 | |||
| 133 | registerNatives_V( ) | ||
| 134 | {#>> | ||
| 135 | # currently empty... | ||
| 136 | }#<< | ||
| 137 | |||
| 138 | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | # javal v1.2 generated file: edit with care | ||
| 2 | |||
| 3 | System_L : module | ||
| 4 | { | ||
| 5 | System_obj : adt | ||
| 6 | { | ||
| 7 | cl_mod : ClassModule; | ||
| 8 | }; | ||
| 9 | |||
| 10 | init : fn( jni_p : JNI ); | ||
| 11 | setIn0_rInputStream_V : fn( p0 : JObject); | ||
| 12 | setOut0_rPrintStream_V : fn( p0 : JObject); | ||
| 13 | setErr0_rPrintStream_V : fn( p0 : JObject); | ||
| 14 | currentTimeMillis_J : fn( ) : big; | ||
| 15 | arraycopy_rObject_I_rObject_I_I_V : fn( p0 : JObject,p1 : int,p2 : JObject,p3 : int,p4 : int); | ||
| 16 | identityHashCode_rObject_I : fn( p0 : JObject) : int; | ||
| 17 | GetUserName_rString : fn( ) : JString; | ||
| 18 | GetCWD_rString : fn( ) : JString; | ||
| 19 | registerNatives_V : fn( ); | ||
| 20 | |||
| 21 | }; | ||