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