JavaClassReader.st
author cg
Fri, 06 Feb 1998 01:56:01 +0000
changeset 318 8720093188f7
parent 278 9d0ed6e743da
child 327 990c71581df3
permissions -rw-r--r--
debugPrints
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
083530508d9c intitial checkin
cg
parents:
diff changeset
     1
Object subclass:#JavaClassReader
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
     2
	instanceVariableNames:'inStream msb constants majorVsn minorVsn constNeeds2Slots
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
     3
		constSlot'
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
     4
	classVariableNames:'Verbose Silent AbsolutelySilent LazyClassLoading
275
92b7ebb0b54c *** empty log message ***
cg
parents: 273
diff changeset
     5
		InvalidClassFormatSignal ClassLoaderQuerySignal'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
     6
	poolDictionaries:''
083530508d9c intitial checkin
cg
parents:
diff changeset
     7
	category:'Java-Support'
083530508d9c intitial checkin
cg
parents:
diff changeset
     8
!
083530508d9c intitial checkin
cg
parents:
diff changeset
     9
083530508d9c intitial checkin
cg
parents:
diff changeset
    10
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
    11
!JavaClassReader class methodsFor:'initialization'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    12
083530508d9c intitial checkin
cg
parents:
diff changeset
    13
initialize
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    14
    InvalidClassFormatSignal := Signal new mayProceed:true.
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    15
    InvalidClassFormatSignal notifierString:'class load failure'.
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    16
    InvalidClassFormatSignal nameClass:self message:#invalidClassFormatSignal.
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    17
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
    18
    Verbose := false. 
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
    19
    Silent := true.
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
    20
    AbsolutelySilent := false.
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
    21
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
    22
    LazyClassLoading := false. "/ true.
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    23
    ClassLoaderQuerySignal := QuerySignal new
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
    24
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
    25
    "
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
    26
     JavaClassReader initialize
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
    27
    "
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
    28
275
92b7ebb0b54c *** empty log message ***
cg
parents: 273
diff changeset
    29
    "Modified: / 27.1.1998 / 17:54:23 / cg"
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    30
! !
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    31
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    32
!JavaClassReader class methodsFor:'Signal constants'!
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    33
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    34
classLoaderQuerySignal
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    35
    ^ ClassLoaderQuerySignal
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    36
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    37
    "Created: 14.8.1997 / 19:56:03 / cg"
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    38
!
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    39
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    40
invalidClassFormatSignal
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    41
    ^ InvalidClassFormatSignal
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    42
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
    43
    "Created: 3.8.1997 / 18:17:21 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    44
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
    45
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
    46
!JavaClassReader class methodsFor:'debugging'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    47
083530508d9c intitial checkin
cg
parents:
diff changeset
    48
verbose:aBoolean
083530508d9c intitial checkin
cg
parents:
diff changeset
    49
    Verbose := aBoolean
083530508d9c intitial checkin
cg
parents:
diff changeset
    50
083530508d9c intitial checkin
cg
parents:
diff changeset
    51
    "
67
a72c949d86dd *** empty log message ***
cg
parents: 62
diff changeset
    52
     Java flushClasses.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    53
     JavaClassReader verbose:true
083530508d9c intitial checkin
cg
parents:
diff changeset
    54
     JavaClassReader verbose:false
083530508d9c intitial checkin
cg
parents:
diff changeset
    55
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
    56
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
    57
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
    58
!JavaClassReader class methodsFor:'file reading'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    59
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    60
loadClass:aClassName
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    61
    "reads a class, installs and returns it.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    62
     The classes string constants are resolved & <clinit> is called,
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    63
     if it implements it."
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    64
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    65
    |rslt loader|
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    66
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    67
    loader := ClassLoaderQuerySignal raise.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    68
    loader isNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
    69
	rslt := self loadClassLazy:aClassName ignoring:(Set new).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
    70
	rslt notNil ifTrue:[self postLoadActions].
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
    71
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
    72
	^ rslt
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    73
    ].
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    74
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    75
    ^ loader loadClass:aClassName
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    76
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    77
    "
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    78
     JavaClassReader loadClass:'awt/Component'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    79
     JavaClassReader loadClass:'awt/Button'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    80
     JavaClassReader loadClass:'browser/AddButton'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    81
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    82
     JavaClassReader loadClass:'java/lang/Object'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    83
     JavaClassReader loadClass:'java/lang/AbstractMethodError'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    84
     JavaClassReader loadClass:'java/lang/Thread'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    85
    "
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    86
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
    87
    "Created: / 15.4.1996 / 14:58:53 / cg"
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
    88
    "Modified: / 3.1.1998 / 22:36:13 / cg"
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    89
!
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    90
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
    91
loadClassLazy:aClassName ignoring:classesBeingLoaded
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
    92
    "private helper:
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
    93
      reads a class, installs and returns it.
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
    94
      The class is searched along the ClassPath.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    95
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    96
     This is a partial load (to load other classes):
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    97
     - The classes stringConstants are not fixed to be JavaStrings 
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    98
       (i.e they are still ST-Strings).
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
    99
     - The class is NOT initialized."
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   100
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   101
    |rslt clsName cls loadedClass|
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
   102
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   103
    (aClassName endsWith:';') ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   104
        ('oops - loading of ' , aClassName , ' attempted') printNL.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   105
        self halt:'should not happen'.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   106
        ^ nil
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   107
    ].
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   108
    (aClassName endsWith:'[]') ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   109
        ('oops - loading of ' , aClassName , ' attempted') printNL.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   110
        self halt:'should not happen'.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   111
        ^ nil
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   112
    ].
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   113
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
   114
    clsName := aClassName.
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
   115
    (clsName includes:$.) ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   116
        clsName := clsName asString copy replaceAll:$. with:$/
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
   117
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   118
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   119
    (classesBeingLoaded notNil and:[classesBeingLoaded includes:clsName]) ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   120
        ('oops - recursive load of ' , clsName , ' attempted') printNL.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   121
        self halt:'should not happen'.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   122
        ^ JavaUnresolvedClassConstant fullName:clsName
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   123
    ].
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   124
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   125
    (cls := Java at:clsName) notNil ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   126
        ('oops - ' , clsName , ' is already loaded') printNL.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   127
        self halt:clsName , ' is already loaded - should not happen'.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   128
        ^ cls
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   129
    ].
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   130
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   131
    classesBeingLoaded isNil ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   132
        loadedClass := Set with:clsName
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   133
    ] ifFalse:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   134
        loadedClass := Set withAll:classesBeingLoaded.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   135
        loadedClass add:clsName.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   136
    ].
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   137
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
   138
    Java classPath do:[:path |
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   139
        |nm p|
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   140
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   141
        p := path.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   142
        (p endsWith:Filename separator) ifFalse:[
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   143
            p := p , (Filename separator asString)
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   144
        ].
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   145
        (Array 
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   146
            with:clsName
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   147
            with:clsName asLowercase
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   148
            with:clsName asUppercase) 
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   149
        do:[:tryName |
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   150
            (nm := p , tryName , '.class') asFilename exists ifTrue:[
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   151
                (Java isExcludedFromClassPath:nm) ifFalse:[
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   152
                    rslt := self loadFileLazy:nm ignoring:loadedClass.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   153
                    rslt notNil ifTrue:[^ rslt].
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   154
                ]
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   155
            ].
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   156
        ]
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   157
    ].
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   158
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   159
    ('JAVA [info]: no file found for: ' , clsName) infoPrintCR.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   160
    ^ nil
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
   161
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   162
    "Modified: / 14.8.1997 / 11:38:42 / stefan"
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   163
    "Modified: / 6.2.1998 / 02:20:48 / cg"
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   164
!
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   165
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   166
loadFile:aFilename
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   167
    "reads a class from aFilename, installs and returns it.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   168
     The classes strings are fixed and its class-init function is called."
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   169
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   170
    self loadFileLazy:aFilename ignoring:(Set new).
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   171
    self postLoadActions
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   172
!
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   173
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   174
loadFileLazy:aFilename ignoring:classesBeingLoaded
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   175
    "reads a class from aFilename, installs and returns it.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   176
     Strings are fixed and classrefs are fixed, 
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   177
     but NO no class-init functions are called."
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   178
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   179
    |javaClass pool|
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   180
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   181
    javaClass := self readFile:aFilename ignoring:classesBeingLoaded.
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   182
    javaClass notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   183
	Java at:(javaClass fullName asSymbol) put:javaClass.
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   184
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   185
	classesBeingLoaded remove:javaClass fullName ifAbsent:nil.
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   186
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   187
	JavaUnresolvedConstant resolveFor:javaClass.
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   188
    ].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   189
    ^ javaClass
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   190
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   191
    "
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   192
     JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   193
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   194
     '/phys/ibm3/java/lib/java/lang' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   195
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   196
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   197
		('/phys/ibm3/java/lib/java/lang/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   198
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   199
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   200
	].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   201
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   202
     '/phys/ibm3/java/lib/java/io' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   203
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   204
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   205
		('/phys/ibm3/java/lib/java/io/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   206
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/io/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   207
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   208
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   209
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   210
     '/phys/ibm3/java/lib/java/net' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   211
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   212
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   213
		('/phys/ibm3/java/lib/java/net/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   214
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/net/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   215
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   216
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   217
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   218
     '/phys/ibm3/java/lib/java/util' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   219
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   220
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   221
		('/phys/ibm3/java/lib/java/util/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   222
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/util/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   223
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   224
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   225
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   226
     '/phys/ibm3/java/lib/java/awt' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   227
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   228
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   229
		('/phys/ibm3/java/lib/java/awt/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   230
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/awt/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   231
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   232
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   233
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   234
     '/phys/ibm3/java/lib/java/applet' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   235
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   236
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   237
		('/phys/ibm3/java/lib/java/applet/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   238
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/applet/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   239
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   240
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   241
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   242
     JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/AbstractMethodError.class'
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   243
     JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/Thread.class'
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   244
    "
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   245
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   246
    "Created: 15.4.1996 / 14:58:53 / cg"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   247
!
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   248
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   249
postLoadActions
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   250
    "Resolve all classes' string constants.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   251
     Perform all class initialization functions (of those which are not
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   252
     yet initialized)."
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   253
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   254
    ^ self postLoadActions:true
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   255
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   256
    "Modified: 15.8.1997 / 01:02:17 / cg"
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   257
!
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   258
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   259
postLoadActions:loadUnresolved
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   260
    "Resolve all classes' string constants.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   261
     Perform all class initialization functions 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   262
     (of those which are not yet initialized)."
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   263
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   264
    |classes prevUnresolved newUnresolved loader|
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   265
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   266
    "/ need at least java.lang.String, for valid constants
167
77dcbc4b2201 *** empty log message ***
cg
parents: 135
diff changeset
   267
    Java java_lang_String isNil ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   268
        self loadClassLazy:'java.lang.String' ignoring:(Set new).
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   269
    ].
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   270
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   271
    LazyClassLoading ifFalse:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   272
        loader := ClassLoaderQuerySignal raise.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   273
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   274
        prevUnresolved := nil.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   275
        newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   276
        loadUnresolved ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   277
            [prevUnresolved ~= newUnresolved] whileTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   278
                newUnresolved do:[:nextUnresolved |
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   279
                    |classURL|
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   280
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   281
                    (Java at:nextUnresolved) isNil ifTrue:[ "/ could have been loaded in the meantime
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   282
                        Silent ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   283
                            'loading unresolved: ' print. nextUnresolved printCR.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   284
                        ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   285
                        loader isNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   286
                            self
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   287
                                loadClassLazy:nextUnresolved
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   288
                                ignoring:(Set new).
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   289
                        ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   290
                            "/
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   291
                            "/ the aquired loader is a javaClassLoader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   292
                            "/ which expects an URL as arg.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   293
                            "/
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   294
                            "/ classURL := Java as_URL:('file:' , nextUnresolved asString , '.class').
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   295
                            "/ loader loadClass:classURL
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   296
                            loader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   297
                                perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   298
                                with:(Java as_String:(nextUnresolved asString)).
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   299
                        ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   300
                    ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   301
                ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   302
                prevUnresolved := newUnresolved.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   303
                newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   304
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   305
        ].
229
b91c9462ac83 *** empty log message ***
cg
parents: 225
diff changeset
   306
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   307
        newUnresolved size == 0 ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   308
            "/ nothing unresolved
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   309
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   310
            (classes := Java allClasses) notNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   311
                "/ init all new classes
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   312
                "/ fetch again - there could be new ones ...
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   313
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   314
                classes := Java allClasses.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   315
                classes do:[:aJavaClass |
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   316
                    aJavaClass isInitialized ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   317
                        Silent ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   318
                            'performing class initialization of ' print. aJavaClass fullName printCR.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   319
                        ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   320
                        aJavaClass classInit
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   321
                    ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   322
                ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   323
            ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   324
        ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   325
    ]
167
77dcbc4b2201 *** empty log message ***
cg
parents: 135
diff changeset
   326
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   327
    "Created: / 15.8.1997 / 01:01:44 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   328
    "Modified: / 7.1.1998 / 14:13:55 / cg"
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   329
!
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   330
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   331
readFile:aFilename ignoring:classesBeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   332
    "reads a class from aFilename and returns it.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   333
     The JavaClass is NOT installed as global and unresolved
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   334
     refs are NOT patched."
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   335
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   336
    |inStream javaClass|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   337
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   338
    Silent ifFalse:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   339
        'reading ' print. aFilename print. ' ...' printNL.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   340
    ].
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   341
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   342
    inStream := aFilename asFilename readStream.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   343
    inStream isNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   344
        ('JAVA [info]: no file: ' , aFilename) printCR.
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   345
        self halt.
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   346
        ^ nil
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   347
    ].
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   348
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   349
    javaClass := self new readStream:inStream ignoring:classesBeingLoaded.
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   350
    javaClass notNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   351
        javaClass setBinaryFilePath:(inStream pathName).
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   352
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   353
    inStream close.
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
   354
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   355
    AbsolutelySilent ifFalse:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   356
        '  ... loaded ' print. javaClass displayString printNL.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   357
    ].
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
   358
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   359
    ^ javaClass
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   360
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   361
    "Created: / 15.4.1996 / 14:58:53 / cg"
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   362
    "Modified: / 6.2.1998 / 02:20:58 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   363
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   364
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   365
readStream:aStream
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   366
    "reads a class from aStream and returns it.
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   367
     The JavaClass is installed as global.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   368
     If new classes are required to be loaded, a new standard loader
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   369
     is created."
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   370
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   371
    ^ self readStream:aStream loader:nil
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   372
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   373
    "Modified: 14.8.1997 / 19:51:50 / cg"
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   374
!
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   375
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   376
readStream:aStream ignoring:classesBeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   377
    "reads a class from aStream and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   378
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   379
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   380
    ^ self new readStream:aStream ignoring:classesBeingLoaded
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   381
083530508d9c intitial checkin
cg
parents:
diff changeset
   382
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   383
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   384
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   385
083530508d9c intitial checkin
cg
parents:
diff changeset
   386
    "Modified: 15.4.1996 / 15:01:30 / cg"
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   387
!
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   388
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   389
readStream:aStream loader:aClassLoader
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   390
    "reads a class from aStream and returns it.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   391
     The JavaClass is installed as global.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   392
     If new classes are required to be loaded, aClassLoader is
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   393
     asked to do it. If aClassLoader is nil, a new standard loader
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   394
     is created."
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   395
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   396
    ^ self
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   397
	readStream:aStream 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   398
	loader:aClassLoader 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   399
	loadUnresolved:true
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   400
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   401
    "Modified: 15.8.1997 / 01:00:35 / cg"
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   402
!
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   403
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   404
readStream:aStream loader:aClassLoader loadUnresolved:loadUnresolved
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   405
    "reads a class from aStream and returns it.
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   406
     The JavaClass is installed as global.
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   407
     If new classes are required to be loaded, aClassLoader is
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   408
     asked to do it. If aClassLoader is nil, a new standard loader
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   409
     is created."
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   410
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   411
    |javaClass|
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   412
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   413
    ClassLoaderQuerySignal answer:aClassLoader
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   414
    do:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   415
        javaClass := self readStream:aStream ignoring:(Set new).
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   416
        javaClass notNil ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   417
            self postLoadActions:loadUnresolved.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   418
            Java at:(javaClass fullName asSymbol) put:javaClass.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   419
            JavaUnresolvedConstant resolveFor:javaClass.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   420
        ].
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   421
    ].
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   422
    ^ javaClass
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   423
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   424
    "Created: / 15.8.1997 / 00:59:24 / cg"
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   425
    "Modified: / 23.1.1998 / 17:14:09 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   426
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
   427
083530508d9c intitial checkin
cg
parents:
diff changeset
   428
!JavaClassReader methodsFor:'file reading'!
083530508d9c intitial checkin
cg
parents:
diff changeset
   429
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   430
readClassFileIgnoring:classesbeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   431
    "reads a class from inStream and returns it.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   432
     The JavaClass is not installed as global and its constants
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   433
     (especially strings) may not be fully resolved."
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   434
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   435
    |magic 
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   436
     access_flags this_class this_class_index super_class super_class_index
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   437
     realSuperClass this_class_ref existingSuperClass
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   438
     fields interfaces staticFields nStatic
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   439
     jSuperClass loader|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   440
083530508d9c intitial checkin
cg
parents:
diff changeset
   441
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   442
    "/ read magic, determine byte order
083530508d9c intitial checkin
cg
parents:
diff changeset
   443
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   444
    msb := true.
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   445
    magic := inStream nextUnsignedLongMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   446
    magic = 16rCAFEBABE ifFalse:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   447
        magic = 16rBEBAFECA ifFalse:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   448
            InvalidClassFormatSignal raiseErrorString:'not a java class file'.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   449
            ^ nil
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   450
        ].
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   451
        msb := false.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   452
        Verbose ifTrue:[Transcript showCR:'file is lsb'].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   453
    ] ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   454
        Verbose ifTrue:[Transcript showCR:'file is msb'].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   455
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   456
083530508d9c intitial checkin
cg
parents:
diff changeset
   457
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   458
    "/ get version
083530508d9c intitial checkin
cg
parents:
diff changeset
   459
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   460
    minorVsn := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   461
    majorVsn := inStream nextUnsignedShortMSB:msb.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   462
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   463
    (majorVsn ~~ 45 or:[minorVsn ~~ 3]) ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   464
        Transcript show:'warning this file has version '; show:majorVsn; show:'.'; showCR:minorVsn. 
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   465
    ].
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   466
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   467
    Verbose ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   468
        Transcript show:'version = '; 
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   469
                   show:(majorVsn printString); 
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   470
                   show:'.';
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   471
                   showCR:(minorVsn printString).
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   472
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   473
083530508d9c intitial checkin
cg
parents:
diff changeset
   474
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   475
    "/ get constant pool
083530508d9c intitial checkin
cg
parents:
diff changeset
   476
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   477
    self readConstantPool.
083530508d9c intitial checkin
cg
parents:
diff changeset
   478
083530508d9c intitial checkin
cg
parents:
diff changeset
   479
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   480
    "/ access flags
083530508d9c intitial checkin
cg
parents:
diff changeset
   481
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   482
    access_flags := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   483
    this_class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   484
    super_class_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   485
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   486
    super_class_index == 0 ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   487
        super_class := nil
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   488
    ] ifFalse:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   489
        super_class := constants at:super_class_index.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   490
        existingSuperClass := Java classNamed:super_class fullName.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   491
        existingSuperClass notNil ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   492
            super_class := existingSuperClass
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   493
        ] ifFalse:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   494
            (super_class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   495
                Silent ifFalse:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   496
                    'load superClass: ' print. super_class fullName printCR.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   497
                ].
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   498
                loader := ClassLoaderQuerySignal raise.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   499
                loader isNil ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   500
                    existingSuperClass := self class 
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   501
                                        loadClassLazy:(super_class fullName)
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   502
                                        ignoring:classesbeingLoaded.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   503
                ] ifFalse:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   504
                    jSuperClass := loader
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   505
                                perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   506
                                with:(Java as_String:(super_class fullName)).
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   507
                    existingSuperClass := JavaVM classForJavaClassObject:jSuperClass.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   508
                ].
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   509
                existingSuperClass isNil ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   510
                    self halt:('cannot find superclass: ' , super_class fullName).
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   511
                ].
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   512
                super_class := existingSuperClass
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   513
            ] ifFalse:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   514
                self halt:'oops - superclass ?'
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   515
            ]
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   516
        ].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   517
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   518
083530508d9c intitial checkin
cg
parents:
diff changeset
   519
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   520
    "/ get interfaces
083530508d9c intitial checkin
cg
parents:
diff changeset
   521
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   522
    interfaces := self readInterfaces.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   523
083530508d9c intitial checkin
cg
parents:
diff changeset
   524
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   525
    "/ get fields
083530508d9c intitial checkin
cg
parents:
diff changeset
   526
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   527
    fields := self readFieldInfofields.
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   528
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   529
    "/
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   530
    "/ create the fields as instVars
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   531
    "/ static fields are created as class-InstVars
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   532
    "/
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   533
    staticFields := fields select:[:f | f isStatic].
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   534
    nStatic := staticFields size.
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   535
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   536
    this_class_ref := constants at:this_class_index.
182
5f85fd0fec56 checkin from browser
cg
parents: 177
diff changeset
   537
    this_class := JavaClass fullName:(this_class_ref fullName) numStatic:nStatic.
5f85fd0fec56 checkin from browser
cg
parents: 177
diff changeset
   538
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   539
    nStatic ~~ 0 ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   540
        fields := fields select:[:f | f isStatic not].
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   541
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   542
        JavaClass setInstanceVariableStringFromFields:staticFields in:this_class class.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   543
        this_class setStaticFields:staticFields.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   544
        this_class initializeStaticFields.
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   545
    ].
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   546
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   547
    this_class setAccessFlags:access_flags.
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   548
    this_class setSuperclass:super_class.
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   549
    this_class setConstantPool:constants.
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   550
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   551
    this_class setFields:fields.
110
dfb03e2ea321 *** empty log message ***
cg
parents: 104
diff changeset
   552
    this_class setInterfaces:interfaces.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   553
083530508d9c intitial checkin
cg
parents:
diff changeset
   554
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   555
    "/ get methods
083530508d9c intitial checkin
cg
parents:
diff changeset
   556
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   557
    self readMethodsFor:this_class.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   558
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   559
    self readAttributesFor:this_class.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   560
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   561
    constants owner:this_class.
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   562
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   563
    ^ this_class
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   564
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   565
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   566
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   567
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   568
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   569
     JavaClassReader verbose:true.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   570
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/ArithmeticException.class'
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   571
     JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/ArithmeticException.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   572
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   573
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   574
    "Created: / 15.4.1996 / 15:02:47 / cg"
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   575
    "Modified: / 23.1.1998 / 17:44:55 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   576
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   577
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   578
readSourceFileAttributeFor:aJavaClass
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   579
    |attribute_length sourceFile_index sourceFile|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   580
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   581
    attribute_length := inStream nextUnsignedLongMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   582
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   583
    sourceFile_index := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   584
    sourceFile := constants at:sourceFile_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   585
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   586
    aJavaClass setSourceFile:sourceFile.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   587
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   588
    Verbose ifTrue:[Transcript show:'sourceFile: '; showCR:sourceFile].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   589
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   590
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   591
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   592
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   593
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   594
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   595
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   596
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   597
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   598
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   599
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   600
readStream:aStream ignoring:classesBeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   601
    "reads a class from aStream and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   602
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   603
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   604
    inStream := aStream.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   605
    inStream binary.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   606
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   607
    ^ self readClassFileIgnoring:classesBeingLoaded
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   608
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   609
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   610
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   611
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   612
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   613
    "Created: 15.4.1996 / 15:00:55 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   614
    "Modified: 15.4.1996 / 15:06:18 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   615
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   616
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   617
!JavaClassReader methodsFor:'file reading - attributes'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   618
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   619
readAttribute:attributeName for:something
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   620
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   621
    (attributeName = 'Code') ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   622
	self readCodeAttributeFor:something.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   623
	^ true.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   624
    ].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   625
    (attributeName = 'Exceptions') ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   626
	self readExceptionsAttributeFor:something.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   627
	^ true.
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   628
    ].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   629
    (attributeName = 'LineNumberTable') ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   630
	self readLineNumberTableAttributeFor:something.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   631
	^ true.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   632
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   633
    (attributeName = 'LocalVariableTable') ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   634
	self readLocalVariableTableAttributeFor:something.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   635
	^ true.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   636
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   637
    (attributeName = 'ConstantValue') ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   638
	self readConstantValueAttributeFor:something.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   639
	^ true.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   640
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   641
    (attributeName = 'SourceFile') ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   642
	self readSourceFileAttributeFor:something.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   643
	^ true.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   644
    ].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   645
    (attributeName = 'Deprecated') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   646
	^ false.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   647
    ].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   648
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   649
    ('JAVA: unrecognized attribute: ' , attributeName) infoPrintCR.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   650
    ^ false
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   651
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   652
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   653
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   654
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   655
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   656
readAttributeFor:something
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   657
    |attribute_name_index attribute_name attribute_length attribute_info|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   658
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   659
    Verbose ifTrue:[Transcript show:'attrib at pos: '; showCR:inStream position].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   660
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   661
    attribute_name_index := inStream nextUnsignedShortMSB:msb.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   662
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   663
    "/
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   664
    "/ UNDOC feature ?
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   665
    "/
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   666
    attribute_name_index > constants size ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   667
	attribute_name_index == 16rb700 ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   668
	    self halt.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   669
	]
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   670
    ].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   671
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   672
    attribute_name := constants at:attribute_name_index.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   673
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   674
    Verbose ifTrue:[Transcript show:'attrib name: '; showCR:attribute_name].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   675
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   676
    (self readAttribute:attribute_name for:something) ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   677
	attribute_length := inStream nextUnsignedLongMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   678
	attribute_info := ByteArray new:(attribute_length).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   679
	inStream nextBytes:attribute_length into:attribute_info startingAt:1.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   680
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   681
	Verbose ifTrue:[Transcript show:'skipped '; show:attribute_name; showCR:'-attribute'].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   682
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   683
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   684
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   685
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   686
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   687
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   688
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   689
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   690
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   691
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   692
readAttributesFor:something
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   693
    |attributes_count|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   694
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   695
    attributes_count := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   696
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   697
    1 to:attributes_count do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   698
	self readAttributeFor:something.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   699
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   700
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   701
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   702
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   703
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   704
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   705
!JavaClassReader methodsFor:'file reading - constants'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   706
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   707
readConstant
083530508d9c intitial checkin
cg
parents:
diff changeset
   708
    |tag constReader const|
083530508d9c intitial checkin
cg
parents:
diff changeset
   709
083530508d9c intitial checkin
cg
parents:
diff changeset
   710
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   711
    constNeeds2Slots := false.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   712
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   713
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   714
    "/ get tag
083530508d9c intitial checkin
cg
parents:
diff changeset
   715
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   716
    tag := inStream nextByte.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   717
    Verbose ifTrue:[Transcript show:'tag = '; showCR:tag].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   718
083530508d9c intitial checkin
cg
parents:
diff changeset
   719
    constReader := #(
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   720
			readConstant_Asciz              "/ 1  - now called Utf8
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   721
			readConstant_Unicode            "/ 2
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   722
			readConstant_Integer            "/ 3
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   723
			readConstant_Float              "/ 4
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   724
			readConstant_Long               "/ 5
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   725
			readConstant_Double             "/ 6
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   726
			readConstant_Class              "/ 7
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   727
			readConstant_String             "/ 8
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   728
			readConstant_Fieldref           "/ 9
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   729
			readConstant_Methodref          "/ 10
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   730
			readConstant_InterfaceMethodref "/ 11
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   731
			readConstant_NameAndType        "/ 12
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   732
		    ) at:tag ifAbsent:[#readConstant_Undef].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   733
083530508d9c intitial checkin
cg
parents:
diff changeset
   734
    ^ self perform:constReader.
083530508d9c intitial checkin
cg
parents:
diff changeset
   735
083530508d9c intitial checkin
cg
parents:
diff changeset
   736
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   737
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   738
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   739
083530508d9c intitial checkin
cg
parents:
diff changeset
   740
    "Created: 15.4.1996 / 15:46:32 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   741
    "Modified: 15.4.1996 / 15:47:00 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   742
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   743
083530508d9c intitial checkin
cg
parents:
diff changeset
   744
readConstantPool
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   745
    |constantPoolCount const i|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   746
083530508d9c intitial checkin
cg
parents:
diff changeset
   747
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   748
    "/ get constant pool
083530508d9c intitial checkin
cg
parents:
diff changeset
   749
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   750
    constantPoolCount := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   751
    Verbose ifTrue:[Transcript show:'constantPoolCount = '; showCR:constantPoolCount].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   752
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   753
    constants := JavaConstantPool "Array" new:constantPoolCount-1.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   754
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   755
    constSlot := 1.
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   756
    [constSlot < constantPoolCount] whileTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   757
	Verbose ifTrue:[Transcript show:'const: '; showCR:constSlot].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   758
	const := self readConstant.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   759
	constants at:constSlot put:const.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   760
	constNeeds2Slots ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   761
	    constSlot := constSlot + 1.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   762
	].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   763
	constSlot := constSlot + 1.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   764
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   765
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   766
    constSlot := -1.
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   767
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   768
    "/ preresolve what can be (especially, strings are resolved here)
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   769
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   770
    1 to:constantPoolCount-1 do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   771
	|const value|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   772
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   773
	const := constants at:i.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   774
	const notNil ifTrue:[   "/ kludge for 2-slot constants (which only take 1 slot in ST/X)
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   775
	    (const isKindOf:JavaUnresolvedConstant) ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   776
		value := const preResolve.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   777
		value ~~ const ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   778
		    constants at:i put:value.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   779
		]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   780
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   781
	]
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   782
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   783
083530508d9c intitial checkin
cg
parents:
diff changeset
   784
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   785
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   786
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   787
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   788
083530508d9c intitial checkin
cg
parents:
diff changeset
   789
    "Created: 15.4.1996 / 15:14:11 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   790
    "Modified: 15.4.1996 / 16:41:57 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   791
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   792
083530508d9c intitial checkin
cg
parents:
diff changeset
   793
readConstant_Asciz
083530508d9c intitial checkin
cg
parents:
diff changeset
   794
    |len string|
083530508d9c intitial checkin
cg
parents:
diff changeset
   795
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   796
    len := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   797
    string := String new:len.
083530508d9c intitial checkin
cg
parents:
diff changeset
   798
    inStream nextBytes:len into:string startingAt:1.
083530508d9c intitial checkin
cg
parents:
diff changeset
   799
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   800
    Verbose ifTrue:[Transcript show:'asciz; string= ';     showCR:string].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   801
083530508d9c intitial checkin
cg
parents:
diff changeset
   802
    ^ string
083530508d9c intitial checkin
cg
parents:
diff changeset
   803
083530508d9c intitial checkin
cg
parents:
diff changeset
   804
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   805
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   806
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   807
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   808
083530508d9c intitial checkin
cg
parents:
diff changeset
   809
    "Created: 15.4.1996 / 15:15:35 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   810
    "Modified: 15.4.1996 / 16:33:45 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   811
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   812
083530508d9c intitial checkin
cg
parents:
diff changeset
   813
readConstant_Class
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   814
    |name_index name|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   815
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   816
    name_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   817
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   818
    Verbose ifTrue:[Transcript show:'class; index= '; showCR:name_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   819
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   820
    name := constants at:name_index.
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   821
    name notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   822
	Verbose ifTrue:[Transcript showCR:'name in constant_class already resolved'].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   823
	"/ self halt
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   824
    ].
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   825
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   826
    ^ JavaUnresolvedClassConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   827
	pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   828
	poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   829
	nameIndex:name_index
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   830
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   831
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   832
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   833
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   834
083530508d9c intitial checkin
cg
parents:
diff changeset
   835
    "Created: 15.4.1996 / 15:21:13 / cg"
193
859177de4b04 *** empty log message ***
cg
parents: 182
diff changeset
   836
    "Modified: 1.8.1997 / 21:27:28 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   837
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   838
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   839
readConstant_Double
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   840
    |high low aFloat|
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   841
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   842
    high := inStream nextUnsignedLongMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   843
    low := inStream nextUnsignedLongMSB:msb.
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   844
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   845
    aFloat := Float new.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   846
    UninterpretedBytes isBigEndian ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   847
	aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   848
	aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   849
	aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   850
	aFloat basicAt:4 put:(high bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   851
	aFloat basicAt:5 put:((low bitShift:-24) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   852
	aFloat basicAt:6 put:((low bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   853
	aFloat basicAt:7 put:((low bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   854
	aFloat basicAt:8 put:(low bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   855
    ] ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   856
	aFloat basicAt:1 put:(low bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   857
	aFloat basicAt:2 put:((low bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   858
	aFloat basicAt:3 put:((low bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   859
	aFloat basicAt:4 put:((low bitShift:-24) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   860
	aFloat basicAt:5 put:(high bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   861
	aFloat basicAt:6 put:((high bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   862
	aFloat basicAt:7 put:((high bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   863
	aFloat basicAt:8 put:((high bitShift:-24) bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   864
    ].
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   865
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   866
    constNeeds2Slots := true.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   867
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   868
    Verbose ifTrue:[Transcript show:'double; value= ';     showCR:aFloat].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   869
    ^ aFloat
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   870
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   871
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   872
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   873
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   874
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   875
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   876
    "Modified: 15.4.1996 / 15:42:16 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   877
    "Created: 15.4.1996 / 16:34:42 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   878
!
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   879
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   880
readConstant_Fieldref
083530508d9c intitial checkin
cg
parents:
diff changeset
   881
    |class_index name_and_type_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
   882
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   883
    class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   884
    name_and_type_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   885
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   886
    Verbose ifTrue:[Transcript show:'fieldref; classindex= ';     showCR:class_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   887
    Verbose ifTrue:[Transcript show:'fieldref; name&typeindex= '; showCR:name_and_type_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   888
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   889
    ^ JavaUnresolvedFieldrefConstant
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   890
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   891
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   892
		classIndex:class_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   893
		nameandTypeIndex:name_and_type_index
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   894
083530508d9c intitial checkin
cg
parents:
diff changeset
   895
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   896
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   897
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   898
083530508d9c intitial checkin
cg
parents:
diff changeset
   899
    "Created: 15.4.1996 / 15:22:18 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   900
    "Modified: 15.4.1996 / 16:07:01 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   901
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   902
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   903
readConstant_Float
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   904
    |high aFloat|
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   905
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   906
    high := inStream nextUnsignedLongMSB:msb.
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   907
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   908
    aFloat := ShortFloat basicNew.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   909
    UninterpretedBytes isBigEndian ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   910
	aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   911
	aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   912
	aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   913
	aFloat basicAt:4 put:(high bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   914
    ] ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   915
	aFloat basicAt:1 put:(high bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   916
	aFloat basicAt:2 put:((high bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   917
	aFloat basicAt:3 put:((high bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   918
	aFloat basicAt:4 put:((high bitShift:-24) bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   919
    ].
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   920
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   921
    Verbose ifTrue:[Transcript show:'float; value= ';     showCR:aFloat].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   922
    ^ aFloat
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   923
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   924
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   925
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   926
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   927
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   928
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   929
    "Modified: 15.4.1996 / 15:42:16 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   930
    "Created: 15.4.1996 / 16:34:42 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   931
!
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   932
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   933
readConstant_Integer
083530508d9c intitial checkin
cg
parents:
diff changeset
   934
    |value|
083530508d9c intitial checkin
cg
parents:
diff changeset
   935
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   936
    value := inStream nextLongMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   937
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   938
    Verbose ifTrue:[Transcript show:'integer; value= ';     showCR:value].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   939
083530508d9c intitial checkin
cg
parents:
diff changeset
   940
    ^ value
083530508d9c intitial checkin
cg
parents:
diff changeset
   941
083530508d9c intitial checkin
cg
parents:
diff changeset
   942
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   943
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   944
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   945
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   946
083530508d9c intitial checkin
cg
parents:
diff changeset
   947
    "Modified: 15.4.1996 / 15:42:16 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   948
    "Created: 15.4.1996 / 16:34:42 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   949
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   950
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   951
readConstant_InterfaceMethodref
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   952
    |class_index name_and_type_index|
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   953
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   954
    class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   955
    name_and_type_index := inStream nextUnsignedShortMSB:msb.
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   956
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   957
    Verbose ifTrue:[Transcript show:'methodref; classindex= ';     showCR:class_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   958
    Verbose ifTrue:[Transcript show:'methodref; name&typeindex= '; showCR:name_and_type_index].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   959
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   960
    ^ JavaUnresolvedInterfaceMethodrefConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   961
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   962
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   963
		classIndex:class_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   964
		nameandTypeIndex:name_and_type_index
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   965
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   966
    "
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   967
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   968
    "
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   969
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   970
    "Created: 15.4.1996 / 15:22:37 / cg"
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   971
    "Modified: 15.4.1996 / 16:07:19 / cg"
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   972
!
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   973
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   974
readConstant_Long
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   975
    |high low value|
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   976
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   977
    high := inStream nextUnsignedLongMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   978
    low := inStream nextUnsignedLongMSB:msb.
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   979
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   980
    value := (high bitShift:32) bitOr:low.
60
a763b1780ec0 checkin from browser
cg
parents: 59
diff changeset
   981
    (high bitTest:16r80000000) ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   982
	value := value - 16r10000000000000000.
60
a763b1780ec0 checkin from browser
cg
parents: 59
diff changeset
   983
    ].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   984
    constNeeds2Slots := true.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   985
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   986
    Verbose ifTrue:[Transcript show:'long; value= ';     showCR:value].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   987
    ^ value
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   988
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   989
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   990
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   991
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   992
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   993
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   994
    "Modified: 15.4.1996 / 15:42:16 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   995
    "Created: 15.4.1996 / 16:34:42 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   996
!
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   997
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   998
readConstant_Methodref
083530508d9c intitial checkin
cg
parents:
diff changeset
   999
    |class_index name_and_type_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1000
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1001
    class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1002
    name_and_type_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1003
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1004
    Verbose ifTrue:[Transcript show:'methodref; classindex= ';     showCR:class_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1005
    Verbose ifTrue:[Transcript show:'methodref; name&typeindex= '; showCR:name_and_type_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1006
083530508d9c intitial checkin
cg
parents:
diff changeset
  1007
    ^ JavaUnresolvedMethodrefConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1008
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1009
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1010
		classIndex:class_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1011
		nameandTypeIndex:name_and_type_index
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1012
083530508d9c intitial checkin
cg
parents:
diff changeset
  1013
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1014
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1015
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1016
083530508d9c intitial checkin
cg
parents:
diff changeset
  1017
    "Created: 15.4.1996 / 15:22:37 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1018
    "Modified: 15.4.1996 / 16:07:19 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1019
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1020
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1021
readConstant_NameAndType
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1022
    |name_index signature_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1023
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1024
    name_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1025
    signature_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1026
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1027
    Verbose ifTrue:[Transcript show:'methodref; nameindex= ';     showCR:name_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1028
    Verbose ifTrue:[Transcript show:'methodref; signatureindex= '; showCR:signature_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1029
083530508d9c intitial checkin
cg
parents:
diff changeset
  1030
    ^ JavaUnresolvedNameandTypeConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1031
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1032
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1033
		nameIndex:name_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1034
		signatureIndex:signature_index  
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1035
083530508d9c intitial checkin
cg
parents:
diff changeset
  1036
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1037
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1038
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1039
083530508d9c intitial checkin
cg
parents:
diff changeset
  1040
    "Created: 15.4.1996 / 15:23:43 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1041
    "Modified: 15.4.1996 / 16:17:16 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1042
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1043
083530508d9c intitial checkin
cg
parents:
diff changeset
  1044
readConstant_String
083530508d9c intitial checkin
cg
parents:
diff changeset
  1045
    |tag string_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1046
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1047
    string_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1048
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1049
    Verbose ifTrue:[Transcript show:'string; index= '; showCR:string_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1050
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1051
    ^ JavaUnresolvedStringConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1052
	pool:constants 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1053
	poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1054
	stringIndex:string_index
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1055
083530508d9c intitial checkin
cg
parents:
diff changeset
  1056
    "
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
  1057
     Verbose := true.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
  1058
     JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/System.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1059
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1060
083530508d9c intitial checkin
cg
parents:
diff changeset
  1061
    "Created: 15.4.1996 / 15:20:33 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1062
    "Modified: 15.4.1996 / 16:01:37 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1063
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1064
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1065
!JavaClassReader methodsFor:'file reading - fields'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1066
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1067
readConstantValueAttributeFor:aField
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1068
    |attribute_length constantvalue_index constantValue|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1069
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1070
    attribute_length := inStream nextUnsignedLongMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1071
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1072
    constantvalue_index := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1073
    constantValue := constants at:constantvalue_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1074
59
38114c3e3e77 checkin from browser
cg
parents: 54
diff changeset
  1075
    aField constantValue:constantValue.
38114c3e3e77 checkin from browser
cg
parents: 54
diff changeset
  1076
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1077
    Verbose ifTrue:[Transcript show:'constantValue: '; showCR:constantValue].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1078
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1079
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1080
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1081
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1082
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1083
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1084
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1085
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1086
    "Created: 15.4.1996 / 15:40:17 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1087
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1088
083530508d9c intitial checkin
cg
parents:
diff changeset
  1089
readFieldInfofield
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1090
    |access_flags name_index signature_index attributes_count field|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1091
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1092
    access_flags := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1093
    name_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1094
    signature_index := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1095
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1096
    field := JavaField new.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1097
    field setAccessFlags:access_flags.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1098
    field setName:(constants at:name_index).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1099
    field setSignature:(constants at:signature_index).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1100
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1101
    attributes_count := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1102
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
  1103
    Verbose ifTrue:[Transcript show:'  field name: '; show:(constants at:name_index);
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1104
			       show:' access: '; show:access_flags;
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1105
			       show:' attrib_cnt: '; showCR:attributes_count].
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
  1106
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1107
    1 to:attributes_count do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1108
	self readAttributeFor:field.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1109
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1110
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1111
    ^ field
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1112
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1113
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1114
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1115
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1116
083530508d9c intitial checkin
cg
parents:
diff changeset
  1117
    "Modified: 15.4.1996 / 15:33:28 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1118
    "Created: 15.4.1996 / 15:38:43 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1119
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1120
083530508d9c intitial checkin
cg
parents:
diff changeset
  1121
readFieldInfofields
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1122
    |nFields fields|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1123
083530508d9c intitial checkin
cg
parents:
diff changeset
  1124
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1125
    "/ get fieldInfos
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1126
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1127
    nFields := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1128
    Verbose ifTrue:[Transcript show:'fieldsCount = '; showCR:nFields].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1129
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1130
    fields := Array new:nFields.
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1131
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1132
    1 to:nFields do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1133
	Verbose ifTrue:[Transcript show:'field: '; showCR:i].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1134
	fields at:i put:(self readFieldInfofield)
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1135
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1136
    ^ fields
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1137
083530508d9c intitial checkin
cg
parents:
diff changeset
  1138
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1139
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1140
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1141
083530508d9c intitial checkin
cg
parents:
diff changeset
  1142
    "Created: 15.4.1996 / 15:34:41 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1143
    "Modified: 15.4.1996 / 15:35:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1144
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1145
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1146
!JavaClassReader methodsFor:'file reading - interfaces'!
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1147
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1148
readInterfaces
110
dfb03e2ea321 *** empty log message ***
cg
parents: 104
diff changeset
  1149
    |interfacesCount interface_index interface interfaces|
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1150
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1151
    "/
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1152
    "/ get interfaces
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1153
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1154
    interfacesCount := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1155
    Verbose ifTrue:[Transcript show:'interfacesCount = '; showCR:interfacesCount].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1156
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1157
    interfaces := Array new:interfacesCount.
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1158
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1159
    1 to:interfacesCount do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1160
	Verbose ifTrue:[Transcript show:'interface: '; showCR:i].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1161
	interface_index := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1162
	interface := constants at:interface_index.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1163
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1164
	interfaces at:i put:interface.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1165
    ].
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1166
    ^ interfaces
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1167
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1168
    "
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1169
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1170
    "
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1171
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1172
    "Created: 15.4.1996 / 15:31:59 / cg"
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1173
    "Modified: 15.4.1996 / 15:33:28 / cg"
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1174
! !
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1175
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1176
!JavaClassReader methodsFor:'file reading - methods'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1177
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1178
readCodeAttributeFor:aJavaMethod
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1179
    |attribute_length max_stack max_locals code_length code
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1180
     exception_table_length exception_table unknown1 unknown2|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1181
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1182
    attribute_length := inStream nextUnsignedLongMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1183
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1184
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1185
    Verbose ifTrue:[Transcript show:'attribute_length: 0x'; showCR:(attribute_length printStringRadix:16)].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1186
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
  1187
    minorVsn > 2 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1188
	unknown1 := inStream nextByte.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1189
	max_stack := inStream nextByte.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1190
	max_locals := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1191
	unknown2 := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1192
	Verbose ifTrue:[Transcript show:'?1: '; showCR:unknown1].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1193
	Verbose ifTrue:[Transcript show:'?2: '; showCR:unknown2].
39
20fa5af3b873 checkin from browser
cg
parents: 38
diff changeset
  1194
    ] ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1195
	max_stack := inStream nextByte.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1196
	max_locals := inStream nextByte.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1197
    ].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1198
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1199
    code_length := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1200
    Verbose ifTrue:[Transcript show:'code_length: '; showCR:(code_length printStringRadix:16)].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1201
    Verbose ifTrue:[Transcript show:'code at pos: '; showCR:inStream position].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1202
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1203
    code := ByteArray new:code_length.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1204
    inStream nextBytes:code_length into:code startingAt:1.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1205
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1206
    Verbose ifTrue:[Transcript show:'method code:'; showCR:code.].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1207
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1208
    exception_table_length := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1209
    Verbose ifTrue:[Transcript show:'exception_table_length: '; showCR:(exception_table_length printStringRadix:16)].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1210
    exception_table_length ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1211
	Verbose ifTrue:[Transcript show:'exceptionTable length:'; showCR:exception_table_length.].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1212
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1213
	exception_table := Array new:exception_table_length.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1214
	1 to:exception_table_length do:[:i |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1215
	    |start_pc end_pc handler_pc catch_type|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1216
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1217
	    start_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1218
	    end_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1219
	    handler_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1220
	    catch_type := constants at:(inStream nextUnsignedShortMSB:msb).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1221
	    exception_table at:i put:(JavaExceptionTableEntry
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1222
					    startPC:start_pc
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1223
					    endPC:end_pc
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1224
					    handlerPC:handler_pc
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1225
					    catchType:catch_type).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1226
	].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1227
	aJavaMethod setExceptionHandlerTable:exception_table.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1228
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1229
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  1230
    aJavaMethod 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1231
	setCode:code 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1232
	maxStack:max_stack 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1233
	maxLocals:max_locals 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1234
	u1:unknown1 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1235
	u2:unknown2.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1236
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1237
    self readAttributesFor:aJavaMethod.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1238
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1239
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1240
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1241
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1242
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1243
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1244
083530508d9c intitial checkin
cg
parents:
diff changeset
  1245
    "Modified: 15.4.1996 / 15:33:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1246
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1247
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1248
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1249
readExceptionsAttributeFor:aJavaMethod
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1250
    |attribute_length exception_table_length exception_table|
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1251
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1252
    attribute_length := inStream nextUnsignedLongMSB:msb.
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1253
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1254
    exception_table_length := inStream nextUnsignedShortMSB:msb.
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1255
    exception_table_length ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1256
	exception_table := Array new:exception_table_length.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1257
	1 to:exception_table_length do:[:i |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1258
	    |idx ex|
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1259
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1260
	    idx := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1261
	    ex := constants at:idx.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1262
	    exception_table at:i put:ex.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1263
	].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1264
    ].
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1265
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1266
    Verbose ifTrue:[Transcript showCR:'method has an exceptionTable'].
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1267
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1268
    aJavaMethod setExceptionTable:exception_table.
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1269
    ^ true
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1270
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1271
    "Modified: 15.4.1996 / 15:33:28 / cg"
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1272
    "Created: 15.4.1996 / 15:40:17 / cg"
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1273
!
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1274
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1275
readLineNumberTableAttributeFor:aJavaMethod
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1276
    |attribute_length line_number_table_length line_number_table|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1277
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1278
    attribute_length := inStream nextUnsignedLongMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1279
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1280
    line_number_table_length := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1281
    line_number_table_length ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1282
	line_number_table := Array new:line_number_table_length.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1283
	1 to:line_number_table_length do:[:i |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1284
	    |start_pc line_number|
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1285
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1286
	    start_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1287
	    line_number := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1288
	    line_number_table at:i put:(start_pc -> line_number).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1289
	].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1290
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1291
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1292
    Verbose ifTrue:[Transcript showCR:'method has a lineNumberTable'].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1293
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1294
    aJavaMethod setLineNumberTable:line_number_table.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1295
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1296
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1297
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1298
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1299
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1300
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1301
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1302
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1303
    "Created: 15.4.1996 / 15:40:17 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1304
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1305
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1306
readLocalVariableTableAttributeFor:aJavaMethod
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1307
    |attribute_length local_variable_table_length local_variable_table|
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1308
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1309
    attribute_length := inStream nextUnsignedLongMSB:msb.
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1310
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1311
    local_variable_table_length := inStream nextUnsignedShortMSB:msb.
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1312
    local_variable_table_length ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1313
	local_variable_table := JavaLocalVariableTable new:local_variable_table_length.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1314
	1 to:local_variable_table_length do:[:i |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1315
	    |start_pc length name_index sig_index slot name signature|
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1316
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1317
	    start_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1318
	    length := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1319
	    name_index := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1320
	    name := constants at:name_index.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1321
	    sig_index := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1322
	    signature := constants at:sig_index.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1323
	    slot := inStream nextUnsignedShortMSB:msb.
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1324
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1325
	    local_variable_table at:i put:(JavaLocalVariableTableEntry new 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1326
						startPC:start_pc 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1327
						length:length
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1328
						name:name
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1329
						signature:signature
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1330
						slot:slot)
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1331
	].
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1332
    ].
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1333
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1334
    Verbose ifTrue:[Transcript showCR:'method has a localvariableTable'].
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1335
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1336
    aJavaMethod setLocalVariableTable:local_variable_table.
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1337
    ^ true
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1338
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1339
    "
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1340
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1341
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class'
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1342
    "
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1343
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1344
    "Modified: 15.4.1996 / 15:33:28 / cg"
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1345
    "Created: 15.4.1996 / 15:40:17 / cg"
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1346
!
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1347
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1348
readMethodFor:aJavaClass
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1349
    |m access_flags name_index name signature_index signature
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1350
     tooManyArgs|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1351
083530508d9c intitial checkin
cg
parents:
diff changeset
  1352
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
  1353
    "/ get a method
083530508d9c intitial checkin
cg
parents:
diff changeset
  1354
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1355
    access_flags := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1356
    name_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1357
    signature_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1358
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1359
    name := constants at:name_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1360
    signature := constants at:signature_index.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1361
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1362
    Verbose ifTrue:[Transcript show:'method name:'; showCR:name.
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1363
                    Transcript show:'signature:'; showCR:signature.].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1364
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1365
    m := JavaMethod new.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1366
    m setAccessFlags:access_flags.
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1367
    tooManyArgs := false.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1368
    Method argumentSignal handle:[:ex |
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1369
        'JAVA: ***** java method has too many arguments - will fail to execute' infoPrintCR.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1370
        tooManyArgs := true.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1371
        ex proceed.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1372
    ] do:[
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1373
        m setName:name signature:signature.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1374
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1375
    m setJavaClass:aJavaClass.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1376
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1377
    self readAttributesFor:m.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1378
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1379
    tooManyArgs ifTrue:[
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1380
        m code:nil.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1381
        m byteCode:nil.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1382
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1383
    aJavaClass addMethod:m name:name signature:signature.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1384
083530508d9c intitial checkin
cg
parents:
diff changeset
  1385
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1386
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1387
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1388
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1389
    "Created: / 15.4.1996 / 16:48:49 / cg"
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1390
    "Modified: / 27.1.1998 / 17:46:53 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1391
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1392
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1393
readMethodsFor:aJavaClass
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1394
    |methodsCount method|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1395
083530508d9c intitial checkin
cg
parents:
diff changeset
  1396
083530508d9c intitial checkin
cg
parents:
diff changeset
  1397
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
  1398
    "/ get methods
083530508d9c intitial checkin
cg
parents:
diff changeset
  1399
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1400
    methodsCount := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1401
    Verbose ifTrue:[Transcript show:'methodsCount = '; showCR:methodsCount].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1402
083530508d9c intitial checkin
cg
parents:
diff changeset
  1403
    1 to:methodsCount do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1404
	Verbose ifTrue:[Transcript show:'method: '; showCR:i].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1405
	method := self readMethodFor:aJavaClass
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1406
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1407
083530508d9c intitial checkin
cg
parents:
diff changeset
  1408
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1409
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1410
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1411
083530508d9c intitial checkin
cg
parents:
diff changeset
  1412
    "Modified: 15.4.1996 / 15:33:28 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1413
    "Created: 15.4.1996 / 16:46:30 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1414
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
  1415
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
  1416
!JavaClassReader class methodsFor:'documentation'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1417
083530508d9c intitial checkin
cg
parents:
diff changeset
  1418
version
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
  1419
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.56 1998/02/06 01:55:46 cg Exp $'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1420
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
  1421
JavaClassReader initialize!