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