JavaClassReader.st
author cg
Tue, 12 May 1998 20:25:02 +0000
changeset 353 666b33cfc98f
parent 352 9093171ef0a6
child 355 9452f8876652
permissions -rw-r--r--
*** empty log message ***
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
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    46
!JavaClassReader class methodsFor:'constants'!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    47
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    48
fileMajorVersion
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    49
    ^ 45
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    50
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    51
    "Modified: / 7.5.1998 / 13:14:27 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    52
    "Created: / 7.5.1998 / 13:16:35 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    53
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    54
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    55
fileMinorVersion
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    56
    ^ 3
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    57
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    58
    "Modified: / 7.5.1998 / 13:14:27 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    59
    "Created: / 7.5.1998 / 13:16:40 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    60
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    61
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    62
magic_LSB
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    63
    ^ 16rBEBAFECA
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    64
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    65
    "Modified: / 7.5.1998 / 13:14:27 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    66
    "Created: / 7.5.1998 / 13:15:05 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    67
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    68
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    69
magic_MSB
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    70
    ^ 16rCAFEBABE
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    71
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    72
    "Modified: / 7.5.1998 / 13:14:27 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    73
! !
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
    74
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
    75
!JavaClassReader class methodsFor:'debugging'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    76
083530508d9c intitial checkin
cg
parents:
diff changeset
    77
verbose:aBoolean
083530508d9c intitial checkin
cg
parents:
diff changeset
    78
    Verbose := aBoolean
083530508d9c intitial checkin
cg
parents:
diff changeset
    79
083530508d9c intitial checkin
cg
parents:
diff changeset
    80
    "
67
a72c949d86dd *** empty log message ***
cg
parents: 62
diff changeset
    81
     Java flushClasses.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    82
     JavaClassReader verbose:true
083530508d9c intitial checkin
cg
parents:
diff changeset
    83
     JavaClassReader verbose:false
083530508d9c intitial checkin
cg
parents:
diff changeset
    84
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
    85
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
    86
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
    87
!JavaClassReader class methodsFor:'file reading'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    88
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    89
loadClass:aClassName
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    90
    "reads a class, installs and returns it.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    91
     The classes string constants are resolved & <clinit> is called,
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
    92
     if it implements it."
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    93
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    94
    |rslt loader|
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
    95
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    96
    loader := ClassLoaderQuerySignal raise.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
    97
    loader isNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
    98
	rslt := self loadClassLazy:aClassName ignoring:(Set new).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
    99
	rslt notNil ifTrue:[self postLoadActions].
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   100
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   101
	^ rslt
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   102
    ].
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   103
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   104
    ^ loader loadClass:aClassName
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   105
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   106
    "
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   107
     JavaClassReader loadClass:'awt/Component'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   108
     JavaClassReader loadClass:'awt/Button'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   109
     JavaClassReader loadClass:'browser/AddButton'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   110
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   111
     JavaClassReader loadClass:'java/lang/Object'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   112
     JavaClassReader loadClass:'java/lang/AbstractMethodError'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   113
     JavaClassReader loadClass:'java/lang/Thread'
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   114
    "
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   115
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   116
    "Created: / 15.4.1996 / 14:58:53 / cg"
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   117
    "Modified: / 3.1.1998 / 22:36:13 / cg"
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   118
!
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   119
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   120
loadClassLazy:aClassName ignoring:classesBeingLoaded
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   121
    "private helper:
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   122
      reads a class, installs and returns it.
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   123
      The class is searched along the ClassPath.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   124
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   125
     This is a partial load (to load other classes):
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   126
     - The classes stringConstants are not fixed to be JavaStrings 
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   127
       (i.e they are still ST-Strings).
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   128
     - The class is NOT initialized."
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   129
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   130
    |rslt clsName cls loadedClass|
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
   131
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   132
    (aClassName endsWith:';') ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   133
        ('oops - loading of ' , aClassName , ' attempted') printNL.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   134
        self halt:'should not happen'.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   135
        ^ nil
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   136
    ].
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   137
    (aClassName endsWith:'[]') ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   138
        ('oops - loading of ' , aClassName , ' attempted') printNL.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   139
        self halt:'should not happen'.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   140
        ^ nil
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   141
    ].
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   142
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
   143
    clsName := aClassName.
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
   144
    (clsName includes:$.) ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   145
        clsName := clsName asString copy replaceAll:$. with:$/
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
   146
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   147
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   148
    (classesBeingLoaded notNil and:[classesBeingLoaded includes:clsName]) ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   149
        ('oops - recursive load of ' , clsName , ' attempted') printNL.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   150
        self halt:'should not happen'.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   151
        ^ JavaUnresolvedClassConstant fullName:clsName
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   152
    ].
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   153
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   154
    (cls := Java at:clsName) notNil ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   155
        ('oops - ' , clsName , ' is already loaded') printNL.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   156
        self halt:clsName , ' is already loaded - should not happen'.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   157
        ^ cls
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   158
    ].
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   159
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   160
    classesBeingLoaded isNil ifTrue:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   161
        loadedClass := Set with:clsName
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   162
    ] ifFalse:[
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   163
        loadedClass := Set withAll:classesBeingLoaded.
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   164
        loadedClass add:clsName.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   165
    ].
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   166
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
   167
    Java classPath do:[:path |
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   168
        |nm p zar entry|
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   169
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   170
        p := path.
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   171
        p asFilename isDirectory ifTrue:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   172
            (p endsWith:Filename separator) ifFalse:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   173
                p := p , (Filename separator asString)
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   174
            ].
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   175
            (Array 
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   176
                with:clsName
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   177
                with:clsName asLowercase
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   178
                with:clsName asUppercase) 
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   179
            do:[:tryName |
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   180
                (nm := p , tryName , '.class') asFilename exists ifTrue:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   181
                    (Java isExcludedFromClassPath:nm) ifFalse:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   182
                        rslt := self loadFileLazy:nm ignoring:loadedClass.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   183
                        rslt notNil ifTrue:[^ rslt].
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   184
                    ]
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   185
                ].
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   186
            ]
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   187
        ] ifFalse:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   188
            (p asFilename withSuffix:'zip') exists ifTrue:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   189
                zar := ZipArchive oldFileNamed:(p asFilename withSuffix:'zip').
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   190
                (Array 
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   191
                    with:clsName
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   192
                    with:clsName asLowercase
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   193
                    with:clsName asUppercase) 
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   194
                do:[:tryName |
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   195
                    nm := tryName , '.class'.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   196
                    entry := zar extract:nm.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   197
                    entry notNil ifTrue:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   198
                        (Java isExcludedFromClassPath:nm) ifFalse:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   199
                            rslt := self loadStreamLazy:(entry readStream) ignoring:loadedClass.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   200
                            rslt notNil ifTrue:[^ rslt].
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   201
                        ]
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   202
                    ]
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   203
                ]
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   204
            ]
278
9d0ed6e743da handle classPath exclusion
cg
parents: 275
diff changeset
   205
        ]
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   206
    ].
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   207
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   208
    ('JAVA [info]: no file found for: ' , clsName) infoPrintCR.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   209
    ^ nil
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
   210
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   211
    "Modified: / 14.8.1997 / 11:38:42 / stefan"
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   212
    "Modified: / 30.3.1998 / 18:05:59 / cg"
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   213
!
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   214
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   215
loadFile:aFilename
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   216
    "reads a class from aFilename, installs and returns it.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   217
     The classes strings are fixed and its class-init function is called."
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   218
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   219
    self loadFileLazy:aFilename ignoring:(Set new).
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   220
    self postLoadActions
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   221
!
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   222
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   223
loadFileLazy:aFilename ignoring:classesBeingLoaded
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   224
    "reads a class from aFilename, installs and returns it.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   225
     Strings are fixed and classrefs are fixed, 
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   226
     but NO no class-init functions are called."
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   227
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   228
    |aClass pool|
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   229
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   230
    aClass := self readFile:aFilename ignoring:classesBeingLoaded.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   231
    aClass notNil ifTrue:[
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   232
        aClass isJavaClass ifTrue:[
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   233
            "/ a java class
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   234
            Java at:(aClass fullName asSymbol) put:aClass.
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   235
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   236
            classesBeingLoaded remove:aClass fullName ifAbsent:nil.
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   237
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   238
            JavaUnresolvedConstant resolveFor:aClass.
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   239
        ] ifFalse:[    
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   240
            "/ a smalltalk class
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   241
            "/ self halt.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   242
aClass inspect.
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   243
        ]
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   244
    ].
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   245
    ^ aClass
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   246
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   247
    "
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   248
     JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   249
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   250
     '/phys/ibm3/java/lib/java/lang' asFilename
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   251
        directoryContents do:[:nm |
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   252
            (nm endsWith:'.class') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   253
                ('/phys/ibm3/java/lib/java/lang/' , nm) printNL.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   254
                JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/' , nm
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   255
            ]
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   256
        ].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   257
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   258
     '/phys/ibm3/java/lib/java/io' asFilename
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   259
        directoryContents do:[:nm |
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   260
            (nm endsWith:'.class') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   261
                ('/phys/ibm3/java/lib/java/io/' , nm) printNL.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   262
                JavaClassReader loadFile:'/phys/ibm3/java/lib/java/io/' , nm
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   263
            ]
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   264
        ].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   265
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   266
     '/phys/ibm3/java/lib/java/net' asFilename
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   267
        directoryContents do:[:nm |
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   268
            (nm endsWith:'.class') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   269
                ('/phys/ibm3/java/lib/java/net/' , nm) printNL.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   270
                JavaClassReader loadFile:'/phys/ibm3/java/lib/java/net/' , nm
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   271
            ]
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   272
        ].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   273
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   274
     '/phys/ibm3/java/lib/java/util' asFilename
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   275
        directoryContents do:[:nm |
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   276
            (nm endsWith:'.class') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   277
                ('/phys/ibm3/java/lib/java/util/' , nm) printNL.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   278
                JavaClassReader loadFile:'/phys/ibm3/java/lib/java/util/' , nm
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   279
            ]
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   280
        ].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   281
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   282
     '/phys/ibm3/java/lib/java/awt' asFilename
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   283
        directoryContents do:[:nm |
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   284
            (nm endsWith:'.class') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   285
                ('/phys/ibm3/java/lib/java/awt/' , nm) printNL.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   286
                JavaClassReader loadFile:'/phys/ibm3/java/lib/java/awt/' , nm
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   287
            ]
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   288
        ].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   289
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   290
     '/phys/ibm3/java/lib/java/applet' asFilename
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   291
        directoryContents do:[:nm |
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   292
            (nm endsWith:'.class') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   293
                ('/phys/ibm3/java/lib/java/applet/' , nm) printNL.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   294
                JavaClassReader loadFile:'/phys/ibm3/java/lib/java/applet/' , nm
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   295
            ]
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   296
        ].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   297
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   298
     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
   299
     JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/Thread.class'
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   300
    "
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   301
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   302
    "Created: / 15.4.1996 / 14:58:53 / cg"
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   303
    "Modified: / 12.5.1998 / 22:06:52 / cg"
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   304
!
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   305
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   306
loadStreamLazy:aStream ignoring:classesBeingLoaded
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   307
    "reads a class from aStream, installs and returns it.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   308
     Strings are fixed and classrefs are fixed, 
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   309
     but NO no class-init functions are called."
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   310
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   311
    |javaClass pool|
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   312
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   313
    javaClass := self readStream:aStream ignoring:classesBeingLoaded.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   314
    javaClass notNil ifTrue:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   315
        Java at:(javaClass fullName asSymbol) put:javaClass.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   316
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   317
        classesBeingLoaded remove:javaClass fullName ifAbsent:nil.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   318
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   319
        JavaUnresolvedConstant resolveFor:javaClass.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   320
    ].
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   321
    ^ javaClass
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   322
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   323
    "Created: / 30.3.1998 / 17:59:02 / cg"
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   324
!
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   325
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   326
postLoadActions
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   327
    "Resolve all classes' string constants.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   328
     Perform all class initialization functions (of those which are not
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   329
     yet initialized)."
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   330
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   331
    ^ self postLoadActions:true
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   332
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   333
    "Modified: 15.8.1997 / 01:02:17 / cg"
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   334
!
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   335
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   336
postLoadActions:loadUnresolved
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   337
    "Resolve all classes' string constants.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   338
     Perform all class initialization functions 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   339
     (of those which are not yet initialized)."
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   340
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   341
    |classes prevUnresolved newUnresolved loader|
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   342
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   343
    "/ need at least java.lang.String, for valid constants
167
77dcbc4b2201 *** empty log message ***
cg
parents: 135
diff changeset
   344
    Java java_lang_String isNil ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   345
        self loadClassLazy:'java.lang.String' ignoring:(Set new).
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   346
    ].
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   347
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   348
    LazyClassLoading ifFalse:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   349
        loader := ClassLoaderQuerySignal raise.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   350
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   351
        prevUnresolved := nil.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   352
        newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   353
        loadUnresolved ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   354
            [prevUnresolved ~= newUnresolved] whileTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   355
                newUnresolved do:[:nextUnresolved |
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   356
                    |classURL|
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   357
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   358
                    (Java at:nextUnresolved) isNil ifTrue:[ "/ could have been loaded in the meantime
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   359
                        Silent ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   360
                            'loading unresolved: ' print. nextUnresolved printCR.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   361
                        ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   362
                        loader isNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   363
                            self
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   364
                                loadClassLazy:nextUnresolved
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   365
                                ignoring:(Set new).
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   366
                        ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   367
                            "/
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   368
                            "/ the aquired loader is a javaClassLoader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   369
                            "/ which expects an URL as arg.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   370
                            "/
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   371
                            "/ classURL := Java as_URL:('file:' , nextUnresolved asString , '.class').
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   372
                            "/ loader loadClass:classURL
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   373
                            loader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   374
                                perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   375
                                with:(Java as_String:(nextUnresolved asString)).
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   376
                        ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   377
                    ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   378
                ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   379
                prevUnresolved := newUnresolved.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   380
                newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   381
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   382
        ].
229
b91c9462ac83 *** empty log message ***
cg
parents: 225
diff changeset
   383
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   384
        newUnresolved size == 0 ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   385
            "/ nothing unresolved
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   386
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   387
            (classes := Java allClasses) notNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   388
                "/ init all new classes
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   389
                "/ fetch again - there could be new ones ...
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   390
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   391
                classes := Java allClasses.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   392
                classes do:[:aJavaClass |
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   393
                    aJavaClass isInitialized ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   394
                        Silent ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   395
                            'performing class initialization of ' print. aJavaClass fullName printCR.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   396
                        ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   397
                        aJavaClass classInit
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   398
                    ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   399
                ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   400
            ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   401
        ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   402
    ]
167
77dcbc4b2201 *** empty log message ***
cg
parents: 135
diff changeset
   403
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   404
    "Created: / 15.8.1997 / 01:01:44 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   405
    "Modified: / 7.1.1998 / 14:13:55 / cg"
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   406
!
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   407
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   408
readFile:aFilename ignoring:classesBeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   409
    "reads a class from aFilename and returns it.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   410
     The JavaClass is NOT installed as global and unresolved
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   411
     refs are NOT patched."
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   412
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   413
    |inStream javaClass|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   414
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   415
    Silent ifFalse:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   416
        'reading ' print. aFilename print. ' ...' printNL.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   417
    ].
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   418
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   419
    inStream := aFilename asFilename readStream.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   420
    inStream isNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   421
        ('JAVA [info]: no file: ' , aFilename) printCR.
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   422
        self halt.
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   423
        ^ nil
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   424
    ].
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   425
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   426
    javaClass := self new readStream:inStream ignoring:classesBeingLoaded.
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   427
    (javaClass notNil and:[javaClass isJavaClass]) ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   428
        javaClass setBinaryFilePath:(inStream pathName).
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   429
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   430
    inStream close.
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
   431
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   432
    AbsolutelySilent ifFalse:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   433
        '  ... loaded ' print. javaClass displayString printNL.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   434
    ].
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
   435
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   436
    ^ javaClass
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   437
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   438
    "Created: / 15.4.1996 / 14:58:53 / cg"
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   439
    "Modified: / 9.5.1998 / 01:44:24 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   440
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   441
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   442
readStream:aStream
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   443
    "reads a class from aStream and returns it.
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   444
     The JavaClass is installed as global.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   445
     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
   446
     is created."
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   447
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   448
    ^ self readStream:aStream loader:nil
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   449
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   450
    "Modified: 14.8.1997 / 19:51:50 / cg"
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   451
!
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   452
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   453
readStream:aStream ignoring:classesBeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   454
    "reads a class from aStream and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   455
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   456
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   457
    |javaClass|
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   458
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   459
    javaClass :=  self new readStream:aStream ignoring:classesBeingLoaded.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   460
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   461
    AbsolutelySilent ifFalse:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   462
        '  ... loaded ' print. javaClass displayString printNL.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   463
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   464
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   465
    ^ javaClass
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   466
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   467
    "Modified: / 30.3.1998 / 18:14:40 / cg"
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   468
!
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   469
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   470
readStream:aStream loader:aClassLoader
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   471
    "reads a class from aStream and returns it.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   472
     The JavaClass is installed as global.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   473
     If new classes are required to be loaded, aClassLoader is
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   474
     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
   475
     is created."
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   476
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   477
    ^ self
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   478
	readStream:aStream 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   479
	loader:aClassLoader 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   480
	loadUnresolved:true
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   481
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   482
    "Modified: 15.8.1997 / 01:00:35 / cg"
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   483
!
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   484
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   485
readStream:aStream loader:aClassLoader loadUnresolved:loadUnresolved
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   486
    "reads a class from aStream and returns it.
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   487
     The JavaClass is installed as global.
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   488
     If new classes are required to be loaded, aClassLoader is
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   489
     asked to do it. If aClassLoader is nil, a new standard loader
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   490
     is created."
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   491
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   492
    |javaClass|
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   493
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   494
    ClassLoaderQuerySignal answer:aClassLoader
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   495
    do:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   496
        javaClass := self readStream:aStream ignoring:(Set new).
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   497
        javaClass notNil ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   498
            self postLoadActions:loadUnresolved.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   499
            Java at:(javaClass fullName asSymbol) put:javaClass.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   500
            JavaUnresolvedConstant resolveFor:javaClass.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   501
        ].
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   502
    ].
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   503
    ^ javaClass
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   504
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   505
    "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
   506
    "Modified: / 23.1.1998 / 17:14:09 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   507
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
   508
083530508d9c intitial checkin
cg
parents:
diff changeset
   509
!JavaClassReader methodsFor:'file reading'!
083530508d9c intitial checkin
cg
parents:
diff changeset
   510
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   511
readClassFileIgnoring:classesbeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   512
    "reads a class from inStream and returns it.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   513
     The JavaClass is not installed as global and its constants
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   514
     (especially strings) may not be fully resolved."
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   515
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   516
    |magic 
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   517
     access_flags this_class this_class_index super_class super_class_index
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   518
     realSuperClass this_class_ref existingSuperClass
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   519
     fields interfaces staticFields nStatic
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   520
     jSuperClass loader superClassName thisClassName existing_class
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   521
     thisMetaClass|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   522
083530508d9c intitial checkin
cg
parents:
diff changeset
   523
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   524
    "/ read magic, determine byte order
083530508d9c intitial checkin
cg
parents:
diff changeset
   525
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   526
    msb := true.
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   527
    magic := inStream nextUnsignedLongMSB:true.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   528
    magic = (self class magic_MSB) ifFalse:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   529
        magic = (self class magic_LSB) ifFalse:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   530
            InvalidClassFormatSignal raiseErrorString:'not a java class file'.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   531
            ^ nil
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   532
        ].
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   533
        msb := false.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   534
        Verbose ifTrue:[Transcript showCR:'file is lsb'].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   535
    ] ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   536
        Verbose ifTrue:[Transcript showCR:'file is msb'].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   537
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   538
083530508d9c intitial checkin
cg
parents:
diff changeset
   539
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   540
    "/ get version
083530508d9c intitial checkin
cg
parents:
diff changeset
   541
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   542
    minorVsn := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   543
    majorVsn := inStream nextUnsignedShortMSB:msb.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   544
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   545
    (majorVsn ~~ (self class fileMajorVersion) 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   546
    or:[minorVsn ~~ (self class fileMinorVersion)]) ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   547
        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
   548
    ].
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   549
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   550
    Verbose ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   551
        Transcript show:'version = '; 
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   552
                   show:(majorVsn printString); 
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   553
                   show:'.';
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   554
                   showCR:(minorVsn printString).
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   555
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   556
083530508d9c intitial checkin
cg
parents:
diff changeset
   557
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   558
    "/ get constant pool
083530508d9c intitial checkin
cg
parents:
diff changeset
   559
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   560
    self readConstantPool.
083530508d9c intitial checkin
cg
parents:
diff changeset
   561
083530508d9c intitial checkin
cg
parents:
diff changeset
   562
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   563
    "/ access flags
083530508d9c intitial checkin
cg
parents:
diff changeset
   564
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   565
    access_flags := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   566
    this_class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   567
    super_class_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   568
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   569
    super_class_index == 0 ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   570
        super_class := nil
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   571
    ] ifFalse:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   572
        super_class := constants at:super_class_index.
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   573
        superClassName := super_class fullName.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   574
        
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   575
        "/ special for ST-classes
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   576
        (superClassName startsWith:'smalltalk.') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   577
            "/ a Smalltalk class
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   578
            superClassName := superClassName copyFrom:11.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   579
            existingSuperClass := Smalltalk at:superClassName asSymbol.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   580
            existingSuperClass notNil ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   581
                super_class := existingSuperClass
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   582
            ] ifFalse:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   583
                "/ self halt - must load superclass ...
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   584
            ]
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   585
        ] ifFalse:[
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   586
            "/ a JAVA class
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   587
            existingSuperClass := Java classNamed:superClassName.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   588
            existingSuperClass notNil ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   589
                super_class := existingSuperClass
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   590
            ] ifFalse:[
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   591
                (super_class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   592
                    Silent ifFalse:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   593
                        'load superClass: ' print. superClassName printCR.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   594
                    ].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   595
                    loader := ClassLoaderQuerySignal raise.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   596
                    loader isNil ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   597
                        existingSuperClass := self class 
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   598
                                            loadClassLazy:superClassName
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   599
                                            ignoring:classesbeingLoaded.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   600
                    ] ifFalse:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   601
                        jSuperClass := loader
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   602
                                    perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   603
                                    with:(Java as_String:superClassName).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   604
                        existingSuperClass := JavaVM classForJavaClassObject:jSuperClass.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   605
                    ].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   606
                    existingSuperClass isNil ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   607
                        self halt:('cannot find superclass: ' , superClassName).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   608
                    ].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   609
                    super_class := existingSuperClass
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   610
                ] ifFalse:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   611
                    self halt:'oops - superclass ?'
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   612
                ]
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   613
            ].
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   614
        ].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   615
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   616
083530508d9c intitial checkin
cg
parents:
diff changeset
   617
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   618
    "/ get interfaces
083530508d9c intitial checkin
cg
parents:
diff changeset
   619
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   620
    interfaces := self readInterfaces.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   621
083530508d9c intitial checkin
cg
parents:
diff changeset
   622
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   623
    "/ get fields
083530508d9c intitial checkin
cg
parents:
diff changeset
   624
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   625
    fields := self readFieldInfofields.
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   626
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   627
    "/
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   628
    "/ create the fields as instVars
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   629
    "/ static fields are created as class-InstVars
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   630
    "/
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   631
    staticFields := fields select:[:f | f isStatic].
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   632
    nStatic := staticFields size.
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   633
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   634
    this_class_ref := constants at:this_class_index.
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   635
    thisClassName := this_class_ref fullName.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   636
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   637
    "/ care for smalltalk classes ...
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   638
    (thisClassName startsWith:'smalltalk.') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   639
        thisClassName := thisClassName copyFrom:11.
182
5f85fd0fec56 checkin from browser
cg
parents: 177
diff changeset
   640
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   641
        existing_class := Smalltalk at:thisClassName asSymbol.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   642
        existing_class notNil ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   643
            self halt:('overloading existing class: ', thisClassName)
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   644
        ].
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   645
        thisMetaClass := Metaclass new.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   646
        thisMetaClass setSuperclass:super_class class.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   647
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   648
        this_class := thisMetaClass new.
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   649
        this_class setSuperclass:super_class.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   650
        this_class setName:thisClassName asSymbol.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   651
    ] ifFalse:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   652
        "/ a java class
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   653
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   654
        this_class := JavaClass fullName:thisClassName numStatic:nStatic.
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   655
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   656
        nStatic ~~ 0 ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   657
            fields := fields select:[:f | f isStatic not].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   658
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   659
            JavaClass setInstanceVariableStringFromFields:staticFields in:this_class class.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   660
            this_class setStaticFields:staticFields.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   661
            this_class initializeStaticFields.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   662
        ].
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   663
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   664
        this_class setAccessFlags:access_flags.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   665
        this_class setSuperclass:super_class.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   666
        this_class setConstantPool:constants.
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   667
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   668
        this_class setFields:fields.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   669
        this_class setInterfaces:interfaces.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   670
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   671
        constants owner:this_class.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   672
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   673
083530508d9c intitial checkin
cg
parents:
diff changeset
   674
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   675
    "/ get methods
083530508d9c intitial checkin
cg
parents:
diff changeset
   676
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   677
    self readMethodsFor:this_class.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   678
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   679
    self readAttributesFor:this_class.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   680
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   681
    ^ this_class
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   682
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   683
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   684
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   685
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   686
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   687
     JavaClassReader verbose:true.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   688
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/ArithmeticException.class'
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   689
     JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/ArithmeticException.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   690
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   691
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   692
    "Created: / 15.4.1996 / 15:02:47 / cg"
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   693
    "Modified: / 12.5.1998 / 22:23:55 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   694
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   695
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   696
readStream:aStream ignoring:classesBeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   697
    "reads a class from aStream and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   698
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   699
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   700
    inStream := aStream.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   701
    inStream binary.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   702
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   703
    ^ self readClassFileIgnoring:classesBeingLoaded
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   704
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   705
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   706
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   707
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   708
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   709
    "Created: 15.4.1996 / 15:00:55 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   710
    "Modified: 15.4.1996 / 15:06:18 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   711
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   712
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   713
!JavaClassReader methodsFor:'file reading - attributes'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   714
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   715
readAttribute:attributeName for:something
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   716
    "/ implemented ST attributes
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   717
    (attributeName = 'STLiterals') ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   718
        self readSTLiteralsAttributeFor:something.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   719
        ^ self.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   720
    ].
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   721
    (attributeName = 'ClassRevision') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   722
        self readSTClassRevisionAttributeFor:something.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   723
        ^ self.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   724
    ].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   725
    (attributeName = 'ClassPackage') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   726
        self readSTClassPackageAttributeFor:something.
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
   727
        ^ self.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
   728
    ].
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   729
    (attributeName = 'ClassCategory') ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   730
        self readSTClassCategoryAttributeFor:something.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   731
        ^ self.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   732
    ].
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   733
    (attributeName = 'ClassVarNames') ifTrue:[
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   734
        self readSTClassVarNamesAttributeFor:something.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   735
        ^ self.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   736
    ].
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   737
    (attributeName = 'ClassInstVarNames') ifTrue:[
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   738
        self readSTClassInstVarNamesAttributeFor:something.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   739
        ^ self.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   740
    ].
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   741
    (attributeName = 'InstVarNames') ifTrue:[
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   742
        self readSTInstVarNamesAttributeFor:something.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   743
        ^ self.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   744
    ].
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   745
    (attributeName = 'STCode') ifTrue:[
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   746
        self readCodeAttributeFor:something.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   747
        ^ self.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   748
    ].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   749
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   750
    "/ implemented JAVA attributes
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   751
    (attributeName = 'Code') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   752
        self readCodeAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   753
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   754
    ].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   755
    (attributeName = 'Exceptions') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   756
        self readExceptionsAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   757
        ^ self.
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   758
    ].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   759
    (attributeName = 'LineNumberTable') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   760
        self readLineNumberTableAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   761
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   762
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   763
    (attributeName = 'LocalVariableTable') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   764
        self readLocalVariableTableAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   765
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   766
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   767
    (attributeName = 'ConstantValue') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   768
        self readConstantValueAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   769
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   770
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   771
    (attributeName = 'SourceFile') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   772
        self readSourceFileAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   773
        ^ self.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   774
    ].
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   775
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   776
    "/ ignored JAVA attributes
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   777
    (attributeName = 'Deprecated') ifTrue:[
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   778
        ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   779
        self skipAttribute:attributeName.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   780
        ^ self.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   781
    ].
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   782
    (attributeName = 'AbsoluteSourcePath') ifTrue:[
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   783
        ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   784
        self skipAttribute:attributeName.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   785
        ^ self.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   786
    ].
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   787
    (attributeName = 'Synthetic') ifTrue:[
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   788
        ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   789
        self skipAttribute:attributeName.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   790
        ^ self.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   791
    ].
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   792
    (attributeName = 'InnerClasses') ifTrue:[
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   793
        ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   794
        self skipAttribute:attributeName.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   795
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   796
    ].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   797
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   798
    "/ unknwon attributes
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   799
    ('JAVA [warning]: unrecognized attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   800
    self skipAttribute:attributeName.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   801
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   802
    "Modified: / 12.5.1998 / 22:19:04 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   803
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   804
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   805
readAttributeFor:something
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   806
    |attribute_name_index attribute_name attribute_length attribute_info|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   807
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   808
    Verbose ifTrue:[Transcript show:'attrib at pos: '; showCR:inStream position].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   809
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   810
    attribute_name_index := inStream nextUnsignedShortMSB:msb.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   811
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   812
    "/
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   813
    "/ UNDOC feature ?
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   814
    "/
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   815
    attribute_name_index > constants size ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   816
        attribute_name_index == 16rb700 ifTrue:[
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   817
            self halt.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   818
        ]
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   819
    ].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   820
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   821
    attribute_name := constants at:attribute_name_index.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   822
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   823
    Verbose ifTrue:[Transcript show:'attrib name: '; showCR:attribute_name].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   824
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   825
    self readAttribute:attribute_name for:something.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   826
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   827
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   828
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   829
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   830
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   831
    "Created: / 15.4.1996 / 15:40:17 / cg"
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   832
    "Modified: / 9.4.1998 / 18:13:34 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   833
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   834
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   835
readAttributesFor:something
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   836
    |attributes_count|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   837
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   838
    attributes_count := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   839
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   840
    1 to:attributes_count do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   841
	self readAttributeFor:something.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   842
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   843
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   844
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   845
    "Created: 15.4.1996 / 15:40:17 / cg"
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   846
!
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   847
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   848
readSourceFileAttributeFor:aClass
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   849
    |attribute_length sourceFile_index sourceFile|
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   850
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   851
    attribute_length := inStream nextUnsignedLongMSB:msb.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   852
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   853
    sourceFile_index := inStream nextUnsignedShortMSB:msb.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   854
    sourceFile := constants at:sourceFile_index.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   855
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   856
    aClass isJavaClass ifTrue:[
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   857
        aClass setSourceFile:sourceFile.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   858
    ] ifFalse:[
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   859
        aClass setClassFilename:sourceFile
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   860
    ].
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   861
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   862
    Verbose ifTrue:[Transcript show:'sourceFile: '; showCR:sourceFile].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   863
    ^ true
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   864
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   865
    "
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   866
     JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   867
     JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   868
     JavaClassReader loadFile:'foo.cls'
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   869
    "
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   870
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   871
    "Created: / 15.4.1996 / 15:40:17 / cg"
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   872
    "Modified: / 12.5.1998 / 22:01:07 / cg"
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   873
!
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   874
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   875
skipAttribute:attributeName
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   876
    "dont know about this attribute - skip it here"
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   877
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   878
    |attribute_length attribute_info|
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   879
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   880
    attribute_length := inStream nextUnsignedLongMSB:msb.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   881
    attribute_info := ByteArray new:(attribute_length).
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   882
    inStream nextBytes:attribute_length into:attribute_info startingAt:1.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   883
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   884
    Verbose ifTrue:[Transcript show:'skipped '; show:attributeName; showCR:'-attribute'].
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   885
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   886
    "Created: / 9.4.1998 / 18:12:46 / cg"
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   887
    "Modified: / 9.4.1998 / 18:13:20 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   888
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   889
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   890
!JavaClassReader methodsFor:'file reading - attributes-ST'!
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   891
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   892
readSTClassCategoryAttributeFor:aClass
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   893
    |attribute_length categoryString_index categoryString|
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   894
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   895
    attribute_length := inStream nextUnsignedLongMSB:msb.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   896
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   897
    categoryString_index := inStream nextUnsignedShortMSB:msb.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   898
    categoryString := constants at:categoryString_index.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   899
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   900
    aClass category:categoryString.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   901
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   902
    Verbose ifTrue:[Transcript show:'categoryString: '; showCR:categoryString].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   903
    ^ true
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   904
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   905
    "
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   906
     JavaClassReader loadFile:'foo.cls'
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   907
    "
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   908
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   909
    "Created: / 9.5.1998 / 02:33:13 / cg"
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   910
    "Modified: / 9.5.1998 / 02:36:55 / cg"
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   911
!
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   912
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   913
readSTClassInstVarNamesAttributeFor:aClass
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   914
    |attribute_length nameString_index nameString|
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   915
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   916
    attribute_length := inStream nextUnsignedLongMSB:msb.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   917
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   918
    nameString_index := inStream nextUnsignedShortMSB:msb.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   919
    nameString := constants at:nameString_index.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   920
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   921
    aClass class instanceVariableString:nameString.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   922
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   923
    Verbose ifTrue:[Transcript show:'nameString: '; showCR:nameString].
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   924
    ^ true
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   925
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   926
    "
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   927
     JavaClassReader loadFile:'foo.cls'
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   928
    "
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   929
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   930
    "Modified: / 12.5.1998 / 22:18:03 / cg"
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   931
    "Created: / 12.5.1998 / 22:18:24 / cg"
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   932
!
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   933
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   934
readSTClassPackageAttributeFor:aClass
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   935
    |attribute_length packageString_index packageString|
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   936
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   937
    attribute_length := inStream nextUnsignedLongMSB:msb.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   938
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   939
    packageString_index := inStream nextUnsignedShortMSB:msb.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   940
    packageString := constants at:packageString_index.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   941
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   942
    aClass package:packageString asSymbol.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   943
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   944
    Verbose ifTrue:[Transcript show:'packageString: '; showCR:packageString].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   945
    ^ true
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   946
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   947
    "
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   948
     JavaClassReader loadFile:'foo.cls'
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   949
    "
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   950
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   951
    "Modified: / 9.5.1998 / 02:32:38 / cg"
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   952
    "Created: / 9.5.1998 / 02:33:44 / cg"
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   953
!
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   954
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   955
readSTClassRevisionAttributeFor:aClass
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   956
    |attribute_length revisionString_index revisionString|
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   957
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   958
    attribute_length := inStream nextUnsignedLongMSB:msb.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   959
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   960
    revisionString_index := inStream nextUnsignedShortMSB:msb.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   961
    revisionString := constants at:revisionString_index.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   962
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   963
    aClass setBinaryRevision:revisionString.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   964
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   965
    Verbose ifTrue:[Transcript show:'revisionString: '; showCR:revisionString].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   966
    ^ true
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   967
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   968
    "
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   969
     JavaClassReader loadFile:'foo.cls'
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   970
    "
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   971
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   972
    "Created: / 9.5.1998 / 02:33:13 / cg"
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
   973
    "Modified: / 9.5.1998 / 02:35:01 / cg"
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   974
!
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   975
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   976
readSTClassVarNamesAttributeFor:aClass
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   977
    |attribute_length nameString_index nameString|
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   978
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   979
    attribute_length := inStream nextUnsignedLongMSB:msb.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   980
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   981
    nameString_index := inStream nextUnsignedShortMSB:msb.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   982
    nameString := constants at:nameString_index.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   983
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   984
    aClass classVariableString:nameString.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   985
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   986
    Verbose ifTrue:[Transcript show:'nameString: '; showCR:nameString].
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   987
    ^ true
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   988
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   989
    "
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   990
     JavaClassReader loadFile:'foo.cls'
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   991
    "
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   992
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   993
    "Created: / 9.5.1998 / 02:33:13 / cg"
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   994
    "Modified: / 12.5.1998 / 22:18:03 / cg"
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   995
!
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   996
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   997
readSTInstVarNamesAttributeFor:aClass
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   998
    |attribute_length nameString_index nameString|
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
   999
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1000
    attribute_length := inStream nextUnsignedLongMSB:msb.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1001
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1002
    nameString_index := inStream nextUnsignedShortMSB:msb.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1003
    nameString := constants at:nameString_index.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1004
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1005
    aClass setInstanceVariableString:nameString.
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1006
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1007
    Verbose ifTrue:[Transcript show:'nameString: '; showCR:nameString].
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1008
    ^ true
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1009
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1010
    "
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1011
     JavaClassReader loadFile:'foo.cls'
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1012
    "
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1013
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1014
    "Created: / 12.5.1998 / 22:18:14 / cg"
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1015
    "Modified: / 12.5.1998 / 22:21:10 / cg"
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1016
! !
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1017
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1018
!JavaClassReader methodsFor:'file reading - constants'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1019
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1020
readConstant
083530508d9c intitial checkin
cg
parents:
diff changeset
  1021
    |tag constReader const|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1022
083530508d9c intitial checkin
cg
parents:
diff changeset
  1023
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1024
    constNeeds2Slots := false.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1025
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1026
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
  1027
    "/ get tag
083530508d9c intitial checkin
cg
parents:
diff changeset
  1028
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1029
    tag := inStream nextByte.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1030
    Verbose ifTrue:[Transcript show:'tag = '; showCR:tag].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1031
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1032
    tag >= 250 ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1033
        constReader := #(
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1034
                        "/ ST types
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1035
                        readConstant_ST_Large           "/ 249
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1036
                        readConstant_ST_Special         "/ 250
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1037
                        readConstant_ST_Character       "/ 251
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1038
                        readConstant_ST_ByteArray       "/ 252
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1039
                        readConstant_ST_Array           "/ 253
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1040
                        readConstant_ST_Symbol          "/ 254
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1041
                        readConstant_ST_Reserved        "/ 255
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1042
                    ) at:tag-249+1.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1043
    ] ifFalse:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1044
        constReader := #(
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1045
                        "/ JAVA types
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1046
                        readConstant_Asciz              "/ 1  - now called Utf8
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1047
                        readConstant_Unicode            "/ 2
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1048
                        readConstant_Integer            "/ 3
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1049
                        readConstant_Float              "/ 4
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1050
                        readConstant_Long               "/ 5
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1051
                        readConstant_Double             "/ 6
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1052
                        readConstant_Class              "/ 7
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1053
                        readConstant_String             "/ 8
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1054
                        readConstant_Fieldref           "/ 9
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1055
                        readConstant_Methodref          "/ 10
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1056
                        readConstant_InterfaceMethodref "/ 11
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1057
                        readConstant_NameAndType        "/ 12
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1058
                    ) at:tag ifAbsent:[#readConstant_Undef].
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1059
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1060
    ^ self perform:constReader.
083530508d9c intitial checkin
cg
parents:
diff changeset
  1061
083530508d9c intitial checkin
cg
parents:
diff changeset
  1062
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1063
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1064
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1065
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1066
    "Created: / 15.4.1996 / 15:46:32 / cg"
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1067
    "Modified: / 9.5.1998 / 01:26:05 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1068
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1069
083530508d9c intitial checkin
cg
parents:
diff changeset
  1070
readConstantPool
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1071
    |constantPoolCount const i|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1072
083530508d9c intitial checkin
cg
parents:
diff changeset
  1073
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
  1074
    "/ get constant pool
083530508d9c intitial checkin
cg
parents:
diff changeset
  1075
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1076
    constantPoolCount := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1077
    Verbose ifTrue:[Transcript show:'constantPoolCount = '; showCR:constantPoolCount].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1078
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1079
    constants := JavaConstantPool "Array" new:constantPoolCount-1.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1080
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
  1081
    constSlot := 1.
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
  1082
    [constSlot < constantPoolCount] whileTrue:[
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1083
        Verbose ifTrue:[Transcript show:'const: '; showCR:constSlot].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1084
        const := self readConstant.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1085
        constants at:constSlot put:const.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1086
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1087
        "/ long & double consts take 2 slots
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1088
        "/ (only first is used)
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1089
        constNeeds2Slots ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1090
            constSlot := constSlot + 2.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1091
        ] ifFalse:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1092
            constSlot := constSlot + 1.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1093
        ]
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1094
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1095
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
  1096
    constSlot := -1.
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
  1097
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1098
    "/ preresolve what can be (especially, strings are resolved here)
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1099
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1100
    1 to:constantPoolCount-1 do:[:i |
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1101
        |const value|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1102
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1103
        const := constants at:i.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1104
        const notNil ifTrue:[   "/ kludge for 2-slot constants (which only take 1 slot in ST/X)
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1105
            (const isKindOf:JavaUnresolvedConstant) ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1106
                value := const preResolve.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1107
                value ~~ const ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1108
                    constants at:i put:value.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1109
                ]
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1110
            ]
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1111
        ]
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1112
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1113
083530508d9c intitial checkin
cg
parents:
diff changeset
  1114
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1115
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1116
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1117
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1118
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1119
    "Created: / 15.4.1996 / 15:14:11 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1120
    "Modified: / 7.5.1998 / 11:44:06 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1121
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1122
083530508d9c intitial checkin
cg
parents:
diff changeset
  1123
readConstant_Asciz
083530508d9c intitial checkin
cg
parents:
diff changeset
  1124
    |len string|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1125
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1126
    len := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1127
    string := String new:len.
083530508d9c intitial checkin
cg
parents:
diff changeset
  1128
    inStream nextBytes:len into:string startingAt:1.
083530508d9c intitial checkin
cg
parents:
diff changeset
  1129
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1130
    Verbose ifTrue:[Transcript show:'asciz; string= ';     showCR:string].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1131
083530508d9c intitial checkin
cg
parents:
diff changeset
  1132
    ^ string
083530508d9c intitial checkin
cg
parents:
diff changeset
  1133
083530508d9c intitial checkin
cg
parents:
diff changeset
  1134
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1135
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1136
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1137
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1138
083530508d9c intitial checkin
cg
parents:
diff changeset
  1139
    "Created: 15.4.1996 / 15:15:35 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1140
    "Modified: 15.4.1996 / 16:33:45 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1141
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1142
083530508d9c intitial checkin
cg
parents:
diff changeset
  1143
readConstant_Class
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
  1144
    |name_index name|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1145
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1146
    name_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1147
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1148
    Verbose ifTrue:[Transcript show:'class; index= '; showCR:name_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1149
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
  1150
    name := constants at:name_index.
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
  1151
    name notNil ifTrue:[
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1152
        Verbose ifTrue:[Transcript showCR:'name in constant_class already resolved'].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1153
        "/ self halt
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
  1154
    ].
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
  1155
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
  1156
    ^ JavaUnresolvedClassConstant 
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1157
        pool:constants
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1158
        poolIndex:constSlot
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1159
        nameIndex:name_index
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1160
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1161
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1162
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1163
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1164
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1165
    "Created: / 15.4.1996 / 15:21:13 / cg"
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1166
    "Modified: / 8.5.1998 / 21:53:16 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1167
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1168
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1169
readConstant_Double
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1170
    |high low aFloat bytes|
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1171
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1172
"/ new code - to be tested
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1173
"/    bytes := ByteArray new:8.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1174
"/
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1175
"/    inStream nextBytes:8 into:bytes startingAt:1.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1176
"/    msb ~~ UninterpretedBytes isBigEndian ifTrue:[
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1177
"/        bytes reverse
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1178
"/    ].
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1179
"/    aFloat := bytes doubleAt:1.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1180
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1181
"/ old code
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1182
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1183
    high := inStream nextUnsignedLongMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1184
    low := inStream nextUnsignedLongMSB:msb.
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1185
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1186
    aFloat := Float new.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1187
    UninterpretedBytes isBigEndian ifTrue:[
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1188
        aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1189
        aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1190
        aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1191
        aFloat basicAt:4 put:(high bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1192
        aFloat basicAt:5 put:((low bitShift:-24) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1193
        aFloat basicAt:6 put:((low bitShift:-16) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1194
        aFloat basicAt:7 put:((low bitShift:-8) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1195
        aFloat basicAt:8 put:(low bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1196
    ] ifFalse:[
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1197
        aFloat basicAt:1 put:(low bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1198
        aFloat basicAt:2 put:((low bitShift:-8) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1199
        aFloat basicAt:3 put:((low bitShift:-16) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1200
        aFloat basicAt:4 put:((low bitShift:-24) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1201
        aFloat basicAt:5 put:(high bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1202
        aFloat basicAt:6 put:((high bitShift:-8) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1203
        aFloat basicAt:7 put:((high bitShift:-16) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1204
        aFloat basicAt:8 put:((high bitShift:-24) bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1205
    ].
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1206
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1207
    constNeeds2Slots := true.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1208
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1209
    Verbose ifTrue:[Transcript show:'double; value= ';     showCR:aFloat].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1210
    ^ aFloat
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1211
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1212
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1213
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1214
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1215
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1216
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1217
    "Created: / 15.4.1996 / 16:34:42 / cg"
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1218
    "Modified: / 8.5.1998 / 22:06:07 / cg"
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1219
!
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1220
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1221
readConstant_Fieldref
083530508d9c intitial checkin
cg
parents:
diff changeset
  1222
    |class_index name_and_type_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1223
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1224
    class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1225
    name_and_type_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1226
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1227
    Verbose ifTrue:[Transcript show:'fieldref; classindex= ';     showCR:class_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1228
    Verbose ifTrue:[Transcript show:'fieldref; name&typeindex= '; showCR:name_and_type_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1229
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1230
    ^ JavaUnresolvedFieldrefConstant
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1231
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1232
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1233
		classIndex:class_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1234
		nameandTypeIndex:name_and_type_index
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1235
083530508d9c intitial checkin
cg
parents:
diff changeset
  1236
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1237
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1238
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1239
083530508d9c intitial checkin
cg
parents:
diff changeset
  1240
    "Created: 15.4.1996 / 15:22:18 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1241
    "Modified: 15.4.1996 / 16:07:01 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1242
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1243
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1244
readConstant_Float
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1245
    |high aFloat bytes|
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1246
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1247
"/ new code - to be tested ...
352
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1248
"/
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1249
"/    bytes := ByteArray new:4.
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1250
"/    inStream nextBytes:4 into:bytes startingAt:1.
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1251
"/    msb ~~ UninterpretedBytes isBigEndian ifTrue:[
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1252
"/        bytes reverse
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1253
"/    ].
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1254
"/    aFloat := bytes floatAt:1.
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1255
"/    Verbose ifTrue:[Transcript show:'float; value= ';     showCR:aFloat].
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1256
"/    ^ aFloat.
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1257
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1258
"/ old code
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1259
    high := inStream nextUnsignedLongMSB:msb.
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1260
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1261
    aFloat := ShortFloat basicNew.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1262
    UninterpretedBytes isBigEndian ifTrue:[
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1263
        aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1264
        aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1265
        aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1266
        aFloat basicAt:4 put:(high bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1267
    ] ifFalse:[
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1268
        aFloat basicAt:1 put:(high bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1269
        aFloat basicAt:2 put:((high bitShift:-8) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1270
        aFloat basicAt:3 put:((high bitShift:-16) bitAnd:16rFF).
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1271
        aFloat basicAt:4 put:((high bitShift:-24) bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1272
    ].
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1273
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1274
    Verbose ifTrue:[Transcript show:'float; value= ';     showCR:aFloat].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1275
    ^ aFloat
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1276
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1277
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1278
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1279
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1280
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1281
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1282
    "Created: / 15.4.1996 / 16:34:42 / cg"
352
9093171ef0a6 oops - float reading
cg
parents: 350
diff changeset
  1283
    "Modified: / 12.5.1998 / 21:36:32 / cg"
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1284
!
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1285
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1286
readConstant_Integer
083530508d9c intitial checkin
cg
parents:
diff changeset
  1287
    |value|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1288
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1289
    value := inStream nextLongMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1290
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1291
    Verbose ifTrue:[Transcript show:'integer; value= ';     showCR:value].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1292
083530508d9c intitial checkin
cg
parents:
diff changeset
  1293
    ^ value
083530508d9c intitial checkin
cg
parents:
diff changeset
  1294
083530508d9c intitial checkin
cg
parents:
diff changeset
  1295
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1296
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1297
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1298
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1299
083530508d9c intitial checkin
cg
parents:
diff changeset
  1300
    "Modified: 15.4.1996 / 15:42:16 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1301
    "Created: 15.4.1996 / 16:34:42 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1302
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1303
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1304
readConstant_InterfaceMethodref
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1305
    |class_index name_and_type_index|
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1306
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1307
    class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1308
    name_and_type_index := inStream nextUnsignedShortMSB:msb.
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1309
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1310
    Verbose ifTrue:[Transcript show:'methodref; classindex= ';     showCR:class_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1311
    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
  1312
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1313
    ^ JavaUnresolvedInterfaceMethodrefConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1314
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1315
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1316
		classIndex:class_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1317
		nameandTypeIndex:name_and_type_index
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1318
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1319
    "
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1320
     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
  1321
    "
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1322
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1323
    "Created: 15.4.1996 / 15:22:37 / cg"
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1324
    "Modified: 15.4.1996 / 16:07:19 / cg"
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1325
!
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1326
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1327
readConstant_Long
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1328
    |high low value|
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1329
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1330
    high := inStream nextUnsignedLongMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1331
    low := inStream nextUnsignedLongMSB:msb.
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1332
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1333
    value := (high bitShift:32) bitOr:low.
60
a763b1780ec0 checkin from browser
cg
parents: 59
diff changeset
  1334
    (high bitTest:16r80000000) ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1335
	value := value - 16r10000000000000000.
60
a763b1780ec0 checkin from browser
cg
parents: 59
diff changeset
  1336
    ].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1337
    constNeeds2Slots := true.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1338
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1339
    Verbose ifTrue:[Transcript show:'long; value= ';     showCR:value].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1340
    ^ value
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1341
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1342
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1343
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1344
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1345
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1346
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1347
    "Modified: 15.4.1996 / 15:42:16 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1348
    "Created: 15.4.1996 / 16:34:42 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1349
!
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1350
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1351
readConstant_Methodref
083530508d9c intitial checkin
cg
parents:
diff changeset
  1352
    |class_index name_and_type_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1353
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1354
    class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1355
    name_and_type_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1356
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1357
    Verbose ifTrue:[Transcript show:'methodref; classindex= ';     showCR:class_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1358
    Verbose ifTrue:[Transcript show:'methodref; name&typeindex= '; showCR:name_and_type_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1359
083530508d9c intitial checkin
cg
parents:
diff changeset
  1360
    ^ JavaUnresolvedMethodrefConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1361
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1362
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1363
		classIndex:class_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1364
		nameandTypeIndex:name_and_type_index
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1365
083530508d9c intitial checkin
cg
parents:
diff changeset
  1366
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1367
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1368
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1369
083530508d9c intitial checkin
cg
parents:
diff changeset
  1370
    "Created: 15.4.1996 / 15:22:37 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1371
    "Modified: 15.4.1996 / 16:07:19 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1372
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1373
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1374
readConstant_NameAndType
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1375
    |name_index signature_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1376
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1377
    name_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1378
    signature_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1379
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1380
    Verbose ifTrue:[Transcript show:'methodref; nameindex= ';     showCR:name_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1381
    Verbose ifTrue:[Transcript show:'methodref; signatureindex= '; showCR:signature_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1382
083530508d9c intitial checkin
cg
parents:
diff changeset
  1383
    ^ JavaUnresolvedNameandTypeConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1384
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1385
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1386
		nameIndex:name_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1387
		signatureIndex:signature_index  
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1388
083530508d9c intitial checkin
cg
parents:
diff changeset
  1389
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1390
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1391
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1392
083530508d9c intitial checkin
cg
parents:
diff changeset
  1393
    "Created: 15.4.1996 / 15:23:43 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1394
    "Modified: 15.4.1996 / 16:17:16 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1395
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1396
083530508d9c intitial checkin
cg
parents:
diff changeset
  1397
readConstant_String
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1398
    |tag string_index chars jString|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1399
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1400
    string_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1401
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1402
    Verbose ifTrue:[Transcript show:'string; index= '; showCR:string_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1403
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1404
    "/ resolve here if possible
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1405
    string_index < constSlot ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1406
        Java java_lang_String notNil ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1407
            chars := (constants at:string_index).
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1408
            chars isString ifFalse:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1409
                self halt:'should not happen'
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1410
            ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1411
            jString := Java as_String:chars.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1412
            ^ jString.        
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1413
        ]
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1414
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1415
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1416
    ^ JavaUnresolvedStringConstant 
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1417
        pool:constants 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1418
        poolIndex:constSlot
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1419
        stringIndex:string_index
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1420
083530508d9c intitial checkin
cg
parents:
diff changeset
  1421
    "
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
  1422
     Verbose := true.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
  1423
     JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/System.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1424
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1425
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1426
    "Created: / 15.4.1996 / 15:20:33 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1427
    "Modified: / 7.5.1998 / 11:42:45 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1428
! !
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1429
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1430
!JavaClassReader methodsFor:'file reading - constants-ST'!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1431
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1432
readConstant_ST_Array
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1433
    |aSize arr|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1434
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1435
    aSize := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1436
    arr := Array new:aSize.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1437
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1438
    1 to:aSize do:[:i |
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1439
        |element_index element|
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1440
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1441
        element_index := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1442
        arr at:i put:element_index.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1443
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1444
    Verbose ifTrue:[Transcript show:'array; size= ';     showCR:aSize].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1445
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1446
    ^ JavaUnresolvedSTArrayConstant 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1447
                pool:constants
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1448
                poolIndex:constSlot
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1449
                array:arr
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1450
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1451
    "Created: / 7.5.1998 / 11:47:01 / cg"
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1452
    "Modified: / 9.5.1998 / 00:25:34 / cg"
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1453
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1454
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1455
readConstant_ST_ByteArray
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1456
    |aSize arr|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1457
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1458
    aSize := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1459
    arr := ByteArray new:aSize.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1460
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1461
    1 to:aSize do:[:i |
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1462
        |element_index|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1463
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1464
        arr at:i put:(inStream nextByte).
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1465
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1466
    Verbose ifTrue:[Transcript show:'byteArray; size= ';     showCR:aSize].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1467
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1468
    ^ arr
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1469
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1470
    "Created: / 7.5.1998 / 11:47:12 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1471
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1472
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1473
readConstant_ST_Character
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1474
    |ascii|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1475
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1476
    ascii := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1477
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1478
    Verbose ifTrue:[Transcript show:'char; ascii= '; showCR:ascii].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1479
    ^ Character value:ascii
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1480
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1481
    "Created: / 7.5.1998 / 11:48:12 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1482
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1483
350
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1484
readConstant_ST_Special
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1485
    |type|
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1486
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1487
    type := inStream nextUnsignedShortMSB:msb.
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1488
    ^ #(
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1489
        nil
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1490
        true
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1491
        false
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1492
     ) at:(type + 1)
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1493
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1494
    "Created: / 8.5.1998 / 23:06:56 / cg"
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1495
    "Modified: / 9.5.1998 / 00:40:14 / cg"
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1496
!
bf3f92fb2629 support for ST-classes
cg
parents: 348
diff changeset
  1497
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1498
readConstant_ST_String
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1499
    |tag string_index chars|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1500
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1501
    string_index := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1502
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1503
    Verbose ifTrue:[Transcript show:'string; index= '; showCR:string_index].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1504
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1505
    "/ resolve here if possible
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1506
    string_index < constSlot ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1507
        chars := (constants at:string_index).
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1508
        ^ chars
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1509
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1510
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1511
    ^ JavaUnresolvedSTStringConstant 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1512
        pool:constants 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1513
        poolIndex:constSlot
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1514
        stringIndex:string_index
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1515
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1516
    "Modified: / 7.5.1998 / 11:48:28 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1517
    "Created: / 7.5.1998 / 11:49:55 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1518
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1519
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1520
readConstant_ST_Symbol
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1521
    |tag string_index chars|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1522
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1523
    string_index := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1524
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1525
    Verbose ifTrue:[Transcript show:'symbol; index= '; showCR:string_index].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1526
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1527
    "/ resolve here if possible
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1528
    string_index < constSlot ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1529
        chars := (constants at:string_index).
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1530
        chars isString ifFalse:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1531
            self halt:'should not happen'
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1532
        ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1533
        ^ chars asSymbol
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1534
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1535
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1536
    ^ JavaUnresolvedSTSymbolConstant 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1537
        pool:constants 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1538
        poolIndex:constSlot
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1539
        stringIndex:string_index
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1540
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1541
    "Modified: / 7.5.1998 / 11:48:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1542
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1543
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1544
!JavaClassReader methodsFor:'file reading - fields'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1545
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1546
readConstantValueAttributeFor:aField
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1547
    |attribute_length constantvalue_index constantValue|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1548
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1549
    attribute_length := inStream nextUnsignedLongMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1550
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1551
    constantvalue_index := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1552
    constantValue := constants at:constantvalue_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1553
59
38114c3e3e77 checkin from browser
cg
parents: 54
diff changeset
  1554
    aField constantValue:constantValue.
38114c3e3e77 checkin from browser
cg
parents: 54
diff changeset
  1555
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1556
    Verbose ifTrue:[Transcript show:'constantValue: '; showCR:constantValue].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1557
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1558
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1559
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1560
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1561
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1562
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1563
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1564
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1565
    "Created: 15.4.1996 / 15:40:17 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1566
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1567
083530508d9c intitial checkin
cg
parents:
diff changeset
  1568
readFieldInfofield
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1569
    |access_flags name_index signature_index attributes_count field|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1570
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1571
    access_flags := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1572
    name_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1573
    signature_index := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1574
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1575
    field := JavaField new.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1576
    field setAccessFlags:access_flags.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1577
    field setName:(constants at:name_index).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1578
    field setSignature:(constants at:signature_index).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1579
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1580
    attributes_count := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1581
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
  1582
    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
  1583
			       show:' access: '; show:access_flags;
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1584
			       show:' attrib_cnt: '; showCR:attributes_count].
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
  1585
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1586
    1 to:attributes_count do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1587
	self readAttributeFor:field.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1588
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1589
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1590
    ^ field
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1591
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1592
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1593
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1594
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1595
083530508d9c intitial checkin
cg
parents:
diff changeset
  1596
    "Modified: 15.4.1996 / 15:33:28 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1597
    "Created: 15.4.1996 / 15:38:43 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1598
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1599
083530508d9c intitial checkin
cg
parents:
diff changeset
  1600
readFieldInfofields
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1601
    |nFields fields|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1602
083530508d9c intitial checkin
cg
parents:
diff changeset
  1603
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1604
    "/ get fieldInfos
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1605
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1606
    nFields := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1607
    Verbose ifTrue:[Transcript show:'fieldsCount = '; showCR:nFields].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1608
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1609
    fields := Array new:nFields.
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1610
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1611
    1 to:nFields do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1612
	Verbose ifTrue:[Transcript show:'field: '; showCR:i].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1613
	fields at:i put:(self readFieldInfofield)
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1614
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1615
    ^ fields
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1616
083530508d9c intitial checkin
cg
parents:
diff changeset
  1617
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1618
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1619
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1620
083530508d9c intitial checkin
cg
parents:
diff changeset
  1621
    "Created: 15.4.1996 / 15:34:41 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1622
    "Modified: 15.4.1996 / 15:35:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1623
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1624
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1625
!JavaClassReader methodsFor:'file reading - interfaces'!
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1626
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1627
readInterfaces
110
dfb03e2ea321 *** empty log message ***
cg
parents: 104
diff changeset
  1628
    |interfacesCount interface_index interface interfaces|
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1629
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1630
    "/
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1631
    "/ get interfaces
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1632
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1633
    interfacesCount := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1634
    Verbose ifTrue:[Transcript show:'interfacesCount = '; showCR:interfacesCount].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1635
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1636
    interfaces := Array new:interfacesCount.
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1637
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1638
    1 to:interfacesCount do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1639
	Verbose ifTrue:[Transcript show:'interface: '; showCR:i].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1640
	interface_index := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1641
	interface := constants at:interface_index.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1642
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1643
	interfaces at:i put:interface.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1644
    ].
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1645
    ^ interfaces
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1646
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1647
    "
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1648
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1649
    "
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1650
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1651
    "Created: 15.4.1996 / 15:31:59 / cg"
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1652
    "Modified: 15.4.1996 / 15:33:28 / cg"
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1653
! !
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1654
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1655
!JavaClassReader methodsFor:'file reading - methods'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1656
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1657
readCodeAttributeFor:aJavaMethod
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1658
    |attribute_length max_stack max_locals code_length code
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1659
     exception_table_length exception_table unknown1 unknown2|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1660
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1661
    attribute_length := inStream nextUnsignedLongMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1662
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1663
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1664
    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
  1665
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
  1666
    minorVsn > 2 ifTrue:[
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1667
        "/ should be:
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1668
        max_stack := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1669
        max_locals := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1670
        code_length := inStream nextUnsignedLongMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1671
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1672
"/        unknown1 := inStream nextByte.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1673
"/        max_stack := inStream nextByte.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1674
"/        max_locals := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1675
"/        unknown2 := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1676
"/        code_length := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1677
"/        Verbose ifTrue:[Transcript show:'?1: '; showCR:unknown1].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1678
"/        Verbose ifTrue:[Transcript show:'?2: '; showCR:unknown2].
39
20fa5af3b873 checkin from browser
cg
parents: 38
diff changeset
  1679
    ] ifFalse:[
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1680
        max_stack := inStream nextByte.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1681
        max_locals := inStream nextByte.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1682
        code_length := inStream nextUnsignedShortMSB:msb.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1683
    ].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1684
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1685
    Verbose ifTrue:[Transcript show:'code_length: '; showCR:(code_length printStringRadix:16)].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1686
    Verbose ifTrue:[Transcript show:'code at pos: '; showCR:inStream position].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1687
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1688
    code := ByteArray new:code_length.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1689
    inStream nextBytes:code_length into:code startingAt:1.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1690
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1691
    Verbose ifTrue:[Transcript show:'method code:'; showCR:code.].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1692
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1693
    exception_table_length := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1694
    Verbose ifTrue:[Transcript show:'exception_table_length: '; showCR:(exception_table_length printStringRadix:16)].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1695
    exception_table_length ~~ 0 ifTrue:[
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1696
        Verbose ifTrue:[Transcript show:'exceptionTable length:'; showCR:exception_table_length.].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1697
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1698
        exception_table := Array new:exception_table_length.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1699
        1 to:exception_table_length do:[:i |
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1700
            |start_pc end_pc handler_pc catch_type|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1701
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1702
            start_pc := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1703
            end_pc := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1704
            handler_pc := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1705
            catch_type := constants at:(inStream nextUnsignedShortMSB:msb).
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1706
            exception_table at:i put:(JavaExceptionTableEntry
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1707
                                            startPC:start_pc
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1708
                                            endPC:end_pc
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1709
                                            handlerPC:handler_pc
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1710
                                            catchType:catch_type).
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1711
        ].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1712
        aJavaMethod setExceptionHandlerTable:exception_table.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1713
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1714
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  1715
    aJavaMethod 
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1716
        setCode:code 
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1717
        maxStack:max_stack 
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1718
        maxLocals:max_locals 
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1719
        u1:unknown1 
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1720
        u2:unknown2.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1721
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1722
    self readAttributesFor:aJavaMethod.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1723
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1724
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1725
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1726
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1727
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1728
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1729
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1730
    "Created: / 15.4.1996 / 15:40:17 / cg"
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1731
    "Modified: / 8.5.1998 / 21:17:47 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1732
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1733
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1734
readExceptionsAttributeFor:aJavaMethod
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1735
    |attribute_length exception_table_length exception_table|
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1736
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1737
    attribute_length := inStream nextUnsignedLongMSB:msb.
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1738
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1739
    exception_table_length := inStream nextUnsignedShortMSB:msb.
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1740
    exception_table_length ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1741
	exception_table := Array new:exception_table_length.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1742
	1 to:exception_table_length do:[:i |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1743
	    |idx ex|
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1744
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1745
	    idx := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1746
	    ex := constants at:idx.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1747
	    exception_table at:i put:ex.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1748
	].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1749
    ].
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1750
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1751
    Verbose ifTrue:[Transcript showCR:'method has an exceptionTable'].
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1752
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1753
    aJavaMethod setExceptionTable:exception_table.
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1754
    ^ true
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1755
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1756
    "Modified: 15.4.1996 / 15:33:28 / cg"
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1757
    "Created: 15.4.1996 / 15:40:17 / cg"
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1758
!
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1759
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1760
readLineNumberTableAttributeFor:aJavaMethod
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1761
    |attribute_length line_number_table_length line_number_table|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1762
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1763
    attribute_length := inStream nextUnsignedLongMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1764
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1765
    line_number_table_length := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1766
    line_number_table_length ~~ 0 ifTrue:[
330
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1767
        line_number_table := Array new:line_number_table_length.
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1768
        1 to:line_number_table_length do:[:i |
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1769
            |start_pc line_number|
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1770
330
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1771
            start_pc := inStream nextUnsignedShortMSB:msb.
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1772
            line_number := inStream nextUnsignedShortMSB:msb.
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1773
            line_number_table at:i put:(start_pc -> line_number).
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1774
        ].
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1775
        Verbose ifTrue:[Transcript showCR:'method has a lineNumberTable'].
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1776
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1777
        aJavaMethod setLineNumberTable:line_number_table.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1778
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1779
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1780
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1781
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1782
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1783
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1784
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1785
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1786
330
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1787
    "Created: / 15.4.1996 / 15:40:17 / cg"
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1788
    "Modified: / 7.4.1998 / 19:08:42 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1789
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1790
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1791
readLocalVariableTableAttributeFor:aJavaMethod
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1792
    |attribute_length local_variable_table_length local_variable_table|
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1793
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1794
    attribute_length := inStream nextUnsignedLongMSB:msb.
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1795
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1796
    local_variable_table_length := inStream nextUnsignedShortMSB:msb.
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1797
    local_variable_table_length ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1798
	local_variable_table := JavaLocalVariableTable new:local_variable_table_length.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1799
	1 to:local_variable_table_length do:[:i |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1800
	    |start_pc length name_index sig_index slot name signature|
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1801
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1802
	    start_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1803
	    length := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1804
	    name_index := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1805
	    name := constants at:name_index.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1806
	    sig_index := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1807
	    signature := constants at:sig_index.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1808
	    slot := inStream nextUnsignedShortMSB:msb.
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1809
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1810
	    local_variable_table at:i put:(JavaLocalVariableTableEntry new 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1811
						startPC:start_pc 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1812
						length:length
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1813
						name:name
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1814
						signature:signature
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1815
						slot:slot)
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1816
	].
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1817
    ].
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1818
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1819
    Verbose ifTrue:[Transcript showCR:'method has a localvariableTable'].
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1820
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1821
    aJavaMethod setLocalVariableTable:local_variable_table.
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1822
    ^ true
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1823
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1824
    "
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1825
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1826
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class'
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1827
    "
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1828
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1829
    "Modified: 15.4.1996 / 15:33:28 / cg"
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1830
    "Created: 15.4.1996 / 15:40:17 / cg"
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1831
!
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1832
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1833
readMethodFor:aJavaClass
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1834
    |m access_flags name_index name signature_index signature
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1835
     tooManyArgs|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1836
083530508d9c intitial checkin
cg
parents:
diff changeset
  1837
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
  1838
    "/ get a method
083530508d9c intitial checkin
cg
parents:
diff changeset
  1839
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1840
    access_flags := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1841
    name_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1842
    signature_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1843
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1844
    name := constants at:name_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1845
    signature := constants at:signature_index.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1846
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1847
    Verbose ifTrue:[Transcript show:'method name:'; showCR:name.
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1848
                    Transcript show:'signature:'; showCR:signature.].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1849
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1850
    m := JavaMethod new.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1851
    m setAccessFlags:access_flags.
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1852
    tooManyArgs := false.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1853
    Method argumentSignal handle:[:ex |
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1854
        'JAVA: ***** java method has too many arguments - will fail to execute' infoPrintCR.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1855
        tooManyArgs := true.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1856
        ex proceed.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1857
    ] do:[
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1858
        m setName:name signature:signature.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1859
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1860
    m setJavaClass:aJavaClass.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1861
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1862
    self readAttributesFor:m.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1863
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1864
    tooManyArgs ifTrue:[
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1865
        m code:nil.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1866
        m byteCode:nil.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1867
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1868
    aJavaClass addMethod:m name:name signature:signature.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1869
083530508d9c intitial checkin
cg
parents:
diff changeset
  1870
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1871
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1872
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1873
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1874
    "Created: / 15.4.1996 / 16:48:49 / cg"
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1875
    "Modified: / 27.1.1998 / 17:46:53 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1876
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1877
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1878
readMethodsFor:aJavaClass
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1879
    |methodsCount method|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1880
083530508d9c intitial checkin
cg
parents:
diff changeset
  1881
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
  1882
    "/ get methods
083530508d9c intitial checkin
cg
parents:
diff changeset
  1883
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1884
    methodsCount := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1885
    Verbose ifTrue:[Transcript show:'methodsCount = '; showCR:methodsCount].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1886
083530508d9c intitial checkin
cg
parents:
diff changeset
  1887
    1 to:methodsCount do:[:i |
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1888
        Verbose ifTrue:[Transcript show:'method: '; showCR:i].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1889
        method := self readMethodFor:aJavaClass
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1890
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1891
083530508d9c intitial checkin
cg
parents:
diff changeset
  1892
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1893
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1894
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1895
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1896
    "Created: / 15.4.1996 / 16:46:30 / cg"
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1897
    "Modified: / 8.5.1998 / 21:20:59 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1898
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
  1899
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1900
!JavaClassReader methodsFor:'file reading - methods-ST'!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1901
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1902
readSTCodeAttributeFor:aSmalltalkMethod
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1903
    |attribute_length max_stack max_locals code_length code
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1904
     exception_table_length unknown1 unknown2|
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1905
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1906
    attribute_length := inStream nextUnsignedLongMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1907
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1908
    Verbose ifTrue:[Transcript show:'attribute_length: 0x'; showCR:(attribute_length printStringRadix:16)].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1909
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1910
    max_stack := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1911
    max_locals := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1912
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1913
    code_length := inStream nextUnsignedLongMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1914
    Verbose ifTrue:[Transcript show:'code_length: '; showCR:(code_length printStringRadix:16)].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1915
    Verbose ifTrue:[Transcript show:'code at pos: '; showCR:inStream position].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1916
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1917
    code := ByteArray new:code_length.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1918
    inStream nextBytes:code_length into:code startingAt:1.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1919
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1920
    Verbose ifTrue:[Transcript show:'method code:'; showCR:code.].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1921
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1922
    exception_table_length := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1923
    Verbose ifTrue:[Transcript show:'exception_table_length: '; showCR:(exception_table_length printStringRadix:16)].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1924
    exception_table_length ~~ 0 ifTrue:[
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1925
        self error:'unexpected exceptionTable length'.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1926
        "/ skip it.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1927
        1 to:exception_table_length do:[:i |
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1928
            "start_pc :="   inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1929
            "end_pc :="     inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1930
            "handler_pc :=" inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1931
            "catch_type :=" inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1932
        ].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1933
    ].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1934
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1935
    aSmalltalkMethod 
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1936
        setCode:code 
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1937
        maxStack:max_stack 
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1938
        numLocals:max_locals. 
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1939
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1940
    self readAttributesFor:aSmalltalkMethod.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1941
    ^ true
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1942
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1943
    "Modified: / 8.5.1998 / 21:19:40 / cg"
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1944
!
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1945
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1946
readSTLiteralsAttributeFor:aSmalltalkMethod
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1947
    |attribute_length literal_table_length literal_table litIndex literal|
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1948
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1949
    attribute_length := inStream nextUnsignedLongMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1950
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1951
    literal_table_length := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1952
    literal_table_length ~~ 0 ifTrue:[
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1953
        literal_table := Array new:literal_table_length.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1954
        1 to:literal_table_length do:[:i |
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1955
            litIndex := inStream nextUnsignedShortMSB:msb.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1956
            literal := (constants at:litIndex).
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1957
            literal_table at:i put:literal.
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1958
        ].
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1959
    ].
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1960
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1961
    "Created: / 7.5.1998 / 11:52:28 / cg"
348
10725e1a2aee more st-class reading
cg
parents: 344
diff changeset
  1962
    "Modified: / 8.5.1998 / 20:39:59 / cg"
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1963
! !
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1964
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
  1965
!JavaClassReader class methodsFor:'documentation'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1966
083530508d9c intitial checkin
cg
parents:
diff changeset
  1967
version
353
666b33cfc98f *** empty log message ***
cg
parents: 352
diff changeset
  1968
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.65 1998/05/12 20:25:02 cg Exp $'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1969
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
  1970
JavaClassReader initialize!