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