JavaClassReader.st
author cg
Tue, 16 Apr 1996 18:21:29 +0000
changeset 9 bc65152d7610
parent 7 de8ce26e1f2c
child 11 30997f6943a4
permissions -rw-r--r--
can no read (undoc) 3.45 format
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
083530508d9c intitial checkin
cg
parents:
diff changeset
     1
Object subclass:#JavaClassReader
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
     2
	instanceVariableNames:'inStream msb constants this_class super_class version majorVsn
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
     3
		minorVsn'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
     4
	classVariableNames:'Verbose'
083530508d9c intitial checkin
cg
parents:
diff changeset
     5
	poolDictionaries:''
083530508d9c intitial checkin
cg
parents:
diff changeset
     6
	category:'Java-Support'
083530508d9c intitial checkin
cg
parents:
diff changeset
     7
!
083530508d9c intitial checkin
cg
parents:
diff changeset
     8
083530508d9c intitial checkin
cg
parents:
diff changeset
     9
083530508d9c intitial checkin
cg
parents:
diff changeset
    10
!JavaClassReader class methodsFor:'initialization'!
083530508d9c intitial checkin
cg
parents:
diff changeset
    11
083530508d9c intitial checkin
cg
parents:
diff changeset
    12
initialize
083530508d9c intitial checkin
cg
parents:
diff changeset
    13
    Verbose := false
083530508d9c intitial checkin
cg
parents:
diff changeset
    14
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
    15
083530508d9c intitial checkin
cg
parents:
diff changeset
    16
!JavaClassReader class methodsFor:'debugging'!
083530508d9c intitial checkin
cg
parents:
diff changeset
    17
083530508d9c intitial checkin
cg
parents:
diff changeset
    18
verbose:aBoolean
083530508d9c intitial checkin
cg
parents:
diff changeset
    19
    Verbose := aBoolean
083530508d9c intitial checkin
cg
parents:
diff changeset
    20
083530508d9c intitial checkin
cg
parents:
diff changeset
    21
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
    22
     JavaClassReader verbose:true
083530508d9c intitial checkin
cg
parents:
diff changeset
    23
     JavaClassReader verbose:false
083530508d9c intitial checkin
cg
parents:
diff changeset
    24
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
    25
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
    26
083530508d9c intitial checkin
cg
parents:
diff changeset
    27
!JavaClassReader class methodsFor:'file reading'!
083530508d9c intitial checkin
cg
parents:
diff changeset
    28
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    29
loadFile:aFilename
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    30
    "reads a class from aFilename, installs and returns it."
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    31
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    32
    |javaClass|
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    33
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    34
    javaClass := self readFile:aFilename.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    35
    javaClass notNil ifTrue:[
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    36
        Smalltalk at:(javaClass fullName asSymbol) put:javaClass.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    37
        Smalltalk changed.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    38
    ].
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    39
    ^ javaClass
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    40
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    41
    "
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    42
     JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    43
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    44
     '/phys/ibm3/java/lib/java/lang' asFilename
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    45
        directoryContents do:[:nm |
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    46
            (nm endsWith:'.class') ifTrue:[
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    47
                JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/' , nm
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    48
            ]
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    49
        ]
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    50
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    51
     JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/AbstractMethodError.class'
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    52
    "
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    53
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    54
    "Created: 15.4.1996 / 14:58:53 / cg"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    55
!
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    56
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    57
readFile:aFilename
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    58
    "reads a class from aFilename and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    59
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    60
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    61
    |inStream retVal|
083530508d9c intitial checkin
cg
parents:
diff changeset
    62
083530508d9c intitial checkin
cg
parents:
diff changeset
    63
    inStream := aFilename asFilename readStream.
083530508d9c intitial checkin
cg
parents:
diff changeset
    64
    inStream isNil ifTrue:[^ nil].
083530508d9c intitial checkin
cg
parents:
diff changeset
    65
    retVal := self readStream:inStream.
083530508d9c intitial checkin
cg
parents:
diff changeset
    66
    inStream close.
083530508d9c intitial checkin
cg
parents:
diff changeset
    67
    ^ retVal
083530508d9c intitial checkin
cg
parents:
diff changeset
    68
083530508d9c intitial checkin
cg
parents:
diff changeset
    69
    "Created: 15.4.1996 / 14:58:53 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
    70
!
083530508d9c intitial checkin
cg
parents:
diff changeset
    71
083530508d9c intitial checkin
cg
parents:
diff changeset
    72
readStream:aStream
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    73
    "reads a class from aStream and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    74
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    75
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    76
    ^ self new readStream:aStream
083530508d9c intitial checkin
cg
parents:
diff changeset
    77
083530508d9c intitial checkin
cg
parents:
diff changeset
    78
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
    79
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
    80
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
    81
083530508d9c intitial checkin
cg
parents:
diff changeset
    82
    "Modified: 15.4.1996 / 15:01:30 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
    83
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
    84
083530508d9c intitial checkin
cg
parents:
diff changeset
    85
!JavaClassReader methodsFor:'file reading'!
083530508d9c intitial checkin
cg
parents:
diff changeset
    86
083530508d9c intitial checkin
cg
parents:
diff changeset
    87
readClassFile
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    88
    "reads a class from inStream and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    89
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
    90
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
    91
    |magic 
1
083530508d9c intitial checkin
cg
parents:
diff changeset
    92
     access_flags this_class_index super_class_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
    93
083530508d9c intitial checkin
cg
parents:
diff changeset
    94
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
    95
    "/ read magic, determine byte order
083530508d9c intitial checkin
cg
parents:
diff changeset
    96
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
    97
    msb := true.
083530508d9c intitial checkin
cg
parents:
diff changeset
    98
    magic := self nextU4.
083530508d9c intitial checkin
cg
parents:
diff changeset
    99
    magic = 16rCAFEBABE ifFalse:[
083530508d9c intitial checkin
cg
parents:
diff changeset
   100
        magic = 16rBEBAFECA ifFalse:[
083530508d9c intitial checkin
cg
parents:
diff changeset
   101
            self error:'not a java class file'.
083530508d9c intitial checkin
cg
parents:
diff changeset
   102
            ^ nil
083530508d9c intitial checkin
cg
parents:
diff changeset
   103
        ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   104
        msb := false.
083530508d9c intitial checkin
cg
parents:
diff changeset
   105
        Verbose ifTrue:[Transcript showCr:'file is lsb'].
083530508d9c intitial checkin
cg
parents:
diff changeset
   106
    ] ifTrue:[
083530508d9c intitial checkin
cg
parents:
diff changeset
   107
        Verbose ifTrue:[Transcript showCr:'file is msb'].
083530508d9c intitial checkin
cg
parents:
diff changeset
   108
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   109
083530508d9c intitial checkin
cg
parents:
diff changeset
   110
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   111
    "/ get version
083530508d9c intitial checkin
cg
parents:
diff changeset
   112
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   113
    version := self nextU4.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   114
    majorVsn := (version bitShift:-16) bitAnd:16rFFFF.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   115
    minorVsn := version bitAnd:16rFFFF.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   116
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   117
    Verbose ifTrue:[Transcript show:'version = '; 
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   118
                               show:(majorVsn printString); 
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   119
                               show:'.';
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   120
                               showCr:(minorVsn printString)].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   121
083530508d9c intitial checkin
cg
parents:
diff changeset
   122
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   123
    "/ get constant pool
083530508d9c intitial checkin
cg
parents:
diff changeset
   124
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   125
    self readConstantPool.
083530508d9c intitial checkin
cg
parents:
diff changeset
   126
083530508d9c intitial checkin
cg
parents:
diff changeset
   127
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   128
    "/ access flags
083530508d9c intitial checkin
cg
parents:
diff changeset
   129
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   130
    access_flags := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   131
    this_class_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   132
    super_class_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   133
083530508d9c intitial checkin
cg
parents:
diff changeset
   134
    this_class := constants at:this_class_index.
083530508d9c intitial checkin
cg
parents:
diff changeset
   135
    super_class := constants at:super_class_index.
083530508d9c intitial checkin
cg
parents:
diff changeset
   136
083530508d9c intitial checkin
cg
parents:
diff changeset
   137
    this_class setAccessFlags:access_flags.
3
e3c2a84b2a72 checkin from browser
cg
parents: 1
diff changeset
   138
    this_class setSuperclass:super_class.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   139
    this_class setConstantPool:constants.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   140
083530508d9c intitial checkin
cg
parents:
diff changeset
   141
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   142
    "/ get interfaces
083530508d9c intitial checkin
cg
parents:
diff changeset
   143
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   144
    self readInterfaces.
083530508d9c intitial checkin
cg
parents:
diff changeset
   145
083530508d9c intitial checkin
cg
parents:
diff changeset
   146
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   147
    "/ get fields
083530508d9c intitial checkin
cg
parents:
diff changeset
   148
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   149
    self readFieldInfofields.
083530508d9c intitial checkin
cg
parents:
diff changeset
   150
083530508d9c intitial checkin
cg
parents:
diff changeset
   151
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   152
    "/ get methods
083530508d9c intitial checkin
cg
parents:
diff changeset
   153
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   154
    self readMethods.
083530508d9c intitial checkin
cg
parents:
diff changeset
   155
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   156
    self readAttributesFor:this_class.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   157
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   158
    ^ this_class
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   159
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   160
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   161
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   162
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   163
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   164
     JavaClassReader verbose:true.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   165
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/ArithmeticException.class'
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   166
     JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/ArithmeticException.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   167
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   168
083530508d9c intitial checkin
cg
parents:
diff changeset
   169
    "Created: 15.4.1996 / 15:02:47 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   170
    "Modified: 15.4.1996 / 16:51:48 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   171
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   172
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   173
readInterfaces
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   174
    |interfacesCount interface|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   175
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   176
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   177
    "/
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   178
    "/ get interfaces
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   179
    "/
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   180
    interfacesCount := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   181
    Verbose ifTrue:[Transcript show:'interfacesCount = '; showCr:interfacesCount].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   182
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   183
    1 to:interfacesCount do:[:i |
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   184
        Verbose ifTrue:[Transcript show:'interface: '; showCr:i].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   185
        interface = self nextU2
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   186
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   187
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   188
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   189
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   190
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   191
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   192
    "Created: 15.4.1996 / 15:31:59 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   193
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   194
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   195
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   196
readSourceFileAttributeFor:aJavaClass
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   197
    |attribute_length sourceFile_index sourceFile|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   198
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   199
    attribute_length := self nextU4.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   200
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   201
    sourceFile_index := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   202
    sourceFile := constants at:sourceFile_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   203
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   204
    aJavaClass setSourceFile:sourceFile.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   205
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   206
    Verbose ifTrue:[Transcript show:'sourceFile: '; showCr:sourceFile].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   207
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   208
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   209
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   210
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   211
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   212
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   213
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   214
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   215
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   216
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   217
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   218
readStream:aStream
7
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   219
    "reads a class from aStream and returns it.
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   220
     The JavaClass is not installed as global"
de8ce26e1f2c checkin from browser
cg
parents: 5
diff changeset
   221
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   222
    inStream := aStream.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   223
    inStream binary.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   224
    ^ self readClassFile
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   225
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   226
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   227
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   228
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   229
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   230
    "Created: 15.4.1996 / 15:00:55 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   231
    "Modified: 15.4.1996 / 15:06:18 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   232
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   233
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   234
!JavaClassReader methodsFor:'file reading - attributes'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   235
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   236
readAttribute:attributeName for:something
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   237
    (attributeName = 'Code') ifTrue:[
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   238
        self readCodeAttributeFor:something.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   239
        ^ true.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   240
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   241
    (attributeName = 'LineNumberTable') ifTrue:[
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   242
        self readLineNumberTableAttributeFor:something.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   243
        ^ true.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   244
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   245
    (attributeName = 'LocalVariableTable') ifTrue:[
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   246
        self readLocalVariableTableAttributeFor:something.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   247
        ^ true.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   248
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   249
    (attributeName = 'ConstantValue') ifTrue:[
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   250
        self readConstantValueAttributeFor:something.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   251
        ^ true.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   252
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   253
    (attributeName = 'SourceFile') ifTrue:[
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   254
        self readSourceFileAttributeFor:something.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   255
        ^ true.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   256
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   257
    ^ false
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   258
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   259
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   260
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   261
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   262
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   263
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   264
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   265
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   266
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   267
readAttributeFor:something
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   268
    |attribute_name_index attribute_name attribute_length attribute_info|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   269
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   270
    Verbose ifTrue:[Transcript show:'attrib at pos: '; showCr:inStream position].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   271
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   272
    attribute_name_index := self nextU2.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   273
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   274
    "/
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   275
    "/ UNDOC feature ?
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   276
    "/
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   277
    attribute_name_index > constants size ifTrue:[
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   278
        attribute_name_index == 16rb700 ifTrue:[
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   279
            self halt.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   280
        ]
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   281
    ].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   282
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   283
    attribute_name := constants at:attribute_name_index.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   284
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   285
    Verbose ifTrue:[Transcript show:'attrib name: '; showCr:attribute_name].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   286
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   287
    (self readAttribute:attribute_name for:something) ifFalse:[
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   288
        attribute_length := self nextU4.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   289
        attribute_info := ByteArray new:(attribute_length).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   290
        inStream nextBytes:attribute_length into:attribute_info startingAt:1.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   291
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   292
        Verbose ifTrue:[Transcript show:'skipped '; show:attribute_name; showCr:'-attribute'].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   293
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   294
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   295
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   296
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   297
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   298
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   299
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   300
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   301
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   302
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   303
readAttributesFor:something
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   304
    |attributes_count|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   305
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   306
    attributes_count := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   307
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   308
    1 to:attributes_count do:[:i |
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   309
        self readAttributeFor:something.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   310
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   311
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   312
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   313
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   314
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   315
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   316
!JavaClassReader methodsFor:'file reading - constants'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   317
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   318
readConstant
083530508d9c intitial checkin
cg
parents:
diff changeset
   319
    |tag constReader const|
083530508d9c intitial checkin
cg
parents:
diff changeset
   320
083530508d9c intitial checkin
cg
parents:
diff changeset
   321
083530508d9c intitial checkin
cg
parents:
diff changeset
   322
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   323
    "/ get tag
083530508d9c intitial checkin
cg
parents:
diff changeset
   324
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   325
    tag := self nextU1.
083530508d9c intitial checkin
cg
parents:
diff changeset
   326
    Verbose ifTrue:[Transcript show:'tag = '; showCr:tag].
083530508d9c intitial checkin
cg
parents:
diff changeset
   327
083530508d9c intitial checkin
cg
parents:
diff changeset
   328
    constReader := #(
083530508d9c intitial checkin
cg
parents:
diff changeset
   329
                        readConstant_Asciz              "/ 1
083530508d9c intitial checkin
cg
parents:
diff changeset
   330
                        readConstant_Undef              "/ 2
083530508d9c intitial checkin
cg
parents:
diff changeset
   331
                        readConstant_Integer            "/ 3
083530508d9c intitial checkin
cg
parents:
diff changeset
   332
                        readConstant_Float              "/ 4
083530508d9c intitial checkin
cg
parents:
diff changeset
   333
                        readConstant_Long               "/ 5
083530508d9c intitial checkin
cg
parents:
diff changeset
   334
                        readConstant_Double             "/ 6
083530508d9c intitial checkin
cg
parents:
diff changeset
   335
                        readConstant_Class              "/ 7
083530508d9c intitial checkin
cg
parents:
diff changeset
   336
                        readConstant_String             "/ 8
083530508d9c intitial checkin
cg
parents:
diff changeset
   337
                        readConstant_Fieldref           "/ 9
083530508d9c intitial checkin
cg
parents:
diff changeset
   338
                        readConstant_Methodref          "/ 10
083530508d9c intitial checkin
cg
parents:
diff changeset
   339
                        readConstant_InterfaceMethodref "/ 11
083530508d9c intitial checkin
cg
parents:
diff changeset
   340
                        readConstant_NameandType        "/ 12
083530508d9c intitial checkin
cg
parents:
diff changeset
   341
                    ) at:tag ifAbsent:[#readConstant_Undef].
083530508d9c intitial checkin
cg
parents:
diff changeset
   342
083530508d9c intitial checkin
cg
parents:
diff changeset
   343
    ^ self perform:constReader.
083530508d9c intitial checkin
cg
parents:
diff changeset
   344
083530508d9c intitial checkin
cg
parents:
diff changeset
   345
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   346
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   347
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   348
083530508d9c intitial checkin
cg
parents:
diff changeset
   349
    "Created: 15.4.1996 / 15:46:32 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   350
    "Modified: 15.4.1996 / 15:47:00 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   351
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   352
083530508d9c intitial checkin
cg
parents:
diff changeset
   353
readConstantPool
083530508d9c intitial checkin
cg
parents:
diff changeset
   354
    |constantPoolCount const|
083530508d9c intitial checkin
cg
parents:
diff changeset
   355
083530508d9c intitial checkin
cg
parents:
diff changeset
   356
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   357
    "/ get constant pool
083530508d9c intitial checkin
cg
parents:
diff changeset
   358
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   359
    constantPoolCount := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   360
    Verbose ifTrue:[Transcript show:'constantPoolCount = '; showCr:constantPoolCount].
083530508d9c intitial checkin
cg
parents:
diff changeset
   361
083530508d9c intitial checkin
cg
parents:
diff changeset
   362
    constants := Array new:constantPoolCount-1.
083530508d9c intitial checkin
cg
parents:
diff changeset
   363
083530508d9c intitial checkin
cg
parents:
diff changeset
   364
    1 to:constantPoolCount-1 do:[:i |
083530508d9c intitial checkin
cg
parents:
diff changeset
   365
        Verbose ifTrue:[Transcript show:'const: '; showCr:i].
083530508d9c intitial checkin
cg
parents:
diff changeset
   366
        const := self readConstant.
083530508d9c intitial checkin
cg
parents:
diff changeset
   367
        constants at:i put:const
083530508d9c intitial checkin
cg
parents:
diff changeset
   368
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   369
083530508d9c intitial checkin
cg
parents:
diff changeset
   370
    1 to:constantPoolCount-1 do:[:i |
083530508d9c intitial checkin
cg
parents:
diff changeset
   371
        |const|
083530508d9c intitial checkin
cg
parents:
diff changeset
   372
083530508d9c intitial checkin
cg
parents:
diff changeset
   373
        const := constants at:i.
083530508d9c intitial checkin
cg
parents:
diff changeset
   374
        constants at:i put:(JavaUnresolvedConstant resolve:const from:constants).
083530508d9c intitial checkin
cg
parents:
diff changeset
   375
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   376
083530508d9c intitial checkin
cg
parents:
diff changeset
   377
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   378
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   379
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   380
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   381
083530508d9c intitial checkin
cg
parents:
diff changeset
   382
    "Created: 15.4.1996 / 15:14:11 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   383
    "Modified: 15.4.1996 / 16:41:57 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   384
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   385
083530508d9c intitial checkin
cg
parents:
diff changeset
   386
readConstant_Asciz
083530508d9c intitial checkin
cg
parents:
diff changeset
   387
    |len string|
083530508d9c intitial checkin
cg
parents:
diff changeset
   388
083530508d9c intitial checkin
cg
parents:
diff changeset
   389
    len := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   390
    string := String new:len.
083530508d9c intitial checkin
cg
parents:
diff changeset
   391
    inStream nextBytes:len into:string startingAt:1.
083530508d9c intitial checkin
cg
parents:
diff changeset
   392
083530508d9c intitial checkin
cg
parents:
diff changeset
   393
    Verbose ifTrue:[Transcript show:'asciz; string= ';     showCr:string].
083530508d9c intitial checkin
cg
parents:
diff changeset
   394
083530508d9c intitial checkin
cg
parents:
diff changeset
   395
    ^ string
083530508d9c intitial checkin
cg
parents:
diff changeset
   396
083530508d9c intitial checkin
cg
parents:
diff changeset
   397
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   398
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   399
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   400
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   401
083530508d9c intitial checkin
cg
parents:
diff changeset
   402
    "Created: 15.4.1996 / 15:15:35 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   403
    "Modified: 15.4.1996 / 16:33:45 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   404
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   405
083530508d9c intitial checkin
cg
parents:
diff changeset
   406
readConstant_Class
083530508d9c intitial checkin
cg
parents:
diff changeset
   407
    |name_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
   408
083530508d9c intitial checkin
cg
parents:
diff changeset
   409
    name_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   410
083530508d9c intitial checkin
cg
parents:
diff changeset
   411
    Verbose ifTrue:[Transcript show:'class; index= '; showCr:name_index].
083530508d9c intitial checkin
cg
parents:
diff changeset
   412
083530508d9c intitial checkin
cg
parents:
diff changeset
   413
    ^ JavaUnresolvedClassConstant nameIndex:name_index
083530508d9c intitial checkin
cg
parents:
diff changeset
   414
083530508d9c intitial checkin
cg
parents:
diff changeset
   415
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   416
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   417
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   418
083530508d9c intitial checkin
cg
parents:
diff changeset
   419
    "Created: 15.4.1996 / 15:21:13 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   420
    "Modified: 15.4.1996 / 15:49:32 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   421
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   422
083530508d9c intitial checkin
cg
parents:
diff changeset
   423
readConstant_Fieldref
083530508d9c intitial checkin
cg
parents:
diff changeset
   424
    |class_index name_and_type_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
   425
083530508d9c intitial checkin
cg
parents:
diff changeset
   426
    class_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   427
    name_and_type_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   428
083530508d9c intitial checkin
cg
parents:
diff changeset
   429
    Verbose ifTrue:[Transcript show:'fieldref; classindex= ';     showCr:class_index].
083530508d9c intitial checkin
cg
parents:
diff changeset
   430
    Verbose ifTrue:[Transcript show:'fieldref; name&typeindex= '; showCr:name_and_type_index].
083530508d9c intitial checkin
cg
parents:
diff changeset
   431
083530508d9c intitial checkin
cg
parents:
diff changeset
   432
    ^ JavaUnresolvedFieldrefConstant 
083530508d9c intitial checkin
cg
parents:
diff changeset
   433
                classIndex:class_index
083530508d9c intitial checkin
cg
parents:
diff changeset
   434
                nameandTypeIndex:name_and_type_index
083530508d9c intitial checkin
cg
parents:
diff changeset
   435
083530508d9c intitial checkin
cg
parents:
diff changeset
   436
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   437
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   438
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   439
083530508d9c intitial checkin
cg
parents:
diff changeset
   440
    "Created: 15.4.1996 / 15:22:18 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   441
    "Modified: 15.4.1996 / 16:07:01 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   442
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   443
083530508d9c intitial checkin
cg
parents:
diff changeset
   444
readConstant_Integer
083530508d9c intitial checkin
cg
parents:
diff changeset
   445
    |value|
083530508d9c intitial checkin
cg
parents:
diff changeset
   446
083530508d9c intitial checkin
cg
parents:
diff changeset
   447
    value := self nextU4.
083530508d9c intitial checkin
cg
parents:
diff changeset
   448
083530508d9c intitial checkin
cg
parents:
diff changeset
   449
    Verbose ifTrue:[Transcript show:'integer; value= ';     showCr:value].
083530508d9c intitial checkin
cg
parents:
diff changeset
   450
083530508d9c intitial checkin
cg
parents:
diff changeset
   451
    ^ value
083530508d9c intitial checkin
cg
parents:
diff changeset
   452
083530508d9c intitial checkin
cg
parents:
diff changeset
   453
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   454
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   455
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   456
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   457
083530508d9c intitial checkin
cg
parents:
diff changeset
   458
    "Modified: 15.4.1996 / 15:42:16 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   459
    "Created: 15.4.1996 / 16:34:42 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   460
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   461
083530508d9c intitial checkin
cg
parents:
diff changeset
   462
readConstant_Methodref
083530508d9c intitial checkin
cg
parents:
diff changeset
   463
    |class_index name_and_type_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
   464
083530508d9c intitial checkin
cg
parents:
diff changeset
   465
    class_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   466
    name_and_type_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   467
083530508d9c intitial checkin
cg
parents:
diff changeset
   468
    Verbose ifTrue:[Transcript show:'methodref; classindex= ';     showCr:class_index].
083530508d9c intitial checkin
cg
parents:
diff changeset
   469
    Verbose ifTrue:[Transcript show:'methodref; name&typeindex= '; showCr:name_and_type_index].
083530508d9c intitial checkin
cg
parents:
diff changeset
   470
083530508d9c intitial checkin
cg
parents:
diff changeset
   471
    ^ JavaUnresolvedMethodrefConstant 
083530508d9c intitial checkin
cg
parents:
diff changeset
   472
                classIndex:class_index
083530508d9c intitial checkin
cg
parents:
diff changeset
   473
                nameandTypeIndex:name_and_type_index
083530508d9c intitial checkin
cg
parents:
diff changeset
   474
083530508d9c intitial checkin
cg
parents:
diff changeset
   475
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   476
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   477
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   478
083530508d9c intitial checkin
cg
parents:
diff changeset
   479
    "Created: 15.4.1996 / 15:22:37 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   480
    "Modified: 15.4.1996 / 16:07:19 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   481
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   482
083530508d9c intitial checkin
cg
parents:
diff changeset
   483
readConstant_NameandType
083530508d9c intitial checkin
cg
parents:
diff changeset
   484
    |name_index signature_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
   485
083530508d9c intitial checkin
cg
parents:
diff changeset
   486
    name_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   487
    signature_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   488
083530508d9c intitial checkin
cg
parents:
diff changeset
   489
    Verbose ifTrue:[Transcript show:'methodref; nameindex= ';     showCr:name_index].
083530508d9c intitial checkin
cg
parents:
diff changeset
   490
    Verbose ifTrue:[Transcript show:'methodref; signatureindex= '; showCr:signature_index].
083530508d9c intitial checkin
cg
parents:
diff changeset
   491
083530508d9c intitial checkin
cg
parents:
diff changeset
   492
    ^ JavaUnresolvedNameandTypeConstant 
083530508d9c intitial checkin
cg
parents:
diff changeset
   493
                nameIndex:name_index
083530508d9c intitial checkin
cg
parents:
diff changeset
   494
                signatureIndex:signature_index
083530508d9c intitial checkin
cg
parents:
diff changeset
   495
083530508d9c intitial checkin
cg
parents:
diff changeset
   496
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   497
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   498
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   499
083530508d9c intitial checkin
cg
parents:
diff changeset
   500
    "Created: 15.4.1996 / 15:23:43 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   501
    "Modified: 15.4.1996 / 16:17:16 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   502
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   503
083530508d9c intitial checkin
cg
parents:
diff changeset
   504
readConstant_String
083530508d9c intitial checkin
cg
parents:
diff changeset
   505
    |tag string_index|
083530508d9c intitial checkin
cg
parents:
diff changeset
   506
083530508d9c intitial checkin
cg
parents:
diff changeset
   507
    string_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   508
083530508d9c intitial checkin
cg
parents:
diff changeset
   509
    Verbose ifTrue:[Transcript show:'string; index= '; showCr:string_index].
083530508d9c intitial checkin
cg
parents:
diff changeset
   510
083530508d9c intitial checkin
cg
parents:
diff changeset
   511
    ^ JavaUnresolvedStringConstant index:string_index
083530508d9c intitial checkin
cg
parents:
diff changeset
   512
083530508d9c intitial checkin
cg
parents:
diff changeset
   513
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   514
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   515
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   516
083530508d9c intitial checkin
cg
parents:
diff changeset
   517
    "Created: 15.4.1996 / 15:20:33 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   518
    "Modified: 15.4.1996 / 16:01:37 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   519
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   520
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   521
!JavaClassReader methodsFor:'file reading - fields'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   522
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   523
readConstantValueAttributeFor:aField
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   524
    |attribute_length constantvalue_index constantValue|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   525
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   526
    attribute_length := self nextU4.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   527
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   528
    constantvalue_index := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   529
    constantValue := constants at:constantvalue_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   530
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   531
    Verbose ifTrue:[Transcript show:'constantValue: '; showCr:constantValue].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   532
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   533
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   534
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   535
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   536
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   537
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   538
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   539
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   540
    "Created: 15.4.1996 / 15:40:17 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   541
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   542
083530508d9c intitial checkin
cg
parents:
diff changeset
   543
readFieldInfofield
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   544
    |access_flags name_index signature_index attributes_count field|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   545
083530508d9c intitial checkin
cg
parents:
diff changeset
   546
    access_flags := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   547
    name_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   548
    signature_index := self nextU2.
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   549
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   550
    field := JavaField new.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   551
    field setAccessFlags:access_flags.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   552
    field setName:(constants at:name_index).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   553
    field setSignature:(constants at:signature_index).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   554
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   555
    attributes_count := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   556
083530508d9c intitial checkin
cg
parents:
diff changeset
   557
    1 to:attributes_count do:[:i |
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   558
        self readAttributeFor:field.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   559
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   560
083530508d9c intitial checkin
cg
parents:
diff changeset
   561
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   562
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   563
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   564
083530508d9c intitial checkin
cg
parents:
diff changeset
   565
    "Modified: 15.4.1996 / 15:33:28 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   566
    "Created: 15.4.1996 / 15:38:43 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   567
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   568
083530508d9c intitial checkin
cg
parents:
diff changeset
   569
readFieldInfofields
083530508d9c intitial checkin
cg
parents:
diff changeset
   570
    |fieldsCount interface|
083530508d9c intitial checkin
cg
parents:
diff changeset
   571
083530508d9c intitial checkin
cg
parents:
diff changeset
   572
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   573
    "/ get interfaces
083530508d9c intitial checkin
cg
parents:
diff changeset
   574
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   575
    fieldsCount := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   576
    Verbose ifTrue:[Transcript show:'fieldsCount = '; showCr:fieldsCount].
083530508d9c intitial checkin
cg
parents:
diff changeset
   577
083530508d9c intitial checkin
cg
parents:
diff changeset
   578
    1 to:fieldsCount do:[:i |
083530508d9c intitial checkin
cg
parents:
diff changeset
   579
        Verbose ifTrue:[Transcript show:'field: '; showCr:i].
083530508d9c intitial checkin
cg
parents:
diff changeset
   580
        self readFieldInfofield
083530508d9c intitial checkin
cg
parents:
diff changeset
   581
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   582
083530508d9c intitial checkin
cg
parents:
diff changeset
   583
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   584
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   585
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   586
083530508d9c intitial checkin
cg
parents:
diff changeset
   587
    "Created: 15.4.1996 / 15:34:41 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   588
    "Modified: 15.4.1996 / 15:35:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   589
! !
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   590
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   591
!JavaClassReader methodsFor:'file reading - methods'!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   592
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   593
readCodeAttributeFor:aJavaMethod
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   594
    |attribute_length max_stack max_locals code_length code
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   595
     exception_table_length exception_table unknown1 unknown2|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   596
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   597
    attribute_length := self nextU4.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   598
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   599
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   600
    Verbose ifTrue:[Transcript show:'attribute_length: 0x'; showCr:(attribute_length printStringRadix:16)].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   601
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   602
    max_stack := self nextU1.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   603
    max_locals := self nextU1.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   604
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   605
    majorVsn > 2 ifTrue:[
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   606
        unknown1 := self nextU2.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   607
        unknown2 := self nextU2.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   608
    ].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   609
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   610
    code_length := self nextU2.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   611
    Verbose ifTrue:[Transcript show:'code_length: '; showCr:(code_length printStringRadix:16)].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   612
    Verbose ifTrue:[Transcript show:'code at pos: '; showCr:inStream position].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   613
    code := ByteArray new:code_length.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   614
    inStream nextBytes:code_length into:code startingAt:1.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   615
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   616
    Verbose ifTrue:[Transcript show:'method code:'; showCr:code.].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   617
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   618
    exception_table_length := self nextU2.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   619
    Verbose ifTrue:[Transcript show:'exception_table_length: '; showCr:(exception_table_length printStringRadix:16)].
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   620
    exception_table_length ~~ 0 ifTrue:[
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   621
        Verbose ifTrue:[Transcript show:'exceptionTable length:'; showCr:exception_table_length.].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   622
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   623
        exception_table := Array new:exception_table_length.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   624
        1 to:exception_table_length do:[:i |
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   625
            |start_pc end_pc handler_pc catch_type|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   626
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   627
            start_pc := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   628
            end_pc := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   629
            handler_pc := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   630
            catch_type := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   631
            exception_table at:i put:(JavaExceptionTableEntry
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   632
                                            startPC:start_pc
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   633
                                            endPC:end_pc
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   634
                                            handlerPC:handler_pc
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   635
                                            catchType:catch_type).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   636
        ].
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   637
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   638
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   639
    aJavaMethod setExceptionTable:exception_table.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   640
    aJavaMethod setMaxStack:max_stack.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   641
    aJavaMethod setMaxLocals:max_locals.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   642
    aJavaMethod setCode:code.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   643
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   644
    self readAttributesFor:aJavaMethod.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   645
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   646
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   647
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   648
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   649
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   650
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   651
083530508d9c intitial checkin
cg
parents:
diff changeset
   652
    "Modified: 15.4.1996 / 15:33:28 / cg"
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   653
    "Created: 15.4.1996 / 15:40:17 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   654
!
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   655
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   656
readLineNumberTableAttributeFor:aJavaMethod
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   657
    |attribute_length line_number_table_length line_number_table|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   658
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   659
    attribute_length := self nextU4.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   660
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   661
    line_number_table_length := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   662
    line_number_table_length ~~ 0 ifTrue:[
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   663
        line_number_table := Array new:line_number_table_length.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   664
        1 to:line_number_table_length do:[:i |
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   665
            |start_pc line_number|
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   666
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   667
            start_pc := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   668
            line_number := self nextU2.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   669
            line_number_table at:i put:(start_pc -> line_number).
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   670
        ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   671
    ].
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   672
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   673
    Verbose ifTrue:[Transcript showCr:'method has a lineNumberTable'].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   674
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   675
    aJavaMethod setLineNumberTable:line_number_table.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   676
    ^ true
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   677
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   678
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   679
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   680
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class'
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   681
    "
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   682
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   683
    "Modified: 15.4.1996 / 15:33:28 / cg"
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   684
    "Created: 15.4.1996 / 15:40:17 / cg"
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   685
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   686
083530508d9c intitial checkin
cg
parents:
diff changeset
   687
readMethod
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   688
    |m access_flags name_index name signature_index signature|
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   689
083530508d9c intitial checkin
cg
parents:
diff changeset
   690
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   691
    "/ get a method
083530508d9c intitial checkin
cg
parents:
diff changeset
   692
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   693
    access_flags := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   694
    name_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   695
    signature_index := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   696
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   697
    name := constants at:name_index.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   698
    signature := constants at:signature_index.
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   699
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   700
    Verbose ifTrue:[Transcript show:'method name:'; showCr:name.
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   701
                    Transcript show:'signature:'; showCr:signature.].
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   702
5
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   703
    m := JavaMethod new.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   704
    m setAccessFlags:access_flags.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   705
    m setSignature:signature.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   706
    m setName:name.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   707
    m setJavaClass:this_class.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   708
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   709
    self readAttributesFor:m.
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   710
f026f5d20c15 checkin from browser
cg
parents: 3
diff changeset
   711
    this_class addMethod:m name:name signature:signature.
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   712
083530508d9c intitial checkin
cg
parents:
diff changeset
   713
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   714
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   715
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   716
083530508d9c intitial checkin
cg
parents:
diff changeset
   717
    "Modified: 15.4.1996 / 15:33:28 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   718
    "Created: 15.4.1996 / 16:48:49 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   719
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   720
083530508d9c intitial checkin
cg
parents:
diff changeset
   721
readMethods
083530508d9c intitial checkin
cg
parents:
diff changeset
   722
    |methodsCount method|
083530508d9c intitial checkin
cg
parents:
diff changeset
   723
083530508d9c intitial checkin
cg
parents:
diff changeset
   724
083530508d9c intitial checkin
cg
parents:
diff changeset
   725
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   726
    "/ get methods
083530508d9c intitial checkin
cg
parents:
diff changeset
   727
    "/
083530508d9c intitial checkin
cg
parents:
diff changeset
   728
    methodsCount := self nextU2.
083530508d9c intitial checkin
cg
parents:
diff changeset
   729
    Verbose ifTrue:[Transcript show:'methodsCount = '; showCr:methodsCount].
083530508d9c intitial checkin
cg
parents:
diff changeset
   730
083530508d9c intitial checkin
cg
parents:
diff changeset
   731
    1 to:methodsCount do:[:i |
083530508d9c intitial checkin
cg
parents:
diff changeset
   732
        Verbose ifTrue:[Transcript show:'method: '; showCr:i].
083530508d9c intitial checkin
cg
parents:
diff changeset
   733
        method = self readMethod
083530508d9c intitial checkin
cg
parents:
diff changeset
   734
    ].
083530508d9c intitial checkin
cg
parents:
diff changeset
   735
083530508d9c intitial checkin
cg
parents:
diff changeset
   736
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   737
     JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'
083530508d9c intitial checkin
cg
parents:
diff changeset
   738
    "
083530508d9c intitial checkin
cg
parents:
diff changeset
   739
083530508d9c intitial checkin
cg
parents:
diff changeset
   740
    "Modified: 15.4.1996 / 15:33:28 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   741
    "Created: 15.4.1996 / 16:46:30 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   742
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
   743
083530508d9c intitial checkin
cg
parents:
diff changeset
   744
!JavaClassReader methodsFor:'low level reading'!
083530508d9c intitial checkin
cg
parents:
diff changeset
   745
083530508d9c intitial checkin
cg
parents:
diff changeset
   746
nextU1
083530508d9c intitial checkin
cg
parents:
diff changeset
   747
    ^ inStream nextByte
083530508d9c intitial checkin
cg
parents:
diff changeset
   748
083530508d9c intitial checkin
cg
parents:
diff changeset
   749
    "Created: 15.4.1996 / 15:15:43 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   750
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   751
083530508d9c intitial checkin
cg
parents:
diff changeset
   752
nextU2
083530508d9c intitial checkin
cg
parents:
diff changeset
   753
    ^ inStream nextUnsignedShortMSB:msb
083530508d9c intitial checkin
cg
parents:
diff changeset
   754
083530508d9c intitial checkin
cg
parents:
diff changeset
   755
    "Created: 15.4.1996 / 15:12:25 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   756
!
083530508d9c intitial checkin
cg
parents:
diff changeset
   757
083530508d9c intitial checkin
cg
parents:
diff changeset
   758
nextU4
083530508d9c intitial checkin
cg
parents:
diff changeset
   759
    ^ inStream nextUnsignedLongMSB:msb
083530508d9c intitial checkin
cg
parents:
diff changeset
   760
083530508d9c intitial checkin
cg
parents:
diff changeset
   761
    "Created: 15.4.1996 / 15:04:28 / cg"
083530508d9c intitial checkin
cg
parents:
diff changeset
   762
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
   763
083530508d9c intitial checkin
cg
parents:
diff changeset
   764
!JavaClassReader class methodsFor:'documentation'!
083530508d9c intitial checkin
cg
parents:
diff changeset
   765
083530508d9c intitial checkin
cg
parents:
diff changeset
   766
version
9
bc65152d7610 can no read (undoc) 3.45 format
cg
parents: 7
diff changeset
   767
    ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.5 1996/04/16 18:21:29 cg Exp $'
1
083530508d9c intitial checkin
cg
parents:
diff changeset
   768
! !
083530508d9c intitial checkin
cg
parents:
diff changeset
   769
JavaClassReader initialize!