JavaClassReader.st
author cg
Thu, 07 May 1998 17:44:00 +0000
changeset 344 e97744a854f7
parent 335 5309d0a795b1
child 348 10725e1a2aee
permissions -rw-r--r--
code cleanup; first preps for smalltalk constants.
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
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   228
    |javaClass pool|
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   229
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   230
    javaClass := self readFile:aFilename ignoring:classesBeingLoaded.
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   231
    javaClass notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   232
	Java at:(javaClass fullName asSymbol) put:javaClass.
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   233
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   234
	classesBeingLoaded remove:javaClass fullName ifAbsent:nil.
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   235
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   236
	JavaUnresolvedConstant resolveFor:javaClass.
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   237
    ].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   238
    ^ javaClass
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   239
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   240
    "
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   241
     JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   242
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   243
     '/phys/ibm3/java/lib/java/lang' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   244
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   245
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   246
		('/phys/ibm3/java/lib/java/lang/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   247
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   248
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   249
	].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   250
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   251
     '/phys/ibm3/java/lib/java/io' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   252
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   253
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   254
		('/phys/ibm3/java/lib/java/io/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   255
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/io/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   256
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   257
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   258
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   259
     '/phys/ibm3/java/lib/java/net' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   260
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   261
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   262
		('/phys/ibm3/java/lib/java/net/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   263
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/net/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   264
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   265
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   266
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   267
     '/phys/ibm3/java/lib/java/util' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   268
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   269
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   270
		('/phys/ibm3/java/lib/java/util/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   271
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/util/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   272
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   273
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   274
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   275
     '/phys/ibm3/java/lib/java/awt' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   276
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   277
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   278
		('/phys/ibm3/java/lib/java/awt/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   279
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/awt/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   280
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   281
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   282
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   283
     '/phys/ibm3/java/lib/java/applet' asFilename
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   284
	directoryContents do:[:nm |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   285
	    (nm endsWith:'.class') ifTrue:[
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   286
		('/phys/ibm3/java/lib/java/applet/' , nm) printNL.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   287
		JavaClassReader loadFile:'/phys/ibm3/java/lib/java/applet/' , nm
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   288
	    ]
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   289
	].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   290
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   291
     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
   292
     JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/Thread.class'
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   293
    "
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   294
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   295
    "Created: 15.4.1996 / 14:58:53 / cg"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   296
!
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   297
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   298
loadStreamLazy:aStream ignoring:classesBeingLoaded
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   299
    "reads a class from aStream, installs and returns it.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   300
     Strings are fixed and classrefs are fixed, 
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   301
     but NO no class-init functions are called."
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   302
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   303
    |javaClass pool|
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   304
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   305
    javaClass := self readStream:aStream ignoring:classesBeingLoaded.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   306
    javaClass notNil ifTrue:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   307
        Java at:(javaClass fullName asSymbol) put:javaClass.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   308
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   309
        classesBeingLoaded remove:javaClass fullName ifAbsent:nil.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   310
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   311
        JavaUnresolvedConstant resolveFor:javaClass.
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
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   314
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   315
    "Created: / 30.3.1998 / 17:59:02 / cg"
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   316
!
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   317
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   318
postLoadActions
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   319
    "Resolve all classes' string constants.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   320
     Perform all class initialization functions (of those which are not
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   321
     yet initialized)."
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   322
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   323
    ^ self postLoadActions:true
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   324
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   325
    "Modified: 15.8.1997 / 01:02:17 / cg"
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   326
!
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   327
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   328
postLoadActions:loadUnresolved
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   329
    "Resolve all classes' string constants.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   330
     Perform all class initialization functions 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   331
     (of those which are not yet initialized)."
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   332
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   333
    |classes prevUnresolved newUnresolved loader|
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   334
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   335
    "/ need at least java.lang.String, for valid constants
167
77dcbc4b2201 *** empty log message ***
cg
parents: 135
diff changeset
   336
    Java java_lang_String isNil ifTrue:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   337
        self loadClassLazy:'java.lang.String' ignoring:(Set new).
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   338
    ].
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   339
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   340
    LazyClassLoading ifFalse:[
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   341
        loader := ClassLoaderQuerySignal raise.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   342
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   343
        prevUnresolved := nil.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   344
        newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   345
        loadUnresolved ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   346
            [prevUnresolved ~= newUnresolved] whileTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   347
                newUnresolved do:[:nextUnresolved |
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   348
                    |classURL|
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   349
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   350
                    (Java at:nextUnresolved) isNil ifTrue:[ "/ could have been loaded in the meantime
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   351
                        Silent ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   352
                            'loading unresolved: ' print. nextUnresolved printCR.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   353
                        ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   354
                        loader isNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   355
                            self
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   356
                                loadClassLazy:nextUnresolved
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   357
                                ignoring:(Set new).
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   358
                        ] ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   359
                            "/
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   360
                            "/ the aquired loader is a javaClassLoader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   361
                            "/ which expects an URL as arg.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   362
                            "/
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   363
                            "/ classURL := Java as_URL:('file:' , nextUnresolved asString , '.class').
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   364
                            "/ loader loadClass:classURL
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   365
                            loader
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   366
                                perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   367
                                with:(Java as_String:(nextUnresolved asString)).
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   368
                        ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   369
                    ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   370
                ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   371
                prevUnresolved := newUnresolved.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   372
                newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   373
            ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   374
        ].
229
b91c9462ac83 *** empty log message ***
cg
parents: 225
diff changeset
   375
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   376
        newUnresolved size == 0 ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   377
            "/ nothing unresolved
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   378
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   379
            (classes := Java allClasses) notNil ifTrue:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   380
                "/ init all new classes
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   381
                "/ fetch again - there could be new ones ...
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   382
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   383
                classes := Java allClasses.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   384
                classes do:[:aJavaClass |
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   385
                    aJavaClass isInitialized ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   386
                        Silent ifFalse:[
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   387
                            'performing class initialization of ' print. aJavaClass fullName printCR.
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   388
                        ].
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   389
                        aJavaClass classInit
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   390
                    ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   391
                ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   392
            ]
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   393
        ].
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   394
    ]
167
77dcbc4b2201 *** empty log message ***
cg
parents: 135
diff changeset
   395
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   396
    "Created: / 15.8.1997 / 01:01:44 / cg"
255
2d8b3948a08a *** empty log message ***
cg
parents: 252
diff changeset
   397
    "Modified: / 7.1.1998 / 14:13:55 / cg"
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   398
!
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   399
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   400
readFile:aFilename ignoring:classesBeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   401
    "reads a class from aFilename and returns it.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   402
     The JavaClass is NOT installed as global and unresolved
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   403
     refs are NOT patched."
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   404
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   405
    |inStream javaClass|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   406
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   407
    Silent ifFalse:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   408
        'reading ' print. aFilename print. ' ...' printNL.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   409
    ].
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   410
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   411
    inStream := aFilename asFilename readStream.
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   412
    inStream isNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   413
        ('JAVA [info]: no file: ' , aFilename) printCR.
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   414
        self halt.
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   415
        ^ nil
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   416
    ].
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   417
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   418
    javaClass := self new readStream:inStream ignoring:classesBeingLoaded.
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   419
    javaClass notNil ifTrue:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   420
        javaClass setBinaryFilePath:(inStream pathName).
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   421
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   422
    inStream close.
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
   423
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   424
    AbsolutelySilent ifFalse:[
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   425
        '  ... loaded ' print. javaClass displayString printNL.
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
   426
    ].
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
   427
73
a1268823f1a4 *** empty log message ***
cg
parents: 72
diff changeset
   428
    ^ javaClass
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   429
318
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   430
    "Created: / 15.4.1996 / 14:58:53 / cg"
8720093188f7 debugPrints
cg
parents: 278
diff changeset
   431
    "Modified: / 6.2.1998 / 02:20:58 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   432
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   433
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   434
readStream:aStream
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   435
    "reads a class from aStream and returns it.
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   436
     The JavaClass is installed as global.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   437
     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
   438
     is created."
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   439
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   440
    ^ self readStream:aStream loader:nil
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   441
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   442
    "Modified: 14.8.1997 / 19:51:50 / cg"
198
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   443
!
5543d1079a4a *** empty log message ***
cg
parents: 193
diff changeset
   444
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   445
readStream:aStream ignoring:classesBeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   446
    "reads a class from aStream and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   447
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   448
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   449
    |javaClass|
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   450
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   451
    javaClass :=  self new readStream:aStream ignoring:classesBeingLoaded.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   452
327
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   453
    AbsolutelySilent ifFalse:[
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   454
        '  ... loaded ' print. javaClass displayString printNL.
990c71581df3 support reading from zip-archives
cg
parents: 318
diff changeset
   455
    ].
1
083530508d9c intitial checkin
cg
parents:
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
    "Modified: / 30.3.1998 / 18:14:40 / cg"
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   460
!
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   461
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   462
readStream:aStream loader:aClassLoader
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   463
    "reads a class from aStream and returns it.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   464
     The JavaClass is installed as global.
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   465
     If new classes are required to be loaded, aClassLoader is
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   466
     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
   467
     is created."
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   468
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   469
    ^ self
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   470
	readStream:aStream 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   471
	loader:aClassLoader 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   472
	loadUnresolved:true
225
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   473
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   474
    "Modified: 15.8.1997 / 01:00:35 / cg"
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   475
!
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   476
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   477
readStream:aStream loader:aClassLoader loadUnresolved:loadUnresolved
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   478
    "reads a class from aStream and returns it.
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   479
     The JavaClass is installed as global.
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   480
     If new classes are required to be loaded, aClassLoader is
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   481
     asked to do it. If aClassLoader is nil, a new standard loader
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   482
     is created."
b11dde7c1df2 more classLoader hooks
cg
parents: 223
diff changeset
   483
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   484
    |javaClass|
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   485
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   486
    ClassLoaderQuerySignal answer:aClassLoader
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   487
    do:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   488
        javaClass := self readStream:aStream ignoring:(Set new).
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   489
        javaClass notNil ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   490
            self postLoadActions:loadUnresolved.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   491
            Java at:(javaClass fullName asSymbol) put:javaClass.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   492
            JavaUnresolvedConstant resolveFor:javaClass.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   493
        ].
223
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   494
    ].
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   495
    ^ javaClass
4dd38bd4f6b2 allow trampoulining back into java for sub-loads
cg
parents: 219
diff changeset
   496
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   497
    "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
   498
    "Modified: / 23.1.1998 / 17:14:09 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   499
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
   500
083530508d9c intitial checkin
cg
parents:
diff changeset
   501
!JavaClassReader methodsFor:'file reading'!
083530508d9c intitial checkin
cg
parents:
diff changeset
   502
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   503
readClassFileIgnoring:classesbeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   504
    "reads a class from inStream and returns it.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   505
     The JavaClass is not installed as global and its constants
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   506
     (especially strings) may not be fully resolved."
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   507
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   508
    |magic 
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   509
     access_flags this_class this_class_index super_class super_class_index
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   510
     realSuperClass this_class_ref existingSuperClass
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   511
     fields interfaces staticFields nStatic
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   512
     jSuperClass loader|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   513
083530508d9c intitial checkin
cg
parents:
diff changeset
   514
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   515
    "/ read magic, determine byte order
083530508d9c intitial checkin
cg
parents:
diff changeset
   516
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   517
    msb := true.
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   518
    magic := inStream nextUnsignedLongMSB:true.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   519
    magic = (self class magic_MSB) ifFalse:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   520
        magic = (self class magic_LSB) ifFalse:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   521
            InvalidClassFormatSignal raiseErrorString:'not a java class file'.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   522
            ^ nil
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   523
        ].
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   524
        msb := false.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   525
        Verbose ifTrue:[Transcript showCR:'file is lsb'].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   526
    ] ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   527
        Verbose ifTrue:[Transcript showCR:'file is msb'].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   528
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   529
083530508d9c intitial checkin
cg
parents:
diff changeset
   530
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   531
    "/ get version
083530508d9c intitial checkin
cg
parents:
diff changeset
   532
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   533
    minorVsn := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   534
    majorVsn := inStream nextUnsignedShortMSB:msb.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   535
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   536
    (majorVsn ~~ (self class fileMajorVersion) 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   537
    or:[minorVsn ~~ (self class fileMinorVersion)]) ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   538
        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
   539
    ].
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   540
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   541
    Verbose ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   542
        Transcript show:'version = '; 
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   543
                   show:(majorVsn printString); 
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   544
                   show:'.';
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   545
                   showCR:(minorVsn printString).
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
   546
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   547
083530508d9c intitial checkin
cg
parents:
diff changeset
   548
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   549
    "/ get constant pool
083530508d9c intitial checkin
cg
parents:
diff changeset
   550
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   551
    self readConstantPool.
083530508d9c intitial checkin
cg
parents:
diff changeset
   552
083530508d9c intitial checkin
cg
parents:
diff changeset
   553
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   554
    "/ access flags
083530508d9c intitial checkin
cg
parents:
diff changeset
   555
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   556
    access_flags := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   557
    this_class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   558
    super_class_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   559
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   560
    super_class_index == 0 ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   561
        super_class := nil
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   562
    ] ifFalse:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   563
        super_class := constants at:super_class_index.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   564
        existingSuperClass := Java classNamed:super_class fullName.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   565
        existingSuperClass notNil ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   566
            super_class := existingSuperClass
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   567
        ] ifFalse:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   568
            (super_class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   569
                Silent ifFalse:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   570
                    'load superClass: ' print. super_class fullName printCR.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   571
                ].
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   572
                loader := ClassLoaderQuerySignal raise.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   573
                loader isNil ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   574
                    existingSuperClass := self class 
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   575
                                        loadClassLazy:(super_class fullName)
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   576
                                        ignoring:classesbeingLoaded.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   577
                ] ifFalse:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   578
                    jSuperClass := loader
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   579
                                perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;'
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   580
                                with:(Java as_String:(super_class fullName)).
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   581
                    existingSuperClass := JavaVM classForJavaClassObject:jSuperClass.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   582
                ].
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   583
                existingSuperClass isNil ifTrue:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   584
                    self halt:('cannot find superclass: ' , super_class fullName).
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   585
                ].
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   586
                super_class := existingSuperClass
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   587
            ] ifFalse:[
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   588
                self halt:'oops - superclass ?'
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   589
            ]
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   590
        ].
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
   591
    ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   592
083530508d9c intitial checkin
cg
parents:
diff changeset
   593
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   594
    "/ get interfaces
083530508d9c intitial checkin
cg
parents:
diff changeset
   595
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   596
    interfaces := self readInterfaces.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   597
083530508d9c intitial checkin
cg
parents:
diff changeset
   598
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   599
    "/ get fields
083530508d9c intitial checkin
cg
parents:
diff changeset
   600
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   601
    fields := self readFieldInfofields.
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   602
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   603
    "/
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   604
    "/ create the fields as instVars
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   605
    "/ static fields are created as class-InstVars
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   606
    "/
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   607
    staticFields := fields select:[:f | f isStatic].
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   608
    nStatic := staticFields size.
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   609
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   610
    this_class_ref := constants at:this_class_index.
182
5f85fd0fec56 checkin from browser
cg
parents: 177
diff changeset
   611
    this_class := JavaClass fullName:(this_class_ref fullName) numStatic:nStatic.
5f85fd0fec56 checkin from browser
cg
parents: 177
diff changeset
   612
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   613
    nStatic ~~ 0 ifTrue:[
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   614
        fields := fields select:[:f | f isStatic not].
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   615
269
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   616
        JavaClass setInstanceVariableStringFromFields:staticFields in:this_class class.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   617
        this_class setStaticFields:staticFields.
5a946303d451 use a helper to associate java.lang.class insts to javaClasses
cg
parents: 264
diff changeset
   618
        this_class initializeStaticFields.
40
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   619
    ].
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   620
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   621
    this_class setAccessFlags:access_flags.
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   622
    this_class setSuperclass:super_class.
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   623
    this_class setConstantPool:constants.
7f332a95e015 checkin from browser
cg
parents: 39
diff changeset
   624
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   625
    this_class setFields:fields.
110
dfb03e2ea321 *** empty log message ***
cg
parents: 104
diff changeset
   626
    this_class setInterfaces:interfaces.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   627
083530508d9c intitial checkin
cg
parents:
diff changeset
   628
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   629
    "/ get methods
083530508d9c intitial checkin
cg
parents:
diff changeset
   630
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   631
    self readMethodsFor:this_class.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   632
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   633
    self readAttributesFor:this_class.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   634
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   635
    constants owner:this_class.
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   636
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   637
    ^ this_class
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   638
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   639
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   640
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   641
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   642
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   643
     JavaClassReader verbose:true.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   644
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/ArithmeticException.class'
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   645
     JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/ArithmeticException.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   646
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   647
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   648
    "Created: / 15.4.1996 / 15:02:47 / cg"
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   649
    "Modified: / 7.5.1998 / 19:43:41 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   650
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   651
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   652
readSourceFileAttributeFor:aJavaClass
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   653
    |attribute_length sourceFile_index sourceFile|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   654
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   655
    attribute_length := inStream nextUnsignedLongMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   656
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   657
    sourceFile_index := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   658
    sourceFile := constants at:sourceFile_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   659
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   660
    aJavaClass setSourceFile:sourceFile.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   661
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   662
    Verbose ifTrue:[Transcript show:'sourceFile: '; showCR:sourceFile].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   663
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   664
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   665
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   666
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   667
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   668
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   669
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   670
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   671
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   672
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   673
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   674
readStream:aStream ignoring:classesBeingLoaded
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   675
    "reads a class from aStream and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   676
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   677
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   678
    inStream := aStream.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   679
    inStream binary.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
   680
54
f37bcefb7091 avoid loading classes twice
cg
parents: 52
diff changeset
   681
    ^ self readClassFileIgnoring:classesBeingLoaded
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   682
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   683
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   684
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   685
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   686
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   687
    "Created: 15.4.1996 / 15:00:55 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   688
    "Modified: 15.4.1996 / 15:06:18 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   689
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   690
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   691
!JavaClassReader methodsFor:'file reading - attributes'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   692
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   693
readAttribute:attributeName for:something
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   694
    "/ implemented ST attributes
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   695
    (attributeName = 'STLiterals') ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   696
        self readSTLiteralsAttributeFor:something.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   697
        ^ self.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   698
    ].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   699
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   700
    "/ implemented JAVA attributes
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   701
    (attributeName = 'Code') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   702
        self readCodeAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   703
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   704
    ].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   705
    (attributeName = 'Exceptions') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   706
        self readExceptionsAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   707
        ^ self.
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   708
    ].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   709
    (attributeName = 'LineNumberTable') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   710
        self readLineNumberTableAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   711
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   712
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   713
    (attributeName = 'LocalVariableTable') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   714
        self readLocalVariableTableAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   715
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   716
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   717
    (attributeName = 'ConstantValue') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   718
        self readConstantValueAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   719
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   720
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   721
    (attributeName = 'SourceFile') ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   722
        self readSourceFileAttributeFor:something.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   723
        ^ self.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   724
    ].
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   725
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   726
    "/ ignored JAVA attributes
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   727
    (attributeName = 'Deprecated') ifTrue:[
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   728
        ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   729
        self skipAttribute:attributeName.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   730
        ^ self.
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   731
    ].
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   732
    (attributeName = 'AbsoluteSourcePath') ifTrue:[
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   733
        ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   734
        self skipAttribute:attributeName.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   735
        ^ self.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   736
    ].
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   737
    (attributeName = 'Synthetic') ifTrue:[
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   738
        ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   739
        self skipAttribute:attributeName.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   740
        ^ self.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   741
    ].
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   742
    (attributeName = 'InnerClasses') ifTrue:[
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   743
        ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   744
        self skipAttribute:attributeName.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   745
        ^ self.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   746
    ].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
   747
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   748
    "/ unknwon attributes
335
5309d0a795b1 checkin from browser
cg
parents: 333
diff changeset
   749
    ('JAVA [warning]: unrecognized attribute: ' , attributeName) infoPrintCR.
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   750
    self skipAttribute:attributeName.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   751
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   752
    "Modified: / 7.5.1998 / 11:52:02 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   753
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   754
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   755
readAttributeFor:something
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   756
    |attribute_name_index attribute_name attribute_length attribute_info|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   757
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   758
    Verbose ifTrue:[Transcript show:'attrib at pos: '; showCR:inStream position].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   759
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   760
    attribute_name_index := inStream nextUnsignedShortMSB:msb.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   761
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   762
    "/
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   763
    "/ UNDOC feature ?
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   764
    "/
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   765
    attribute_name_index > constants size ifTrue:[
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   766
        attribute_name_index == 16rb700 ifTrue:[
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   767
            self halt.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   768
        ]
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   769
    ].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   770
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   771
    attribute_name := constants at:attribute_name_index.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   772
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   773
    Verbose ifTrue:[Transcript show:'attrib name: '; showCR:attribute_name].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   774
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   775
    self readAttribute:attribute_name for:something.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   776
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   777
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   778
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   779
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   780
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   781
    "Created: / 15.4.1996 / 15:40:17 / cg"
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   782
    "Modified: / 9.4.1998 / 18:13:34 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   783
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   784
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   785
readAttributesFor:something
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   786
    |attributes_count|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   787
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   788
    attributes_count := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   789
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   790
    1 to:attributes_count do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   791
	self readAttributeFor:something.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   792
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   793
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   794
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   795
    "Created: 15.4.1996 / 15:40:17 / cg"
333
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   796
!
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   797
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   798
skipAttribute:attributeName
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   799
    "dont know about this attribute - skip it here"
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   800
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   801
    |attribute_length attribute_info|
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   802
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   803
    attribute_length := inStream nextUnsignedLongMSB:msb.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   804
    attribute_info := ByteArray new:(attribute_length).
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   805
    inStream nextBytes:attribute_length into:attribute_info startingAt:1.
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   806
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   807
    Verbose ifTrue:[Transcript show:'skipped '; show:attributeName; showCR:'-attribute'].
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   808
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   809
    "Created: / 9.4.1998 / 18:12:46 / cg"
1622ff2b686b checkin from browser
cg
parents: 330
diff changeset
   810
    "Modified: / 9.4.1998 / 18:13:20 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   811
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   812
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   813
!JavaClassReader methodsFor:'file reading - constants'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   814
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   815
readConstant
083530508d9c intitial checkin
cg
parents:
diff changeset
   816
    |tag constReader const|
083530508d9c intitial checkin
cg
parents:
diff changeset
   817
083530508d9c intitial checkin
cg
parents:
diff changeset
   818
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   819
    constNeeds2Slots := false.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   820
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   821
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   822
    "/ get tag
083530508d9c intitial checkin
cg
parents:
diff changeset
   823
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   824
    tag := inStream nextByte.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   825
    Verbose ifTrue:[Transcript show:'tag = '; showCR:tag].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   826
083530508d9c intitial checkin
cg
parents:
diff changeset
   827
    constReader := #(
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   828
                        "/ JAVA types
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   829
                        readConstant_Asciz              "/ 1  - now called Utf8
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   830
                        readConstant_Unicode            "/ 2
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   831
                        readConstant_Integer            "/ 3
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   832
                        readConstant_Float              "/ 4
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   833
                        readConstant_Long               "/ 5
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   834
                        readConstant_Double             "/ 6
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   835
                        readConstant_Class              "/ 7
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   836
                        readConstant_String             "/ 8
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   837
                        readConstant_Fieldref           "/ 9
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   838
                        readConstant_Methodref          "/ 10
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   839
                        readConstant_InterfaceMethodref "/ 11
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   840
                        readConstant_NameAndType        "/ 12
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   841
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   842
                        "/ ST types
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   843
                        readConstant_ST_Symbol          "/ 255
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   844
                        readConstant_ST_Array           "/ 254
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   845
                        readConstant_ST_ByteArray       "/ 253
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   846
                        readConstant_ST_String          "/ 252
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   847
                        readConstant_ST_Character       "/ 251
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   848
                    ) at:tag ifAbsent:[#readConstant_Undef].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   849
083530508d9c intitial checkin
cg
parents:
diff changeset
   850
    ^ self perform:constReader.
083530508d9c intitial checkin
cg
parents:
diff changeset
   851
083530508d9c intitial checkin
cg
parents:
diff changeset
   852
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   853
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   854
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   855
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   856
    "Created: / 15.4.1996 / 15:46:32 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   857
    "Modified: / 7.5.1998 / 11:46:43 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   858
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   859
083530508d9c intitial checkin
cg
parents:
diff changeset
   860
readConstantPool
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   861
    |constantPoolCount const i|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   862
083530508d9c intitial checkin
cg
parents:
diff changeset
   863
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   864
    "/ get constant pool
083530508d9c intitial checkin
cg
parents:
diff changeset
   865
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   866
    constantPoolCount := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   867
    Verbose ifTrue:[Transcript show:'constantPoolCount = '; showCR:constantPoolCount].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   868
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   869
    constants := JavaConstantPool "Array" new:constantPoolCount-1.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   870
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   871
    constSlot := 1.
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   872
    [constSlot < constantPoolCount] whileTrue:[
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   873
        Verbose ifTrue:[Transcript show:'const: '; showCR:constSlot].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   874
        const := self readConstant.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   875
        constants at:constSlot put:const.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   876
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   877
        "/ long & double consts take 2 slots
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   878
        "/ (only first is used)
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   879
        constNeeds2Slots ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   880
            constSlot := constSlot + 2.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   881
        ] ifFalse:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   882
            constSlot := constSlot + 1.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   883
        ]
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   884
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   885
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   886
    constSlot := -1.
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   887
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   888
    "/ preresolve what can be (especially, strings are resolved here)
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   889
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   890
    1 to:constantPoolCount-1 do:[:i |
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   891
        |const value|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   892
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   893
        const := constants at:i.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   894
        const notNil ifTrue:[   "/ kludge for 2-slot constants (which only take 1 slot in ST/X)
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   895
            (const isKindOf:JavaUnresolvedConstant) ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   896
                value := const preResolve.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   897
                value ~~ const ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   898
                    constants at:i put:value.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   899
                ]
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   900
            ]
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   901
        ]
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   902
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   903
083530508d9c intitial checkin
cg
parents:
diff changeset
   904
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   905
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   906
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   907
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   908
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   909
    "Created: / 15.4.1996 / 15:14:11 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
   910
    "Modified: / 7.5.1998 / 11:44:06 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   911
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   912
083530508d9c intitial checkin
cg
parents:
diff changeset
   913
readConstant_Asciz
083530508d9c intitial checkin
cg
parents:
diff changeset
   914
    |len string|
083530508d9c intitial checkin
cg
parents:
diff changeset
   915
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   916
    len := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   917
    string := String new:len.
083530508d9c intitial checkin
cg
parents:
diff changeset
   918
    inStream nextBytes:len into:string startingAt:1.
083530508d9c intitial checkin
cg
parents:
diff changeset
   919
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   920
    Verbose ifTrue:[Transcript show:'asciz; string= ';     showCR:string].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   921
083530508d9c intitial checkin
cg
parents:
diff changeset
   922
    ^ string
083530508d9c intitial checkin
cg
parents:
diff changeset
   923
083530508d9c intitial checkin
cg
parents:
diff changeset
   924
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   925
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   926
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   927
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   928
083530508d9c intitial checkin
cg
parents:
diff changeset
   929
    "Created: 15.4.1996 / 15:15:35 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   930
    "Modified: 15.4.1996 / 16:33:45 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   931
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   932
083530508d9c intitial checkin
cg
parents:
diff changeset
   933
readConstant_Class
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   934
    |name_index name|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   935
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   936
    name_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   937
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   938
    Verbose ifTrue:[Transcript show:'class; index= '; showCR:name_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   939
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   940
    name := constants at:name_index.
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   941
    name notNil ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   942
	Verbose ifTrue:[Transcript showCR:'name in constant_class already resolved'].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   943
	"/ self halt
52
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   944
    ].
1dc41619b6f8 checkin from browser
cg
parents: 50
diff changeset
   945
21
b9dd73f299dd checkin from browser
cg
parents: 14
diff changeset
   946
    ^ JavaUnresolvedClassConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   947
	pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   948
	poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   949
	nameIndex:name_index
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
   950
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   951
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   952
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   953
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   954
083530508d9c intitial checkin
cg
parents:
diff changeset
   955
    "Created: 15.4.1996 / 15:21:13 / cg"
193
859177de4b04 *** empty log message ***
cg
parents: 182
diff changeset
   956
    "Modified: 1.8.1997 / 21:27:28 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   957
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   958
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   959
readConstant_Double
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   960
    |high low aFloat|
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   961
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   962
    high := inStream nextUnsignedLongMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
   963
    low := inStream nextUnsignedLongMSB:msb.
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   964
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   965
    aFloat := Float new.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   966
    UninterpretedBytes isBigEndian ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   967
	aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   968
	aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   969
	aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   970
	aFloat basicAt:4 put:(high bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   971
	aFloat basicAt:5 put:((low bitShift:-24) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   972
	aFloat basicAt:6 put:((low bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   973
	aFloat basicAt:7 put:((low bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   974
	aFloat basicAt:8 put:(low bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   975
    ] ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   976
	aFloat basicAt:1 put:(low bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   977
	aFloat basicAt:2 put:((low bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   978
	aFloat basicAt:3 put:((low bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   979
	aFloat basicAt:4 put:((low bitShift:-24) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   980
	aFloat basicAt:5 put:(high bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   981
	aFloat basicAt:6 put:((high bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   982
	aFloat basicAt:7 put:((high bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
   983
	aFloat basicAt:8 put:((high bitShift:-24) bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   984
    ].
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   985
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   986
    constNeeds2Slots := true.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   987
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
   988
    Verbose ifTrue:[Transcript show:'double; value= ';     showCR:aFloat].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   989
    ^ aFloat
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   990
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   991
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   992
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   993
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   994
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   995
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   996
    "Modified: 15.4.1996 / 15:42:16 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   997
    "Created: 15.4.1996 / 16:34:42 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   998
!
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
   999
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1000
readConstant_Fieldref
083530508d9c intitial checkin
cg
parents:
diff changeset
  1001
    |class_index name_and_type_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1002
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1003
    class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1004
    name_and_type_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1005
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1006
    Verbose ifTrue:[Transcript show:'fieldref; classindex= ';     showCR:class_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1007
    Verbose ifTrue:[Transcript show:'fieldref; name&typeindex= '; showCR:name_and_type_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1008
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1009
    ^ JavaUnresolvedFieldrefConstant
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1010
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1011
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1012
		classIndex:class_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1013
		nameandTypeIndex:name_and_type_index
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1014
083530508d9c intitial checkin
cg
parents:
diff changeset
  1015
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1016
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1017
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1018
083530508d9c intitial checkin
cg
parents:
diff changeset
  1019
    "Created: 15.4.1996 / 15:22:18 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1020
    "Modified: 15.4.1996 / 16:07:01 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1021
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1022
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1023
readConstant_Float
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1024
    |high aFloat|
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1025
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1026
    high := inStream nextUnsignedLongMSB:msb.
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1027
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1028
    aFloat := ShortFloat basicNew.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1029
    UninterpretedBytes isBigEndian ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1030
	aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1031
	aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1032
	aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1033
	aFloat basicAt:4 put:(high bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1034
    ] ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1035
	aFloat basicAt:1 put:(high bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1036
	aFloat basicAt:2 put:((high bitShift:-8) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1037
	aFloat basicAt:3 put:((high bitShift:-16) bitAnd:16rFF).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1038
	aFloat basicAt:4 put:((high bitShift:-24) bitAnd:16rFF).
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1039
    ].
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1040
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1041
    Verbose ifTrue:[Transcript show:'float; value= ';     showCR:aFloat].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1042
    ^ aFloat
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1043
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1044
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1045
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1046
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1047
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1048
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1049
    "Modified: 15.4.1996 / 15:42:16 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1050
    "Created: 15.4.1996 / 16:34:42 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1051
!
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1052
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1053
readConstant_Integer
083530508d9c intitial checkin
cg
parents:
diff changeset
  1054
    |value|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1055
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1056
    value := inStream nextLongMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1057
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1058
    Verbose ifTrue:[Transcript show:'integer; value= ';     showCR:value].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1059
083530508d9c intitial checkin
cg
parents:
diff changeset
  1060
    ^ value
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
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1065
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1066
083530508d9c intitial checkin
cg
parents:
diff changeset
  1067
    "Modified: 15.4.1996 / 15:42:16 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1068
    "Created: 15.4.1996 / 16:34:42 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1069
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1070
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1071
readConstant_InterfaceMethodref
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1072
    |class_index name_and_type_index|
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1073
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1074
    class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1075
    name_and_type_index := inStream nextUnsignedShortMSB:msb.
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1076
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1077
    Verbose ifTrue:[Transcript show:'methodref; classindex= ';     showCR:class_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1078
    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
  1079
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1080
    ^ JavaUnresolvedInterfaceMethodrefConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1081
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1082
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1083
		classIndex:class_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1084
		nameandTypeIndex:name_and_type_index
14
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1085
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1086
    "
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1087
     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
  1088
    "
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1089
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1090
    "Created: 15.4.1996 / 15:22:37 / cg"
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1091
    "Modified: 15.4.1996 / 16:07:19 / cg"
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1092
!
c1d9f60eb650 can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents: 11
diff changeset
  1093
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1094
readConstant_Long
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1095
    |high low value|
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1096
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1097
    high := inStream nextUnsignedLongMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1098
    low := inStream nextUnsignedLongMSB:msb.
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1099
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1100
    value := (high bitShift:32) bitOr:low.
60
a763b1780ec0 checkin from browser
cg
parents: 59
diff changeset
  1101
    (high bitTest:16r80000000) ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1102
	value := value - 16r10000000000000000.
60
a763b1780ec0 checkin from browser
cg
parents: 59
diff changeset
  1103
    ].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1104
    constNeeds2Slots := true.
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1105
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1106
    Verbose ifTrue:[Transcript show:'long; value= ';     showCR:value].
11
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1107
    ^ value
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1108
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1109
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1110
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1111
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1112
    "
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1113
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1114
    "Modified: 15.4.1996 / 15:42:16 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1115
    "Created: 15.4.1996 / 16:34:42 / cg"
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1116
!
30997f6943a4 checkin from browser
cg
parents: 9
diff changeset
  1117
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1118
readConstant_Methodref
083530508d9c intitial checkin
cg
parents:
diff changeset
  1119
    |class_index name_and_type_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1120
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1121
    class_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1122
    name_and_type_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1123
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1124
    Verbose ifTrue:[Transcript show:'methodref; classindex= ';     showCR:class_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1125
    Verbose ifTrue:[Transcript show:'methodref; name&typeindex= '; showCR:name_and_type_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1126
083530508d9c intitial checkin
cg
parents:
diff changeset
  1127
    ^ JavaUnresolvedMethodrefConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1128
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1129
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1130
		classIndex:class_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1131
		nameandTypeIndex:name_and_type_index
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1132
083530508d9c intitial checkin
cg
parents:
diff changeset
  1133
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1134
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1135
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1136
083530508d9c intitial checkin
cg
parents:
diff changeset
  1137
    "Created: 15.4.1996 / 15:22:37 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1138
    "Modified: 15.4.1996 / 16:07:19 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1139
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1140
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1141
readConstant_NameAndType
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1142
    |name_index signature_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1143
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1144
    name_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1145
    signature_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1146
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1147
    Verbose ifTrue:[Transcript show:'methodref; nameindex= ';     showCR:name_index].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1148
    Verbose ifTrue:[Transcript show:'methodref; signatureindex= '; showCR:signature_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1149
083530508d9c intitial checkin
cg
parents:
diff changeset
  1150
    ^ JavaUnresolvedNameandTypeConstant 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1151
		pool:constants
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1152
		poolIndex:constSlot
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1153
		nameIndex:name_index
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1154
		signatureIndex:signature_index  
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1155
083530508d9c intitial checkin
cg
parents:
diff changeset
  1156
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1157
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1158
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1159
083530508d9c intitial checkin
cg
parents:
diff changeset
  1160
    "Created: 15.4.1996 / 15:23:43 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1161
    "Modified: 15.4.1996 / 16:17:16 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1162
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1163
083530508d9c intitial checkin
cg
parents:
diff changeset
  1164
readConstant_String
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1165
    |tag string_index chars jString|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1166
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1167
    string_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1168
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1169
    Verbose ifTrue:[Transcript show:'string; index= '; showCR:string_index].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1170
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1171
    "/ resolve here if possible
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1172
    string_index < constSlot ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1173
        Java java_lang_String notNil ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1174
            chars := (constants at:string_index).
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1175
            chars isString ifFalse:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1176
                self halt:'should not happen'
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1177
            ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1178
            jString := Java as_String:chars.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1179
            ^ jString.        
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1180
        ]
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1181
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1182
91
9b325648aa77 resolve rewritten; interpreter fixes
cg
parents: 86
diff changeset
  1183
    ^ JavaUnresolvedStringConstant 
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1184
        pool:constants 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1185
        poolIndex:constSlot
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1186
        stringIndex:string_index
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1187
083530508d9c intitial checkin
cg
parents:
diff changeset
  1188
    "
43
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
  1189
     Verbose := true.
2c4ca2eb8d07 checkin from browser
cg
parents: 40
diff changeset
  1190
     JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/System.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1191
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1192
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1193
    "Created: / 15.4.1996 / 15:20:33 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1194
    "Modified: / 7.5.1998 / 11:42:45 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1195
! !
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1196
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1197
!JavaClassReader methodsFor:'file reading - constants-ST'!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1198
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1199
readConstant_ST_Array
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1200
    |aSize arr|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1201
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1202
    aSize := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1203
    arr := Array new:aSize.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1204
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1205
    1 to:aSize do:[:i |
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1206
        |element_index|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1207
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1208
        element_index := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1209
        arr at:i put:element_index.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1210
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1211
    Verbose ifTrue:[Transcript show:'array; size= ';     showCR:aSize].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1212
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1213
    ^ JavaUnresolvedSTArrayConstant 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1214
                pool:constants
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1215
                poolIndex:constSlot
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1216
                array:arr
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1217
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1218
    "Created: / 7.5.1998 / 11:47:01 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1219
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1220
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1221
readConstant_ST_ByteArray
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1222
    |aSize arr|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1223
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1224
    aSize := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1225
    arr := ByteArray new:aSize.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1226
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1227
    1 to:aSize do:[:i |
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1228
        |element_index|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1229
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1230
        arr at:i put:(inStream nextByte).
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1231
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1232
    Verbose ifTrue:[Transcript show:'byteArray; size= ';     showCR:aSize].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1233
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1234
    ^ arr
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1235
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1236
    "Created: / 7.5.1998 / 11:47:12 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1237
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1238
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1239
readConstant_ST_Character
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1240
    |ascii|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1241
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1242
    ascii := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1243
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1244
    Verbose ifTrue:[Transcript show:'char; ascii= '; showCR:ascii].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1245
    ^ Character value:ascii
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1246
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1247
    "Created: / 7.5.1998 / 11:48:12 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1248
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1249
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1250
readConstant_ST_String
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1251
    |tag string_index chars|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1252
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1253
    string_index := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1254
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1255
    Verbose ifTrue:[Transcript show:'string; index= '; showCR:string_index].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1256
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1257
    "/ resolve here if possible
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1258
    string_index < constSlot ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1259
        chars := (constants at:string_index).
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1260
        ^ chars
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1261
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1262
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1263
    ^ JavaUnresolvedSTStringConstant 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1264
        pool:constants 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1265
        poolIndex:constSlot
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1266
        stringIndex:string_index
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1267
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1268
    "Modified: / 7.5.1998 / 11:48:28 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1269
    "Created: / 7.5.1998 / 11:49:55 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1270
!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1271
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1272
readConstant_ST_Symbol
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1273
    |tag string_index chars|
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1274
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1275
    string_index := inStream nextUnsignedShortMSB:msb.
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1276
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1277
    Verbose ifTrue:[Transcript show:'symbol; index= '; showCR:string_index].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1278
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1279
    "/ resolve here if possible
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1280
    string_index < constSlot ifTrue:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1281
        chars := (constants at:string_index).
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1282
        chars isString ifFalse:[
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1283
            self halt:'should not happen'
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1284
        ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1285
        ^ chars asSymbol
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1286
    ].
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1287
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1288
    ^ JavaUnresolvedSTSymbolConstant 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1289
        pool:constants 
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1290
        poolIndex:constSlot
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1291
        stringIndex:string_index
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1292
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1293
    "Modified: / 7.5.1998 / 11:48:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1294
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1295
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1296
!JavaClassReader methodsFor:'file reading - fields'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1297
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1298
readConstantValueAttributeFor:aField
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1299
    |attribute_length constantvalue_index constantValue|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1300
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1301
    attribute_length := inStream nextUnsignedLongMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1302
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1303
    constantvalue_index := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1304
    constantValue := constants at:constantvalue_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1305
59
38114c3e3e77 checkin from browser
cg
parents: 54
diff changeset
  1306
    aField constantValue:constantValue.
38114c3e3e77 checkin from browser
cg
parents: 54
diff changeset
  1307
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1308
    Verbose ifTrue:[Transcript show:'constantValue: '; showCR:constantValue].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1309
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1310
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1311
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1312
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1313
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1314
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1315
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1316
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1317
    "Created: 15.4.1996 / 15:40:17 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1318
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1319
083530508d9c intitial checkin
cg
parents:
diff changeset
  1320
readFieldInfofield
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1321
    |access_flags name_index signature_index attributes_count field|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1322
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1323
    access_flags := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1324
    name_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1325
    signature_index := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1326
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1327
    field := JavaField new.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1328
    field setAccessFlags:access_flags.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1329
    field setName:(constants at:name_index).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1330
    field setSignature:(constants at:signature_index).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1331
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1332
    attributes_count := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1333
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
  1334
    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
  1335
			       show:' access: '; show:access_flags;
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1336
			       show:' attrib_cnt: '; showCR:attributes_count].
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
  1337
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1338
    1 to:attributes_count do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1339
	self readAttributeFor:field.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1340
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1341
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1342
    ^ field
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1343
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1344
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1345
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1346
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1347
083530508d9c intitial checkin
cg
parents:
diff changeset
  1348
    "Modified: 15.4.1996 / 15:33:28 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1349
    "Created: 15.4.1996 / 15:38:43 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1350
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1351
083530508d9c intitial checkin
cg
parents:
diff changeset
  1352
readFieldInfofields
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1353
    |nFields fields|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1354
083530508d9c intitial checkin
cg
parents:
diff changeset
  1355
    "/
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1356
    "/ get fieldInfos
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1357
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1358
    nFields := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1359
    Verbose ifTrue:[Transcript show:'fieldsCount = '; showCR:nFields].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1360
27
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1361
    fields := Array new:nFields.
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1362
4560bb77bb36 checkin from browser
cg
parents: 21
diff changeset
  1363
    1 to:nFields do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1364
	Verbose ifTrue:[Transcript show:'field: '; showCR:i].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1365
	fields at:i put:(self readFieldInfofield)
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1366
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1367
    ^ fields
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1368
083530508d9c intitial checkin
cg
parents:
diff changeset
  1369
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1370
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1371
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1372
083530508d9c intitial checkin
cg
parents:
diff changeset
  1373
    "Created: 15.4.1996 / 15:34:41 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1374
    "Modified: 15.4.1996 / 15:35:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1375
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1376
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1377
!JavaClassReader methodsFor:'file reading - interfaces'!
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1378
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1379
readInterfaces
110
dfb03e2ea321 *** empty log message ***
cg
parents: 104
diff changeset
  1380
    |interfacesCount interface_index interface interfaces|
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1381
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1382
    "/
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1383
    "/ get interfaces
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1384
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1385
    interfacesCount := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1386
    Verbose ifTrue:[Transcript show:'interfacesCount = '; showCR:interfacesCount].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1387
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1388
    interfaces := Array new:interfacesCount.
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1389
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1390
    1 to:interfacesCount do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1391
	Verbose ifTrue:[Transcript show:'interface: '; showCR:i].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1392
	interface_index := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1393
	interface := constants at:interface_index.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1394
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1395
	interfaces at:i put:interface.
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1396
    ].
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1397
    ^ interfaces
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1398
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1399
    "
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1400
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1401
    "
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1402
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1403
    "Created: 15.4.1996 / 15:31:59 / cg"
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1404
    "Modified: 15.4.1996 / 15:33:28 / cg"
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1405
! !
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1406
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1407
!JavaClassReader methodsFor:'file reading - methods'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1408
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1409
readCodeAttributeFor:aJavaMethod
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1410
    |attribute_length max_stack max_locals code_length code
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1411
     exception_table_length exception_table unknown1 unknown2|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1412
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1413
    attribute_length := inStream nextUnsignedLongMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1414
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1415
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1416
    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
  1417
99
d1248315f589 support vsn 45.2 AND 45.3 classFile formats
cg
parents: 97
diff changeset
  1418
    minorVsn > 2 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1419
	unknown1 := inStream nextByte.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1420
	max_stack := inStream nextByte.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1421
	max_locals := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1422
	unknown2 := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1423
	Verbose ifTrue:[Transcript show:'?1: '; showCR:unknown1].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1424
	Verbose ifTrue:[Transcript show:'?2: '; showCR:unknown2].
39
20fa5af3b873 checkin from browser
cg
parents: 38
diff changeset
  1425
    ] ifFalse:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1426
	max_stack := inStream nextByte.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1427
	max_locals := inStream nextByte.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1428
    ].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1429
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1430
    code_length := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1431
    Verbose ifTrue:[Transcript show:'code_length: '; showCR:(code_length printStringRadix:16)].
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1432
    Verbose ifTrue:[Transcript show:'code at pos: '; showCR:inStream position].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1433
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1434
    code := ByteArray new:code_length.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1435
    inStream nextBytes:code_length into:code startingAt:1.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1436
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1437
    Verbose ifTrue:[Transcript show:'method code:'; showCR:code.].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1438
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1439
    exception_table_length := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1440
    Verbose ifTrue:[Transcript show:'exception_table_length: '; showCR:(exception_table_length printStringRadix:16)].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1441
    exception_table_length ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1442
	Verbose ifTrue:[Transcript show:'exceptionTable length:'; showCR:exception_table_length.].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1443
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1444
	exception_table := Array new:exception_table_length.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1445
	1 to:exception_table_length do:[:i |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1446
	    |start_pc end_pc handler_pc catch_type|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1447
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1448
	    start_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1449
	    end_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1450
	    handler_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1451
	    catch_type := constants at:(inStream nextUnsignedShortMSB:msb).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1452
	    exception_table at:i put:(JavaExceptionTableEntry
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1453
					    startPC:start_pc
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1454
					    endPC:end_pc
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1455
					    handlerPC:handler_pc
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1456
					    catchType:catch_type).
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1457
	].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1458
	aJavaMethod setExceptionHandlerTable:exception_table.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1459
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1460
29
eb3367f8fb9b checkin from browser
cg
parents: 27
diff changeset
  1461
    aJavaMethod 
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1462
	setCode:code 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1463
	maxStack:max_stack 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1464
	maxLocals:max_locals 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1465
	u1:unknown1 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1466
	u2:unknown2.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1467
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1468
    self readAttributesFor:aJavaMethod.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1469
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1470
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1471
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1472
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1473
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1474
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1475
083530508d9c intitial checkin
cg
parents:
diff changeset
  1476
    "Modified: 15.4.1996 / 15:33:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1477
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1478
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1479
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1480
readExceptionsAttributeFor:aJavaMethod
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1481
    |attribute_length exception_table_length exception_table|
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1482
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1483
    attribute_length := inStream nextUnsignedLongMSB:msb.
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1484
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1485
    exception_table_length := inStream nextUnsignedShortMSB:msb.
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1486
    exception_table_length ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1487
	exception_table := Array new:exception_table_length.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1488
	1 to:exception_table_length do:[:i |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1489
	    |idx ex|
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1490
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1491
	    idx := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1492
	    ex := constants at:idx.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1493
	    exception_table at:i put:ex.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1494
	].
83
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1495
    ].
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1496
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1497
    Verbose ifTrue:[Transcript showCR:'method has an exceptionTable'].
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1498
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1499
    aJavaMethod setExceptionTable:exception_table.
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1500
    ^ true
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1501
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1502
    "Modified: 15.4.1996 / 15:33:28 / cg"
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1503
    "Created: 15.4.1996 / 15:40:17 / cg"
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1504
!
2d61ef3579e4 *** empty log message ***
cg
parents: 73
diff changeset
  1505
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1506
readLineNumberTableAttributeFor:aJavaMethod
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1507
    |attribute_length line_number_table_length line_number_table|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1508
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1509
    attribute_length := inStream nextUnsignedLongMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1510
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1511
    line_number_table_length := inStream nextUnsignedShortMSB:msb.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1512
    line_number_table_length ~~ 0 ifTrue:[
330
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1513
        line_number_table := Array new:line_number_table_length.
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1514
        1 to:line_number_table_length do:[:i |
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1515
            |start_pc line_number|
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1516
330
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1517
            start_pc := inStream nextUnsignedShortMSB:msb.
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1518
            line_number := inStream nextUnsignedShortMSB:msb.
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1519
            line_number_table at:i put:(start_pc -> line_number).
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1520
        ].
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1521
        Verbose ifTrue:[Transcript showCR:'method has a lineNumberTable'].
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1522
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1523
        aJavaMethod setLineNumberTable:line_number_table.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1524
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1525
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1526
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1527
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1528
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1529
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1530
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1531
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1532
330
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1533
    "Created: / 15.4.1996 / 15:40:17 / cg"
c452e536a822 checkin from browser
cg
parents: 327
diff changeset
  1534
    "Modified: / 7.4.1998 / 19:08:42 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1535
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1536
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1537
readLocalVariableTableAttributeFor:aJavaMethod
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1538
    |attribute_length local_variable_table_length local_variable_table|
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1539
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1540
    attribute_length := inStream nextUnsignedLongMSB:msb.
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1541
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1542
    local_variable_table_length := inStream nextUnsignedShortMSB:msb.
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1543
    local_variable_table_length ~~ 0 ifTrue:[
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1544
	local_variable_table := JavaLocalVariableTable new:local_variable_table_length.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1545
	1 to:local_variable_table_length do:[:i |
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1546
	    |start_pc length name_index sig_index slot name signature|
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1547
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1548
	    start_pc := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1549
	    length := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1550
	    name_index := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1551
	    name := constants at:name_index.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1552
	    sig_index := inStream nextUnsignedShortMSB:msb.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1553
	    signature := constants at:sig_index.
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1554
	    slot := inStream nextUnsignedShortMSB:msb.
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1555
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1556
	    local_variable_table at:i put:(JavaLocalVariableTableEntry new 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1557
						startPC:start_pc 
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1558
						length:length
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1559
						name:name
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1560
						signature:signature
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1561
						slot:slot)
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1562
	].
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1563
    ].
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1564
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1565
    Verbose ifTrue:[Transcript showCR:'method has a localvariableTable'].
50
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1566
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1567
    aJavaMethod setLocalVariableTable:local_variable_table.
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1568
    ^ true
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1569
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1570
    "
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1571
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1572
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class'
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1573
    "
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1574
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1575
    "Modified: 15.4.1996 / 15:33:28 / cg"
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1576
    "Created: 15.4.1996 / 15:40:17 / cg"
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1577
!
458467ce0e15 checkin from browser
cg
parents: 43
diff changeset
  1578
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1579
readMethodFor:aJavaClass
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1580
    |m access_flags name_index name signature_index signature
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1581
     tooManyArgs|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1582
083530508d9c intitial checkin
cg
parents:
diff changeset
  1583
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
  1584
    "/ get a method
083530508d9c intitial checkin
cg
parents:
diff changeset
  1585
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1586
    access_flags := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1587
    name_index := inStream nextUnsignedShortMSB:msb.
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1588
    signature_index := inStream nextUnsignedShortMSB:msb.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1589
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1590
    name := constants at:name_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1591
    signature := constants at:signature_index.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1592
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1593
    Verbose ifTrue:[Transcript show:'method name:'; showCR:name.
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1594
                    Transcript show:'signature:'; showCR:signature.].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
  1595
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1596
    m := JavaMethod new.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1597
    m setAccessFlags:access_flags.
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1598
    tooManyArgs := false.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1599
    Method argumentSignal handle:[:ex |
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1600
        'JAVA: ***** java method has too many arguments - will fail to execute' infoPrintCR.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1601
        tooManyArgs := true.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1602
        ex proceed.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1603
    ] do:[
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1604
        m setName:name signature:signature.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1605
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1606
    m setJavaClass:aJavaClass.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1607
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1608
    self readAttributesFor:m.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
  1609
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1610
    tooManyArgs ifTrue:[
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1611
        m code:nil.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1612
        m byteCode:nil.
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1613
    ].
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1614
    aJavaClass addMethod:m name:name signature:signature.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1615
083530508d9c intitial checkin
cg
parents:
diff changeset
  1616
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1617
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1618
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1619
273
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1620
    "Created: / 15.4.1996 / 16:48:49 / cg"
bcbea5ac4860 checkin from browser
cg
parents: 269
diff changeset
  1621
    "Modified: / 27.1.1998 / 17:46:53 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1622
!
083530508d9c intitial checkin
cg
parents:
diff changeset
  1623
38
3f1b61722466 checkin from browser
cg
parents: 32
diff changeset
  1624
readMethodsFor:aJavaClass
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1625
    |methodsCount method|
083530508d9c intitial checkin
cg
parents:
diff changeset
  1626
083530508d9c intitial checkin
cg
parents:
diff changeset
  1627
083530508d9c intitial checkin
cg
parents:
diff changeset
  1628
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
  1629
    "/ get methods
083530508d9c intitial checkin
cg
parents:
diff changeset
  1630
    "/
128
acc4e8e77092 *** empty log message ***
cg
parents: 122
diff changeset
  1631
    methodsCount := inStream nextUnsignedShortMSB:msb.
61
ff1579eb825f showCr: -> showCR:
cg
parents: 60
diff changeset
  1632
    Verbose ifTrue:[Transcript show:'methodsCount = '; showCR:methodsCount].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1633
083530508d9c intitial checkin
cg
parents:
diff changeset
  1634
    1 to:methodsCount do:[:i |
252
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1635
	Verbose ifTrue:[Transcript show:'method: '; showCR:i].
04b330744577 new javaVM stuff & back to pre-stefans changes
cg
parents: 229
diff changeset
  1636
	method := self readMethodFor:aJavaClass
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1637
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
  1638
083530508d9c intitial checkin
cg
parents:
diff changeset
  1639
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1640
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
  1641
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
  1642
083530508d9c intitial checkin
cg
parents:
diff changeset
  1643
    "Modified: 15.4.1996 / 15:33:28 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1644
    "Created: 15.4.1996 / 16:46:30 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
  1645
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
  1646
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1647
!JavaClassReader methodsFor:'file reading - methods-ST'!
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1648
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1649
readSTLiteralsAttributeFor:aSmalltalkMethod
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1650
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1651
    "Created: / 7.5.1998 / 11:52:28 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1652
    "Modified: / 7.5.1998 / 11:52:45 / cg"
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1653
! !
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1654
135
098936234135 *** empty log message ***
cg
parents: 128
diff changeset
  1655
!JavaClassReader class methodsFor:'documentation'!
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1656
083530508d9c intitial checkin
cg
parents:
diff changeset
  1657
version
344
e97744a854f7 code cleanup;
cg
parents: 335
diff changeset
  1658
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.61 1998/05/07 17:44:00 cg Exp $'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
  1659
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
  1660
JavaClassReader initialize!