Method.st
author Claus Gittinger <cg@exept.de>
Thu, 19 Jun 1997 16:17:25 +0200
changeset 2694 46ba8cbdc013
parent 2558 07e7d6fef46d
child 2695 79229a9ab2da
permissions -rw-r--r--
added #homeMethod for ST80 compatibility
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
     3
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
    13
CompiledCode subclass:#Method
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    14
	instanceVariableNames:'source sourcePosition category package'
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    15
	classVariableNames:'PrivateMethodSignal LastFileReference LastSourceFileName
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
    16
		LastWhoClass LastFileLock'
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    17
	poolDictionaries:''
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    18
	category:'Kernel-Methods'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    19
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    20
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    21
Object subclass:#MethodWhoInfo
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    22
	instanceVariableNames:'myClass mySelector'
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    23
	classVariableNames:''
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    24
	poolDictionaries:''
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    25
	privateIn:Method
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    26
!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    27
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
    28
!Method class methodsFor:'documentation'!
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    29
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    30
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    31
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    32
 COPYRIGHT (c) 1989 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
    33
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    34
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    35
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    37
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    38
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    39
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    40
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    41
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    42
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    43
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    44
documentation
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    45
"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    46
    this class defines protocol for executable methods;
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    47
    both compiled and interpreted methods are represented by this class.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    48
    Compiled methods have a non-nil code field, while interpreted methods have
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    49
    a nil code field and non-nil byteCode field.
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    50
    If there are both non-nil code and bytecode fields, the VM will execute
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    51
    the machine-code of a method. If both are nil when executed, a noByteCode
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    52
    message is sent by the VM to the method where a signal is raised.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    53
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    54
    The methods sourcecode is represented by source and sourcePosition:
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    55
    - if sourcePosition is a Number, the source-field is the fileName and
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    56
      sourcePosition is the character offset of the source-chunk in this source file.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    57
    - If sourcePosition is nil, the source is the string in the source field.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    58
    (an old version used ExternalString instances here, but that lead to
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    59
     10000 additional little objects ...)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    60
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    61
    The flags field defines things like the number of method-locals,
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    62
    method arguments and stack requirements (for interpreted methods).
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    63
    Do not depend on any value in the flags field - it may change without
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    64
    notice.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    65
438
claus
parents: 423
diff changeset
    66
    Notice, that in ST/X, method can be subclassed; executable code is
claus
parents: 423
diff changeset
    67
    identified not by being a subclass of Block or Method, but instead by
claus
parents: 423
diff changeset
    68
    having the executable flag bit set in the class. The VM can execute anything
claus
parents: 423
diff changeset
    69
    which is identified as executable (assuming that the first instance variable
claus
parents: 423
diff changeset
    70
    is the machine-code address) - this allows for easy future extension.
claus
parents: 423
diff changeset
    71
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    72
    [Instance variables:]
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    73
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    74
        source          <String>        the source itself (if sourcePosition isNil)
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    75
                                        or the fileName where the source is found
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    76
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    77
        sourcePosition  <Integer>       the position of the methods chunk in the file
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    78
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    79
        category        <Symbol>        the methods category
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    80
        package         <Symbol>        the package, in which the methods was defined
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    81
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    82
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    83
    [Class variables:]
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    84
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    85
        PrivateMethodSignal             raised on privacy violation (see docu)
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    86
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    87
        LastFileReference               weak reference to the last sourceFile
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    88
        LastSourceFileName              to speedup source access via NFS
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    89
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    90
    WARNING: layout known by compiler and runtime system - dont change
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    91
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    92
    [author:]
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    93
        Claus Gittinger
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    94
"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
    95
!
48061f8659aa more queries
claus
parents: 159
diff changeset
    96
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    97
dynamicMethods
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    98
"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    99
    On systems which support dynamic loading of machine code (SYS5.4, Linux),
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   100
    methods may now be compiled to machine code from within the browser,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   101
    and the resulting machine code object be loaded in.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   102
    The ObjectFileLoader keeps (weak) handles to the resulting methods and
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   103
    invalidates the corresponding method objects, if the underlying methods
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   104
    object code is unloaded.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   105
    Invalid methods will trap into the debugger when executed;
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   106
    also, the browser marks them as '(* not executable *)' in its method list.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   107
"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   108
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   109
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   110
privacy 
48061f8659aa more queries
claus
parents: 159
diff changeset
   111
"
48061f8659aa more queries
claus
parents: 159
diff changeset
   112
    ST/X includes an EXPERIMENTAL implementation of method privacy.
48061f8659aa more queries
claus
parents: 159
diff changeset
   113
    Individual methods may be set to private or protected via the
48061f8659aa more queries
claus
parents: 159
diff changeset
   114
    #setPrivate and #setProtected messages. Also, categories may be
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   115
    filedIn as a whole as private using #privateMethodsFor: or as
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   116
    protected using #protectedMethodsFor: instead of the well known #methodsFor:.
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   117
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   118
    The additional #publicMethodsFor: is for documentation purposes, and
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   119
    is equivalent to #methodsFor: (also to support fileIn of ENVY methods).
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   120
48061f8659aa more queries
claus
parents: 159
diff changeset
   121
    Private methods may be executed only when called via a self or super-send
48061f8659aa more queries
claus
parents: 159
diff changeset
   122
    from the superclass, the class itself or subclasses.
415
claus
parents: 414
diff changeset
   123
    Protected methods may not be called from subclasses, i.e. they may only
claus
parents: 414
diff changeset
   124
    be called via self sends from within the current class.
claus
parents: 414
diff changeset
   125
    (i.e. private methods are less private than protected ones)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   126
48061f8659aa more queries
claus
parents: 159
diff changeset
   127
    When such a situation arises, the VM (runtime system) will raise the
48061f8659aa more queries
claus
parents: 159
diff changeset
   128
    PrivateMethodSignal exception (if nonNil), which usually brings you into the
48061f8659aa more queries
claus
parents: 159
diff changeset
   129
    debugger.
48061f8659aa more queries
claus
parents: 159
diff changeset
   130
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   131
    If PrivateMethodSignal is nil, the VM will not check for this, and
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   132
    execution is as usual. (you may want to nil-it for production code,
48061f8659aa more queries
claus
parents: 159
diff changeset
   133
    and leave it non nil during development).
48061f8659aa more queries
claus
parents: 159
diff changeset
   134
48061f8659aa more queries
claus
parents: 159
diff changeset
   135
    NOTICE: there is no (not yet ?) standard defined for method privacy,
48061f8659aa more queries
claus
parents: 159
diff changeset
   136
    however, the interface was designed to be somewhat ENVY compatible (from
48061f8659aa more queries
claus
parents: 159
diff changeset
   137
    what can be deduced by reading PD code).
48061f8659aa more queries
claus
parents: 159
diff changeset
   138
    Also, the usability of privacy is still to be tested.
415
claus
parents: 414
diff changeset
   139
    This interface, the implementation and the rules for when a privacy violation
claus
parents: 414
diff changeset
   140
    may change (in case of some ANSI standard being defined).
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   141
    Be warned and send me suggestions & critics (constructive ;-)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   142
"
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
   143
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   144
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   145
!Method class methodsFor:'initialization'!
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   146
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   147
initialize
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   148
    "create signals"
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   149
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   150
    PrivateMethodSignal isNil ifTrue:[
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   151
        "EXPERIMENTAL"
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   152
        PrivateMethodSignal := ExecutionErrorSignal newSignalMayProceed:true.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   153
        PrivateMethodSignal nameClass:self message:#privateMethodSignal.
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   154
        PrivateMethodSignal notifierString:'attempt to execute private/protected method'.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   155
    ].
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   156
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   157
    LastFileLock isNil ifTrue:[
2262
4c4d810f006f semaphore names
Claus Gittinger <cg@exept.de>
parents: 2242
diff changeset
   158
        LastFileLock := Semaphore forMutualExclusion name:'LastFileLock'.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   159
        LastFileReference := WeakArray new:1.
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   160
        LastFileReference at:1 put:0.
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   161
    ].
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   162
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   163
    "Modified: 22.4.1996 / 16:34:38 / cg"
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   164
    "Modified: 3.1.1997 / 16:58:16 / stefan"
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   165
! !
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   166
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   167
!Method class methodsFor:'Signal constants'!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   168
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   169
privateMethodSignal
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   170
    "return the signal raised when a private/protected method is called
48061f8659aa more queries
claus
parents: 159
diff changeset
   171
     by some other object (i.e. not a self- or super send)"
48061f8659aa more queries
claus
parents: 159
diff changeset
   172
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   173
    ^ PrivateMethodSignal
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   174
! !
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   175
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   176
!Method class methodsFor:'binary storage'!
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   177
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   178
binaryDefinitionFrom: stream manager: manager
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   179
    "read my definition from stream."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   180
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   181
    |cls sel|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   182
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   183
    "type-byte"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   184
    stream nextByte == 0 ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   185
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   186
	 built-in method
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   187
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   188
	cls := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   189
	sel := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   190
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   191
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   192
	 mhmh - on the source system, this was a machinecode
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   193
	 method, while here its an interpreted one ...
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   194
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   195
	cls isLoaded ifFalse:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   196
	    cls autoload
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   197
	].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   198
	^ cls compiledMethodAt:sel
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   199
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   200
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   201
     bytecode method
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   202
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   203
    ^ super binaryDefinitionFrom:stream manager:manager
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   204
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   205
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   206
binaryFullDefinitionFrom:stream manager:manager
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   207
    "retrieve a full bytecoded-method."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   208
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   209
    |snapId cat flags code lits m sourceFilename sourcePos source|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   210
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   211
    snapId := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   212
    cat := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   213
    flags := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   214
    lits := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   215
    sourceFilename := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   216
    sourcePos := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   217
    sourcePos isNil ifTrue:[
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1477
diff changeset
   218
        source := manager nextObject.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   219
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   220
    code := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   221
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   222
    snapId == ObjectMemory snapshotID ifTrue:[
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1477
diff changeset
   223
        ObjectMemory incrementSnapshotID
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   224
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   225
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1477
diff changeset
   226
    m := Method basicNew:(lits size).
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   227
    cat notNil ifTrue:[m category:cat].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   228
    m flags:flags.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   229
    m literals:lits.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   230
    m byteCode:code.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   231
    sourcePos isNil ifTrue:[
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1477
diff changeset
   232
        m source:source
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   233
    ] ifFalse:[
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1477
diff changeset
   234
        m sourceFilename:sourceFilename position:sourcePos
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   235
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   236
    ^ m
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   237
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   238
    "Created: 16.1.1996 / 14:44:08 / cg"
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1477
diff changeset
   239
    "Modified: 24.6.1996 / 12:29:35 / stefan"
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   240
    "Modified: 5.1.1997 / 01:09:56 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   241
! !
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   242
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   243
!Method class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   244
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   245
isBuiltInClass
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   246
    "return true if this class is known by the run-time-system.
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   247
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   248
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   249
    ^ self == Method
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   250
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   251
    "Modified: 23.4.1996 / 15:59:50 / cg"
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   252
!
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   253
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   254
maxNumberOfArguments
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   255
    "return the maximum number of arguments a method can have.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   256
     This is a limit in the VM, which may be removed in one of 
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   257
     the next versions ..."
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   258
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   259
%{  /* NOCONTEXT */
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   260
    RETURN (__MKSMALLINT(MAX_METHOD_ARGS));
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
   261
%}
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   262
!
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   263
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   264
methodPrivacySupported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   265
    "return true, if the system was compiled to support methodPrivacy.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   266
     You should not depend on that feature being available."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   267
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   268
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   269
#if defined(F_PRIVATE) || defined(F_CLASSPRIVATE)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   270
    RETURN (true);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   271
#else
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   272
    RETURN (false);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   273
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   274
%}
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   275
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   276
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   277
!Method class methodsFor:'special'!
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   278
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   279
flushSourceStreamCache
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   280
    LastSourceFileName := nil
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   281
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   282
    "Created: 9.2.1996 / 19:05:28 / cg"
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   283
! !
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   284
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   285
!Method methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   286
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   287
category
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   288
    "return the methods category or nil"
737
4ed893ad3f0f try more to find source of obsolete methods
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   289
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   290
    ^ category
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   291
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   292
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   293
category:aStringOrSymbol
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   294
    "set the methods category"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   295
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   296
    category := aStringOrSymbol asSymbol
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   297
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   298
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   299
comment
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   300
    "return the methods comment.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   301
     This is done by searching for and returning the first comment
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   302
     from the methods source (excluding any double-quotes). 
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   303
     Returns nil if there is no comment (or source is not available)."
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   304
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   305
    |src comments parser|
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   306
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   307
    src := self source.
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   308
    src isNil ifTrue:[^ nil].
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   309
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   310
    parser := Parser for:src in:nil.
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   311
    parser ignoreErrors; ignoreWarnings; saveComments:true.
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   312
    parser parseMethodSpec.
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   313
    comments := parser comments.
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   314
    comments size == 0 ifTrue:[^ nil].
2066
b8d1c1d9e100 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
   315
    (comments first withoutSpaces endsWith:'}') ifTrue:[
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   316
        ^ comments at:2 ifAbsent:nil
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   317
    ].
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   318
    ^ comments first.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   319
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   320
    "
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   321
     (Method compiledMethodAt:#comment) comment  
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   322
     (Object class compiledMethodAt:#infoPrinting:) comment  
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   323
    "
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   324
2066
b8d1c1d9e100 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2064
diff changeset
   325
    "Modified: 5.1.1997 / 14:35:16 / cg"
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   326
!
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   327
1518
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   328
decompiledSource
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   329
    |s|
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   330
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   331
    s := '' writeStream.
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   332
    self decompileTo:s.
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   333
    ^ s contents
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   334
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   335
    "Created: 3.7.1996 / 10:12:31 / cg"
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   336
!
37fca48df8e3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1493
diff changeset
   337
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   338
flags
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   339
    "return the flags (number of method variables, stacksize etc.).
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   340
     Dont depend on the values in the flag field - its interpretations
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   341
     may change without notice."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   342
a27a279701f8 Initial revision
claus
parents:
diff changeset
   343
    ^ flags
a27a279701f8 Initial revision
claus
parents:
diff changeset
   344
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   345
    "Modified: 8.3.1996 / 13:20:48 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   346
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   347
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   348
getSource
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   349
    ^ source
414
claus
parents: 400
diff changeset
   350
!
claus
parents: 400
diff changeset
   351
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   352
localSourceFilename:aFileName position:aNumber
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   353
    "set the methods sourcefile/position indicating, that 
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   354
     this is a local file."
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   355
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   356
    source := aFileName.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   357
    sourcePosition := aNumber negated
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   358
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   359
    "Created: 16.1.1997 / 01:25:52 / cg"
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   360
!
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   361
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   362
numArgs
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   363
    "return the number of arguments, the method expects." 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   364
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   365
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   366
    /* made this a primitive to get define in stc.h */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   367
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   368
    RETURN (__MKSMALLINT((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT));
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   369
%}.
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   370
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   371
     The old implementation simply counted the arguments from
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   372
     the methods source - new versions include this information
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   373
     in the flag instVar, for more security in #perform:
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   374
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   375
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   376
    "
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   377
     (Method compiledMethodAt:#source) numArgs  
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   378
     (Method compiledMethodAt:#source:) numArgs 
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   379
    "
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   380
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   381
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   382
numberOfMethodArgs
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   383
    "return the number of arguments, the method expects.
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   384
     This method is left for backward compatibility - use #numArgs." 
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   385
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   386
    ^ self numArgs
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   387
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   388
    "Modified: 4.11.1996 / 21:42:08 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   389
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   390
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   391
numberOfMethodVars
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   392
    "return the number of method local variables. 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   393
     This method is left for backward compatibility - use #numVars." 
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   394
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   395
    ^ self numVars
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   396
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
   397
    "Modified: 4.11.1996 / 21:42:21 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   398
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   399
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   400
package
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   401
    "return the package-symbol"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   402
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   403
    ^ package
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   404
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   405
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   406
package:aSymbol
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   407
    "set the package-symbol"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   408
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   409
    package := aSymbol
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   410
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   411
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   412
source
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   413
    "return the sourcestring for the receiver"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   414
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
   415
    |aStream fileName junk who myClass mgr className|
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   416
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   417
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   418
     if sourcePosition is nonNil, its the fileName and
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   419
     abs(sourcePosition) is the offset.
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   420
     Otherwise, source is the real source
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   421
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   422
    sourcePosition isNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   423
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   424
    source notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   425
"/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   426
"/ original (old) code:
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   427
"/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   428
"/        aStream := Smalltalk systemFileStreamFor:('source/' , source).
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   429
"/        aStream notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   430
"/            aStream position:sourcePosition.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   431
"/            junk := aStream nextChunk.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   432
"/            aStream close
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   433
"/        ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   434
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   435
        "/ keep the last source file open, because open/close
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   436
        "/ operations maybe slow on NFS-mounted file systems.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   437
        "/ Since the reference to the file is weak, it will be closed
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   438
        "/ automatically if the file is not referenced for a while. 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   439
        "/ Neat trick.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   440
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   441
        LastFileLock critical:[
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   442
            aStream := LastFileReference at:1.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   443
            LastFileReference at:1 put:0.
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   444
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
   445
            aStream == 0 ifTrue:[
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   446
                aStream := nil.
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   447
            ] ifFalse:[
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   448
                LastSourceFileName = source ifFalse:[
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   449
                    aStream close.
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   450
                    aStream := nil.
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   451
                ].
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   452
            ].
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   453
        ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   454
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   455
        "/ a negative sourcePosition indicates
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   456
        "/ that this is a local file (not to be requested
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   457
        "/ via the sourceCodeManager)
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   458
        "/ This kludge was added, to allow sourceCode to be
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   459
        "/ saved to a local source file (i.e. 'st.src')
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   460
        "/ and having a clue for which file is meant later.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   461
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   462
        sourcePosition < 0 ifTrue:[
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   463
            aStream := source asFilename readStream.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   464
            aStream isNil ifTrue:[
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   465
                fileName := Smalltalk getSourceFileName:source.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   466
                fileName notNil ifTrue:[
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   467
                    aStream := fileName asFilename readStream.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   468
                ].
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   469
            ].
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   470
        ].
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   471
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   472
        aStream isNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   473
            "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   474
            "/ if there is no SourceManager, look in standard places
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   475
            "/ first
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   476
            "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   477
            (mgr := Smalltalk at:#SourceCodeManager) isNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   478
                fileName := Smalltalk getSourceFileName:source.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   479
                fileName notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   480
                    aStream := fileName asFilename readStream.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   481
                ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   482
            ].
2171
5d9e85086e47 oops - care for the case where a method has a different source
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
   483
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   484
            aStream isNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   485
                "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   486
                "/ nope - ask my class for the source (this also invokes the SCMgr)
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   487
                "/
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
   488
                who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
   489
                who notNil ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
   490
                    myClass := who methodClass.
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   491
                    aStream := myClass sourceStreamFor:source.
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   492
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   493
"/ the check below is no good -
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   494
"/ the classes stream may be an HTTP-stream, cached fileStream
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   495
"/ or whatever ...
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   496
"/
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   497
"/                    aStream pathName asFilename baseName ~= source asFilename baseName
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   498
"/                    ifTrue:[
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   499
"/                        "/ oops - not really
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   500
"/                        'Method [info]: do not trust my classes source' infoPrintCR.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   501
"/                        aStream close.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   502
"/                        aStream := nil.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   503
"/                    ]
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   504
                ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   505
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   506
                aStream isNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   507
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   508
                    "/ nope - look in standard places 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   509
                    "/ (if there is a source-code manager - otherwise, we already did that)
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   510
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   511
                    mgr notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   512
                        fileName := Smalltalk getSourceFileName:source.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   513
                        fileName notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   514
                            aStream := fileName asFilename readStream.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   515
                        ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   516
                    ].
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   517
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   518
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   519
                    "/ final chance: try current directory
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   520
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   521
                    aStream isNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   522
                        aStream := source asFilename readStream.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   523
                    ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   524
                ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   525
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
   526
                (aStream isNil and:[who isNil and:[source notNil]]) ifTrue:[
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   527
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   528
                    "/ mhmh - seems to be a method which used to be in some
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   529
                    "/ class, but has been overwritten by another or removed.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   530
                    "/ (i.e. it has no containing class anyMore)
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   531
                    "/ try to guess the class from the sourceFileName.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   532
                    "/ and retry.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   533
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   534
                    className := Smalltalk classNameForFile:source.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   535
                    className knownAsSymbol ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   536
                        myClass := Smalltalk at:className asSymbol ifAbsent:nil.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   537
                        myClass notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   538
                            aStream := myClass sourceStreamFor:source.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   539
                        ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   540
                    ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   541
                ]                
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   542
            ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   543
        ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   544
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   545
        aStream notNil ifTrue:[
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   546
            aStream position:sourcePosition abs.
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   547
            junk := aStream nextChunk.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   548
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   549
            "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   550
             keep a weak reference - it may be needed again soon ...
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   551
            "
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   552
            LastFileLock critical:[
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   553
                (LastFileReference at:1) == 0 ifTrue:[
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   554
                    LastFileReference at:1 put:aStream.
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   555
                    LastSourceFileName := source.
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   556
                ] ifFalse:[
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   557
                    aStream close.
1992
cbddc4463793 Bugfix: Method>>>source must close obsolete cached stream.
Stefan Vogel <sv@exept.de>
parents: 1925
diff changeset
   558
                ].
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   559
            ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   560
        ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   561
    ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   562
    ^ junk
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   563
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   564
    "Modified: 7.1.1997 / 16:20:09 / stefan"
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   565
    "Modified: 16.1.1997 / 01:25:14 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   566
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   567
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   568
source:aString
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   569
    "set the methods sourcestring"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   570
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   571
    source := aString.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   572
    sourcePosition := nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   573
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   574
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   575
sourceFilename
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   576
    "return the sourcefilename if source is extern; nil otherwise"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   577
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   578
    sourcePosition notNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   579
    ^ nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   580
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   581
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   582
sourceFilename:aFileName position:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   583
    "set the methods sourcefile/position"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   584
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   585
    source := aFileName.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   586
    sourcePosition := aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   587
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   588
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   589
sourcePosition
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   590
    "return the sourceposition if source is extern; nil otherwise"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   591
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   592
    sourcePosition isNil ifTrue:[^ sourcePosition].
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   593
    ^ sourcePosition abs
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   594
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   595
    "Modified: 16.1.1997 / 01:28:25 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   596
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   597
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   598
!Method methodsFor:'accessing-visibility'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   599
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   600
isIgnored
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   601
    "return true, if this is an ignored method.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   602
     Ignored methods are physically present in the source file,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   603
     but no code is generated for it by stc, and the VM does not see
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   604
     it in its message lookup.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   605
     (i.e. setting a method to #ignored, and sending that selector,
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   606
      leads to either the superclasses implementation to be called, 
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   607
      or a doesNotUnderstand exception to be raised)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   608
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   609
     Notice: this is a nonstandard feature, not supported
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   610
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   611
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   612
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   613
     It may change or even vanish (if it shows to be not useful)."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   614
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   615
%{  /* NOCONTEXT */
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   616
#if defined(F_IGNORED) && defined(M_PRIVACY)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   617
    int f = __intVal(__INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   618
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   619
    if ((f & M_PRIVACY) == F_IGNORED) {
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   620
	RETURN (true);
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   621
    }
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   622
#endif
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   623
%}.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   624
    ^ false
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   625
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   626
48061f8659aa more queries
claus
parents: 159
diff changeset
   627
isPrivate
48061f8659aa more queries
claus
parents: 159
diff changeset
   628
    "return true, if this is a private method.
48061f8659aa more queries
claus
parents: 159
diff changeset
   629
     Execution of private methods is only allowed via self/super sends
48061f8659aa more queries
claus
parents: 159
diff changeset
   630
     from superclasses, the class itself or subclasses.
48061f8659aa more queries
claus
parents: 159
diff changeset
   631
     If a private method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
   632
     error (PrivateMethodSignal) is raised.
48061f8659aa more queries
claus
parents: 159
diff changeset
   633
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
   634
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   635
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   636
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
   637
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
   638
48061f8659aa more queries
claus
parents: 159
diff changeset
   639
%{  /* NOCONTEXT */
48061f8659aa more queries
claus
parents: 159
diff changeset
   640
    /* I made this a primitive to get the define constant from stc.h */
48061f8659aa more queries
claus
parents: 159
diff changeset
   641
748
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   642
#if defined(F_PRIVATE) && defined(M_PRIVACY)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   643
    int f = __intVal(__INST(flags));
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   644
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   645
    if ((f & M_PRIVACY) == F_PRIVATE) {
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   646
	RETURN (true);
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   647
    }
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   648
#endif
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   649
%}.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   650
    ^ false
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   651
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   652
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   653
isProtected
48061f8659aa more queries
claus
parents: 159
diff changeset
   654
    "return true, if this is a protected method.
48061f8659aa more queries
claus
parents: 159
diff changeset
   655
     Execution of protected methods is only allowed via self sends
48061f8659aa more queries
claus
parents: 159
diff changeset
   656
     from superclasses or the class itself.
48061f8659aa more queries
claus
parents: 159
diff changeset
   657
     If a protected method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
   658
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   659
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   660
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
   661
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   662
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   663
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
   664
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
   665
48061f8659aa more queries
claus
parents: 159
diff changeset
   666
%{  /* NOCONTEXT */
48061f8659aa more queries
claus
parents: 159
diff changeset
   667
    /* I made this a primitive to get the define constant from stc.h */
48061f8659aa more queries
claus
parents: 159
diff changeset
   668
748
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   669
#if defined(F_CLASSPRIVATE) && defined(M_PRIVACY)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   670
    int f = __intVal(__INST(flags));
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   671
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   672
    if ((f & M_PRIVACY) == F_CLASSPRIVATE) {
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   673
	RETURN (true);
48061f8659aa more queries
claus
parents: 159
diff changeset
   674
    }
48061f8659aa more queries
claus
parents: 159
diff changeset
   675
#endif
48061f8659aa more queries
claus
parents: 159
diff changeset
   676
%}.
48061f8659aa more queries
claus
parents: 159
diff changeset
   677
    ^ false
48061f8659aa more queries
claus
parents: 159
diff changeset
   678
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   679
48061f8659aa more queries
claus
parents: 159
diff changeset
   680
isPublic
48061f8659aa more queries
claus
parents: 159
diff changeset
   681
    "return true, if this is a public method - I.e. can be executed via any send.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   682
     This is the default and how other smalltalk implementations treat all methods.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   683
360
claus
parents: 350
diff changeset
   684
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
   685
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   686
360
claus
parents: 350
diff changeset
   687
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
   688
     It may change or even vanish (if it shows to be not useful)."
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   689
48061f8659aa more queries
claus
parents: 159
diff changeset
   690
%{  /* NOCONTEXT */
48061f8659aa more queries
claus
parents: 159
diff changeset
   691
    /* I made this a primitive to get the define constant from stc.h */
48061f8659aa more queries
claus
parents: 159
diff changeset
   692
748
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   693
#if defined(M_PRIVACY) && (defined(F_PRIVATE) || defined(F_CLASSPRIVATE) || defined(F_IGNORED))
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   694
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   695
    int f = __intVal(__INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   696
# ifdef F_PRIVATE
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   697
    if ((f & M_PRIVACY) == F_PRIVATE) {
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   698
	RETURN (false);
48061f8659aa more queries
claus
parents: 159
diff changeset
   699
    }
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   700
# endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   701
# ifdef F_CLASSPRIVATE
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   702
    if ((f & M_PRIVACY) == F_CLASSPRIVATE) {
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   703
	RETURN (false);
48061f8659aa more queries
claus
parents: 159
diff changeset
   704
    }
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   705
# endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   706
# ifdef F_IGNORED
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   707
    if ((f & M_PRIVACY) == F_IGNORED) {
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   708
	RETURN (false);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   709
    }
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   710
# endif
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   711
#endif
48061f8659aa more queries
claus
parents: 159
diff changeset
   712
%}.
48061f8659aa more queries
claus
parents: 159
diff changeset
   713
    ^ true
48061f8659aa more queries
claus
parents: 159
diff changeset
   714
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   715
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   716
isRestricted
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   717
    "return the flag bit stating that this method is restricted.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   718
     Execution of the receiver will only be allowed if the system is not in
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   719
     'trap restricted mode' (-->ObjectMemory) otherise a runtime 
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   720
     error (PrivateMethodSignal) is raised.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   721
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   722
     Notice: method restriction is a nonstandard feature, not supported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   723
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   724
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   725
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   726
     It may change or even vanish (if it shows to be not useful)."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   727
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   728
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   729
#ifdef F_RESTRICTED
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   730
    int f = __intVal(__INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   731
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   732
    if (f & F_RESTRICTED) {
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   733
	RETURN (true);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   734
    }
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   735
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   736
%}.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   737
    ^ false
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   738
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   739
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   740
privacy
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   741
    "return a symbol describing the methods access rights (privacy);
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   742
     Currently, this is one of #private, #protected, #public or #ignored.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   743
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   744
     Notice: method privacy is a nonstandard feature, not supported
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   745
     by other smalltalk implementations and not specified in the ANSI spec.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   746
     If at all, use it for debugging purposes, to catch messagesends
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   747
     which are not supposed to be sent by others.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   748
     (especially, if working in a team, while integrating other peoples work)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   749
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   750
     This is EXPERIMENTAL - and being evaluated for usability.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   751
     It may change or even vanish (if it shows to be not useful)."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   752
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   753
    self isPrivate ifTrue:[^ #private].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   754
    self isProtected ifTrue:[^ #protected].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   755
    self isIgnored ifTrue:[^ #ignored].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   756
    ^ #public
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   757
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   758
    "Modified: 27.8.1995 / 22:53:31 / claus"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   759
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   760
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   761
privacy:aSymbol
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   762
    "set the methods access rights (privacy) from a symbol;
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   763
     Currently, this must be one of #private, #protected, #public or #ignored.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   764
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   765
     Notice: method privacy is a nonstandard feature, not supported
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   766
     by other smalltalk implementations and not specified in the ANSI spec.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   767
     If at all, use it for debugging purposes, to catch messagesends
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   768
     which are not supposed to be sent by others.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   769
     (especially, if working in a team, while integrating other peoples work)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   770
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   771
     This is EXPERIMENTAL - and being evaluated for usability.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   772
     It may change or even vanish (if it shows to be not useful)."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   773
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   774
    aSymbol == #public ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   775
	"/
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   776
	"/ no need to flush, if changing from private to public
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   777
	"/
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   778
	self isIgnored ifFalse:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   779
	    ^ self setToPublic
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   780
	].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   781
	self setToPublic
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   782
    ] ifFalse:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   783
	aSymbol == #private ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   784
	    self setToPrivate
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   785
	] ifFalse:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   786
	    aSymbol == #protected ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   787
		self setToProtected
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   788
	    ] ifFalse:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   789
		aSymbol == #ignored ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   790
		    self setToIgnored
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   791
		]
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   792
	    ]
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   793
	]
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   794
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   795
    ObjectMemory flushCaches.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   796
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   797
    "Modified: 27.8.1995 / 22:58:08 / claus"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   798
!
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   799
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   800
restricted:aBoolean
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   801
    "set or clear the flag bit stating that this method is restricted. 
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   802
     Execution of the receiver will only be allowed if the system is not in
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   803
     'trap restricted mode' (-->ObjectMemory) otherise a runtime
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   804
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   805
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   806
     Notice: method restriction is a nonstandard feature, not supported
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   807
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   808
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   809
     This is EXPERIMENTAL - and being evaluated for usability.
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   810
     It may change or even vanish (if it shows to be not useful)."
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   811
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   812
%{  /* NOCONTEXT */
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   813
    /* I made this a primitive to get the define constant from stc.h */
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   814
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   815
#ifdef F_RESTRICTED
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   816
    int f = __intVal(__INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   817
    int old;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   818
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   819
    old = f;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   820
    if (aBoolean == true) 
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   821
	f |= F_RESTRICTED;
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   822
    else
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   823
	f &= ~F_RESTRICTED;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   824
    __INST(flags) = __MKSMALLINT(f);
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   825
    if (old & F_RESTRICTED)
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   826
	RETURN(true);
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   827
#endif
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   828
%}.
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   829
    ^ false
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   830
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   831
    "
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   832
     (ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   833
    "
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   834
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   835
    "Created: 7.11.1995 / 20:36:19 / stefan"
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   836
!
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   837
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   838
setToIgnored
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   839
    "make this method be ignored w.r.t. method lookup.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   840
     (i.e. setting a method to #ignored, and sending that selector,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   841
      leads to either the superclasses implementation to be called, 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   842
      or a doesNotUnderstand exception to be raised)
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   843
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   844
     Notice: ignored methods are a nonstandard feature, not supported
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   845
     by other smalltalk implementations and not specified in the ANSI spec.
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   846
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   847
     This is EXPERIMENTAL - and being evaluated for usability.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   848
     It may change or even vanish (if it shows to be not useful)."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   849
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   850
%{  /* NOCONTEXT */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   851
    int f = __intVal(__INST(flags));
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   852
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   853
#if defined(F_IGNORED) && defined(M_PRIVACY)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   854
    f = (f & ~M_PRIVACY) | F_IGNORED;
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   855
#endif
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   856
    __INST(flags) = __MKSMALLINT(f);
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   857
%}
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   858
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   859
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   860
setToPrivate
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   861
    "set the flag bit stating that this method is private. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   862
     Execution of the receiver will only be allowed for self/super-sends from 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   863
     the class, superclasses or subclasses (or via #perform).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   864
     If a private method is called by some other class, a runtime
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   865
     error (PrivateMethodSignal) is raised.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   866
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   867
     Notice: method privacy is a nonstandard feature, not supported
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   868
     by other smalltalk implementations and not specified in the ANSI spec.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   869
     If at all, use it for debugging purposes, to catch messagesends
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   870
     which are not supposed to be sent by others.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   871
     (especially, if working in a team, while integrating other peoples work)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   872
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   873
     This is EXPERIMENTAL - and being evaluated for usability.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   874
     It may change or even vanish (if it shows to be not useful)."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   875
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   876
%{  /* NOCONTEXT */
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   877
    /* I made this a primitive to get the define constant from stc.h */
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   878
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   879
#if defined(F_PRIVATE) && defined(M_PRIVACY)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   880
    int f = __intVal(__INST(flags));
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   881
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   882
    f = (f & ~M_PRIVACY) | F_PRIVATE;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   883
    __INST(flags) = __MKSMALLINT(f);
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   884
#endif
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   885
%}
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   886
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   887
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   888
setToProtected
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   889
    "set the flag bit stating that this method is protected. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   890
     Execution of the receiver will only be allowed for self sends from
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   891
     the class or superclasses. (or via #perform).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   892
     If a private method is called by some other class, a runtime
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   893
     error (PrivateMethodSignal) is raised.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   894
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   895
     Notice: method privacy is a nonstandard feature, not supported
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   896
     by other smalltalk implementations and not specified in the ANSI spec.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   897
     If at all, use it for debugging purposes, to catch messagesends
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   898
     which are not supposed to be sent by others.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   899
     (especially, if working in a team, while integrating other peoples work)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   900
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   901
     This is EXPERIMENTAL - and being evaluated for usability.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   902
     It may change or even vanish (if it shows to be not useful)."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   903
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   904
%{  /* NOCONTEXT */
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   905
    /* I made this a primitive to get the define constant from stc.h */
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   906
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   907
#if defined(F_CLASSPRIVATE) && defined(M_PRIVACY)
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   908
    int f = __intVal(__INST(flags));
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   909
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   910
    f = (f & ~M_PRIVACY) | F_CLASSPRIVATE;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   911
    __INST(flags) = __MKSMALLINT(f);
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   912
#endif
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   913
%}
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   914
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   915
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   916
setToPublic
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   917
    "clear any privacy/ignoreFlag of the receiver. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   918
     The receiver may be executed by any send. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   919
     This is the default anyway for methods, and how other smalltalk
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   920
     implementations treat all methods.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   921
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   922
     Notice: method privacy is a nonstandard feature, not supported
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   923
     by other smalltalk implementations and not specified in the ANSI spec.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   924
     If at all, use it for debugging purposes, to catch messagesends
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   925
     which are not supposed to be sent by others.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   926
     (especially, if working in a team, while integrating other peoples work)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   927
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   928
     This is EXPERIMENTAL - and being evaluated for usability.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   929
     It may change or even vanish (if it shows to be not useful)."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   930
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   931
%{  /* NOCONTEXT */
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   932
    /* I made this a primitive to get the define constant from stc.h */
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   933
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   934
#ifdef M_PRIVACY
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   935
    int f = __intVal(__INST(flags));
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   936
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   937
    f = f & ~M_PRIVACY;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   938
    __INST(flags) = __MKSMALLINT(f);
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   939
#endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   940
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
   941
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   942
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   943
!Method methodsFor:'binary storage'!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   944
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   945
asByteCodeMethod
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   946
    "if the receiver has no bytecodes, create & return a method having
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   947
     the same semantics as the receiver, but uses interpreted bytecodes.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   948
     Otherwise, return the receiver. The new method is not installed in
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   949
     the methodDictionary of any class - just returned.
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   950
     If the method contains primitive code, this may return a method
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   951
     without bytecode.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   952
     Can be used to obtain a bytecode version of a machine-code method, 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   953
     for binary storage or dynamic recompilation (which is not yet finished)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   954
     or to compile lazy methods down to executable ones."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   955
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   956
    |doMachineCode mthd|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   957
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   958
    byteCode notNil ifTrue:[
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   959
        "
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   960
         is already a bytecoded method
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   961
        "
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   962
        ^ self
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   963
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   964
    doMachineCode := Compiler stcCompilation:#never.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   965
    [
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   966
        mthd := self asExecutableMethod.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   967
    ] valueNowOrOnUnwindDo:[
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   968
        Compiler stcCompilation:doMachineCode.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   969
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   970
    ^ mthd
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   971
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   972
    "Created: 24.10.1995 / 14:02:32 / cg"
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   973
    "Modified: 5.1.1997 / 01:01:53 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   974
!
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
   975
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   976
asExecutableMethod
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   977
    "if the receiver has neither bytecodes nor machinecode, create & return a 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   978
     method having semantics as the receivers source. This may be machine code,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   979
     if the system supports dynamic loading of object code and the source includes
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   980
     primitive code. However, bytecode is preferred, since it compiles faster.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   981
     Otherwise, return the receiver. The new method is not installed in
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   982
     the methodDictionary of any class - just returned.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   983
     Can be used to compile lazy methods down to executable ones."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   984
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   985
    |temporaryMethod cls sourceString silent lazy|
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
   986
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   987
    byteCode notNil ifTrue:[
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   988
        "
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   989
         is already a bytecoded method
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   990
        "
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   991
        ^ self
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   992
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   993
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   994
    cls := self containingClass.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   995
    cls isNil ifTrue:[
2132
05d2be2d280e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2079
diff changeset
   996
        'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR.
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   997
        ^ nil
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   998
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   999
    sourceString := self source.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1000
    sourceString isNil ifTrue:[
2132
05d2be2d280e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2079
diff changeset
  1001
        'Method [warning]: cannot generate bytecode (no source for compilation)' errorPrintCR.
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1002
        ^ nil
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1003
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1004
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1005
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1006
     dont want this to go into the changes file,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1007
     dont want output on Transcript and definitely 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1008
     dont want a lazy method ...
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1009
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1010
    Class withoutUpdatingChangesDo:[
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1011
        silent := Smalltalk silentLoading:true.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1012
        lazy := Compiler compileLazy:false.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1013
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1014
        [
1691
6f12a1827aec checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1690
diff changeset
  1015
            |compiler|
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1016
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1017
            compiler := cls compilerClass.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1018
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1019
            "/
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1020
            "/ kludge - have to make ST/X's compiler protocol
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1021
            "/ be compatible to ST-80's
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1022
            "/
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1023
            (compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:)
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1024
            ifTrue:[
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1025
                temporaryMethod := compiler
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1026
                                     compile:sourceString
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1027
                                     forClass:cls
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1028
                                     inCategory:(self category)
1692
96ae6de5ce43 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1691
diff changeset
  1029
                                     notifying:nil
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1030
                                     install:false.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1031
            ] ifFalse:[
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1032
                temporaryMethod := compiler new
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1033
                                     compile:sourceString 
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1034
                                     in:cls 
1692
96ae6de5ce43 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1691
diff changeset
  1035
                                     notifying:nil 
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1036
                                     ifFail:nil
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1037
            ].
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1038
        ] valueNowOrOnUnwindDo:[
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1039
            Compiler compileLazy:lazy.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1040
            Smalltalk silentLoading:silent.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1041
        ]
463
447ead9f870c be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  1042
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1043
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
2132
05d2be2d280e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2079
diff changeset
  1044
        'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR.
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
  1045
        ^ nil.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1046
    ].
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1047
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1048
     try to save a bit of memory, by sharing the source (whatever it is)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1049
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1050
    temporaryMethod sourceFilename:source position:sourcePosition. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1051
    ^ temporaryMethod
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1052
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1053
    "Created: 24.10.1995 / 14:02:30 / cg"
2132
05d2be2d280e newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents: 2079
diff changeset
  1054
    "Modified: 10.1.1997 / 17:55:33 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1055
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1056
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1057
readBinaryContentsFrom: stream manager: manager
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1058
    self code notNil ifTrue:[
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1059
        "built-in method - already complete"
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1060
        ^ self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1061
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1062
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1063
    ^ super readBinaryContentsFrom: stream manager: manager
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1065
    "Modified: 5.1.1997 / 01:02:43 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1066
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1067
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1068
storeBinaryDefinitionOn:stream manager:manager
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1069
    "store the receiver in a binary format on stream.
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1070
     This is an internal interface for binary storage mechanism.
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1071
     only store bytecode-methods - machinecode methods are stored
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1072
     as class/selector pair and a lookup is done when restored.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1073
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1074
     If the receiver method is a built-in (i.e. machine coded)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1075
     method, a temporary interpreted byte code method is created,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1076
     and its bytecode stored. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1077
     This works only, if the source of the method is available and the
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1078
     method does not contain primitive code."
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1079
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1080
    |storedMethod who|
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1081
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1082
    byteCode isNil ifTrue:[
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1083
        self code notNil ifTrue:[
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1084
            (who := self who) notNil ifTrue:[
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1085
                "
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1086
                 machine code only - assume its a built-in method,
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1087
                 and store the class/selector information.
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1088
                 The restored method may not be exactly the same ...
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1089
                "
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1090
                manager putIdOfClass:(self class) on:stream.
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1091
                stream nextPutByte:0.   "means: built-in method" 
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1092
                manager putIdOf:(who methodClass) on:stream.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1093
                manager putIdOf:(who methodSelector) on:stream.
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1094
                ^ self
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1095
            ]
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1096
        ].
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1097
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1098
        storedMethod := self asByteCodeMethod.
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1099
        storedMethod isNil ifTrue:[
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1100
            self error:'store of built-in method failed'.
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1101
            ^ nil
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1102
        ].
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1103
        ^ storedMethod storeBinaryDefinitionOn:stream manager:manager
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1104
    ].
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1105
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1106
    manager putIdOfClass:(self class) on:stream.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1107
    stream nextPutByte:1.       "means: byte-coded method"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1108
    self storeBinaryDefinitionBodyOn:stream manager:manager
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1109
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1110
    "Modified: 1.11.1996 / 16:26:45 / cg"
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1111
!
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1112
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1113
storeFullBinaryDefinitionOn:stream manager:manager
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1114
    "store full bytecoded-method."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1115
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1116
    |m code srcPos|
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1117
2063
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1118
    "/ need a byteCode version of myself ...
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1119
    m := self.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1120
    code := byteCode.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1121
    code isNil ifTrue:[
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1122
        m := self asByteCodeMethod.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1123
        code := m byteCode.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1124
        code isNil ifTrue:[
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1125
            m := self
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1126
        ]
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1127
    ].
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1128
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1129
    ObjectMemory snapshotID storeBinaryOn:stream manager:manager.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1130
    category storeBinaryOn:stream manager:manager.
362
claus
parents: 360
diff changeset
  1131
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1132
    m flags storeBinaryOn:stream manager:manager.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1133
    m literals storeBinaryOn:stream manager:manager.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1134
    manager sourceMode == #discard ifTrue:[
2063
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1135
        "/ add nil, nil, nil
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1136
        nil storeBinaryOn:stream manager:manager. "/ sourceFileName
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1137
        nil storeBinaryOn:stream manager:manager. "/ sourcePosition
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1138
        nil storeBinaryOn:stream manager:manager. "/ source
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1139
    ] ifFalse:[
2063
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1140
        "/ add sourceFilename, srcPos
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1141
        "/ or  nil, nil, source
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1142
        m sourceFilename storeBinaryOn:stream manager:manager.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1143
        manager sourceMode == #reference ifTrue:[
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1144
            srcPos := m sourcePosition.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1145
        ] ifFalse:[
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1146
            srcPos := nil
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1147
        ].
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1148
        srcPos storeBinaryOn:stream manager:manager.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1149
        srcPos isNil ifTrue:[
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1150
            m source storeBinaryOn:stream manager:manager.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1151
        ].
391
claus
parents: 384
diff changeset
  1152
    ].
2063
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1153
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1154
    code storeBinaryOn:stream manager:manager.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1155
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1156
    "Created: 16.1.1996 / 14:41:45 / cg"
2063
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1157
    "Modified: 5.1.1997 / 00:39:29 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1158
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1159
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1160
!Method methodsFor:'copying'!
438
claus
parents: 423
diff changeset
  1161
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1162
copy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1163
    "redefined to change a source ref into a real string"
438
claus
parents: 423
diff changeset
  1164
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1165
    |aCopy|
438
claus
parents: 423
diff changeset
  1166
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1167
    aCopy := super copy.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1168
    sourcePosition notNil ifTrue:[
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1169
        aCopy source:(self source)
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1170
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1171
    ^ aCopy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1172
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1173
    "Modified: 16.1.1997 / 01:27:25 / cg"
438
claus
parents: 423
diff changeset
  1174
! !
claus
parents: 423
diff changeset
  1175
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1176
!Method methodsFor:'error handling'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1177
328
claus
parents: 326
diff changeset
  1178
invalidCodeObject
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1179
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1180
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1181
    "this method is triggered by the interpreter when a nil or non method
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1182
     is about to be executed.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1183
     In this case, the VM sends this to the bad method (the receiver).
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1184
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1185
     Also, the Compiler creates methods with their code/bytecode set to
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1186
     this method if - after a class change - a method cannot be compiled
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1187
     and is therefore no longer executable (for example, after an instvar
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1188
     has been removed, and a method still tries to access this instvar)
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1189
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1190
     Thus, we arrive here, when playing around in a classes methodArray,
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1191
     or compiler/runtime system is broken :-(, 
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1192
     or you ignore the error messages during some recompile."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1193
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1194
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1195
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1196
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1197
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1198
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1199
%}.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1200
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1201
        raiseErrorString:'invalid method - not executable'.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1202
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1203
    "Modified: 4.11.1996 / 22:45:06 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1204
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1205
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1206
invalidCodeObjectWith:arg
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1207
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1208
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1209
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1210
     uncompilable methods (with 1 arg) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1211
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1212
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1213
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1214
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1215
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1216
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1217
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1218
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1219
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1220
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1221
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1222
    "Created: 4.11.1996 / 21:16:16 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1223
    "Modified: 4.11.1996 / 22:45:12 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1224
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1225
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1226
invalidCodeObjectWith:arg with:arg2
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1227
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1228
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1229
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1230
     uncompilable methods (with 2 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1231
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1232
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1233
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1234
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1235
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1236
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1237
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1238
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1239
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1240
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1241
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1242
    "Created: 4.11.1996 / 21:16:41 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1243
    "Modified: 4.11.1996 / 22:45:15 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1244
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1245
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1246
invalidCodeObjectWith:arg with:arg2 with:arg3
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1247
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1248
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1249
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1250
     uncompilable methods (with 3 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1251
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1252
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1253
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1254
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1255
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1256
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1257
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1258
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1259
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1260
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1261
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1262
    "Created: 4.11.1996 / 21:16:51 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1263
    "Modified: 4.11.1996 / 22:45:18 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1264
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1265
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1266
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1267
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1268
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1269
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1270
     uncompilable methods (with 4 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1271
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1272
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1273
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1274
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1275
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1276
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1277
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1278
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1279
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1280
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1281
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1282
    "Created: 4.11.1996 / 21:17:00 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1283
    "Modified: 4.11.1996 / 22:45:22 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1284
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1285
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1286
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1287
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1288
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1289
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1290
     uncompilable methods (with 5 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1291
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1292
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1293
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1294
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1295
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1296
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1297
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1298
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1299
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1300
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1301
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1302
    "Created: 4.11.1996 / 21:17:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1303
    "Modified: 4.11.1996 / 22:45:25 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1304
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1305
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1306
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1307
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1308
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1309
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1310
     uncompilable methods (with 6 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1311
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1312
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1313
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1314
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1315
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1316
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1317
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1318
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1319
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1320
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1321
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1322
    "Created: 4.11.1996 / 21:17:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1323
    "Modified: 4.11.1996 / 22:45:28 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1324
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1325
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1326
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1327
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1328
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1329
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1330
     uncompilable methods (with 7 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1331
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1332
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1333
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1334
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1335
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1336
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1337
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1338
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1339
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1340
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1341
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1342
    "Created: 4.11.1996 / 21:17:25 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1343
    "Modified: 4.11.1996 / 22:45:31 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1344
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1345
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1346
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1347
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1348
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1349
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1350
     uncompilable methods (with 8 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1351
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1352
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1353
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1354
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1355
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1356
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1357
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1358
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1359
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1360
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1361
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1362
    "Created: 4.11.1996 / 21:17:32 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1363
    "Modified: 4.11.1996 / 22:45:38 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1364
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1365
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1366
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1367
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1368
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1369
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1370
     uncompilable methods (with 9 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1371
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1372
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1373
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1374
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1375
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1376
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1377
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1378
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1379
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1380
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1381
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1382
    "Created: 4.11.1996 / 21:17:37 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1383
    "Modified: 4.11.1996 / 22:45:41 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1384
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1385
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1386
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1387
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1388
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1389
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1390
     uncompilable methods (with 10 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1391
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1392
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1393
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1394
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1395
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1396
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1397
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1398
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1399
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1400
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1401
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1402
    "Created: 4.11.1996 / 21:17:45 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1403
    "Modified: 4.11.1996 / 22:45:44 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1404
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1405
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1406
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1407
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1408
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1409
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1410
     uncompilable methods (with 11 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1411
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1412
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1413
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1414
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1415
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1416
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1417
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1418
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1419
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1420
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1421
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1422
    "Created: 4.11.1996 / 21:17:52 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1423
    "Modified: 4.11.1996 / 22:45:47 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1424
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1425
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1426
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1427
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1428
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1429
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1430
     uncompilable methods (with 12 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1431
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1432
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1433
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1434
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1435
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1436
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1437
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1438
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1439
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1440
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1441
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1442
    "Created: 4.11.1996 / 20:51:28 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1443
    "Modified: 4.11.1996 / 22:46:01 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1444
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1445
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1446
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 with:arg13
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1447
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1448
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1449
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1450
     uncompilable methods (with 13 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1451
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1452
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1453
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1454
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1455
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1456
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1457
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1458
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1459
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1460
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1461
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1462
    "Created: 4.11.1996 / 21:18:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1463
    "Modified: 4.11.1996 / 22:45:57 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1464
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1465
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1466
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 with:arg13 with:arg14
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1467
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1468
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1469
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1470
     uncompilable methods (with 14 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1471
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1472
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1473
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1474
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1475
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1476
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1477
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1478
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1479
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1480
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1481
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1482
    "Created: 4.11.1996 / 21:18:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1483
    "Modified: 4.11.1996 / 22:45:55 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1484
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1485
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1486
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 with:arg13 with:arg14 with:arg15
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1487
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1488
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1489
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1490
     uncompilable methods (with 15 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1491
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1492
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1493
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1494
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1495
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1496
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1497
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1498
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1499
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1500
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1501
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1502
    "Created: 4.11.1996 / 21:18:22 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1503
    "Modified: 4.11.1996 / 22:45:52 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1504
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1505
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1506
privateMethodCalled
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1507
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1508
980
0ab2f56ecfc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1509
    "this error is triggered, if a private or protected method is called.
0ab2f56ecfc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1510
360
claus
parents: 350
diff changeset
  1511
     If you continue in the debugger, the method will be called,
415
claus
parents: 414
diff changeset
  1512
     and further privacy exceptions will NOT be reported at this call location, 
360
claus
parents: 350
diff changeset
  1513
     until any new method is compiled, or the privacy of any method changes,
claus
parents: 350
diff changeset
  1514
     or the caches are flushed.
claus
parents: 350
diff changeset
  1515
     (the reason is that after the continue, the method is enterred into the
claus
parents: 350
diff changeset
  1516
      calling cache, for which method privacy is not checked.
claus
parents: 350
diff changeset
  1517
      Any of the above actions flushes this cache and a privacy check
claus
parents: 350
diff changeset
  1518
      is performed again.)
claus
parents: 350
diff changeset
  1519
     Future versions may not enter private methods into the cache, to fix this
claus
parents: 350
diff changeset
  1520
     (unobvious) behavior. However, then you will get an exception for EVERY
claus
parents: 350
diff changeset
  1521
     call to a private method ...
claus
parents: 350
diff changeset
  1522
claus
parents: 350
diff changeset
  1523
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
  1524
     by other smalltalk implementations and not specified in the ANSI spec.
claus
parents: 350
diff changeset
  1525
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
  1526
     It may change or even vanish (if it shows to be not useful)."
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1527
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1528
    ^ PrivateMethodSignal raise
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1529
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1530
    "Modified: 4.11.1996 / 22:46:09 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1531
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1532
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1533
uncompiledCodeObject
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1534
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1535
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1536
    "this method is invoked by methods which contain primitive code,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1537
     but have not been compiled to machine code (either due to an error
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1538
     when compiling, or simply because no stc is available.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1539
     For those methods, the compiler generated a method object consisting
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1540
     of the original source code, but with this methods machine/byte code."
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1541
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1542
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1543
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1544
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1545
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1546
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1547
%}.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1548
    ^ InvalidCodeSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1549
        raiseRequestWith:self
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1550
        errorString:'invalid method - not compiled'.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1551
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1552
    "Modified: 4.11.1996 / 22:58:02 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1553
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1554
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1555
unloadedCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1556
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1557
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1558
    "this method is invoked by methods which have been binary-unloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1559
     For those the source info consists
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1560
     of the original source code, but with this methods machine/byte code."
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1561
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1562
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1563
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1564
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1565
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1566
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1567
%}.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1568
    ^ InvalidCodeSignal
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1569
        raiseRequestWith:self
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1570
        errorString:'invalid method - unloaded'.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1571
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1572
    "Created: 4.11.1996 / 22:57:54 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1573
    "Modified: 4.11.1996 / 22:58:28 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1574
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1575
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1576
wrongNumberOfArguments:numberGiven
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1577
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1578
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1579
    "this error is triggered, if a method is called with a wrong number
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1580
     of arguments. This only applies to #valueWithReceiverXXX - sends.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1581
     With a normal send, this error cannot happen."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1582
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1583
    ^ ArgumentSignal
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1584
        raiseRequestWith:self
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1585
        errorString:('method got ' , numberGiven printString ,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1586
                     ' args while ' , self numberOfMethodArgs printString , ' where expected')
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1587
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1588
    "Modified: 4.11.1996 / 22:46:16 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1589
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1590
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1591
!Method methodsFor:'executing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1592
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1593
valueWithReceiver:anObject arguments:argArray
2
claus
parents: 1
diff changeset
  1594
    "low level call of a methods code - BIG DANGER ALERT.
claus
parents: 1
diff changeset
  1595
     Perform the receiver-method on anObject as receiver and argArray as
claus
parents: 1
diff changeset
  1596
     arguments. This does NO message lookup at all and mimics a
claus
parents: 1
diff changeset
  1597
     traditional function call.
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1598
     This method is provided for debugging- and breakpoint-support 
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1599
     (replacing a method by a stub and recalling the original), or to implement
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1600
     experimental MI implementations - it is not for general use. 
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1601
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1602
     The receiver must be a method compiled in anObjects class or one of its 
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1603
     superclasses and also, the number of arguments given must match the methods
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1604
     expectations -
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1605
     - otherwise strange things (and also strange crashes) can occur.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1606
     The system is NOT always detecting a wrong method/receiver combination.
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1607
     YOU HAVE BEEN WARNED."
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1608
2527
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1609
    ^ self 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1610
        valueWithReceiver:anObject 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1611
        arguments:argArray 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1612
        selector:nil 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1613
        search:nil
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1614
        sender:nil
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1615
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1616
    "Modified: 4.4.1997 / 23:33:56 / cg"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1617
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1618
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1619
valueWithReceiver:anObject arguments:argArray selector:aSymbol
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1620
    "low level call of a methods code - BIG DANGER ALERT.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1621
     Perform the receiver-method on anObject as receiver and argArray as
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1622
     arguments. This does NO message lookup at all and mimics a
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1623
     traditional function call.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1624
     This method is provided for debugging- and breakpoint-support 
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1625
     (replacing a method by a stub and recalling the original), or to implement
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1626
     experimental MI implementations - it is not for general use. 
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1627
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1628
     The receiver must be a method compiled in anObjects class or one of its 
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1629
     superclasses and also, the number of arguments given must match the methods
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1630
     expectations -
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1631
     - otherwise strange things (and also strange crashes) can occur.
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1632
     The system is NOT always detecting a wrong method/receiver combination.
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1633
     YOU HAVE BEEN WARNED."
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1634
2527
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1635
    ^ self 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1636
        valueWithReceiver:anObject 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1637
        arguments:argArray 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1638
        selector:aSymbol 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1639
        search:nil
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1640
        sender:nil
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1641
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1642
    "Modified: 4.4.1997 / 23:34:08 / cg"
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1643
!
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1644
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1645
valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1646
    "low level call of a methods code - BIG DANGER ALERT.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1647
     Perform the receiver-method on anObject as receiver and argArray as
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1648
     arguments. This does NO message lookup at all and mimics a
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1649
     traditional function call.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1650
     This method is provided for debugging- and breakpoint-support 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1651
     (replacing a method by a stub and recalling the original), or to implement
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1652
     experimental MI implementations - it is not for general use. 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1653
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1654
     The receiver must be a method compiled in anObjects class or one of its 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1655
     superclasses and also, the number of arguments given must match the methods
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1656
     expectations -
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1657
     - otherwise strange things (and also strange crashes) can occur.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1658
     The system is NOT always detecting a wrong method/receiver combination.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1659
     YOU HAVE BEEN WARNED."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1660
2527
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1661
    ^ self 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1662
        valueWithReceiver:anObject 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1663
        arguments:argArray 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1664
        selector:aSymbol 
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1665
        search:nil
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1666
        sender:nil
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1667
204033bd73a7 save a message send in #valueWithReceiver:arguments:
Claus Gittinger <cg@exept.de>
parents: 2518
diff changeset
  1668
    "Modified: 4.4.1997 / 23:34:19 / cg"
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1669
!
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1670
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1671
valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1672
    "low level call of a methods code - BIG DANGER ALERT.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1673
     Perform the receiver-method on anObject as receiver and argArray as
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1674
     arguments. This does NO message lookup at all and mimics a
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1675
     traditional function call.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1676
     This method is provided for debugging- and breakpoint-support 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1677
     (replacing a method by a stub and recalling the original), or to implement
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1678
     experimental MI implementations - it is not for general use. 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1679
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1680
     The receiver must be a method compiled in anObjects class or one of its 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1681
     superclasses and also, the number of arguments given must match the methods
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1682
     expectations -
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1683
     - otherwise strange things (and also strange crashes) can occur.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1684
     The system is NOT always detecting a wrong method/receiver combination.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1685
     YOU HAVE BEEN WARNED."
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1686
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1687
%{
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1688
    OBJFUNC code;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1689
    OBJ searchClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1690
    static struct inlineCache dummy = _DUMMYILC0;
2
claus
parents: 1
diff changeset
  1691
    int nargs;
claus
parents: 1
diff changeset
  1692
    OBJ *ap;
claus
parents: 1
diff changeset
  1693
1672
1b56d6e95c9e changes to call dynamic compiled code right after compilation.
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  1694
    /*
1b56d6e95c9e changes to call dynamic compiled code right after compilation.
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  1695
     * args must be an array, or nil
1b56d6e95c9e changes to call dynamic compiled code right after compilation.
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  1696
     */
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1697
    if (__isArray(argArray)) {
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1698
        nargs = __arraySize(argArray);
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1699
        ap = __ArrayInstPtr(argArray)->a_element;
2
claus
parents: 1
diff changeset
  1700
    } else {
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1701
        if (argArray != nil) {
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1702
            goto badArgs;
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1703
        }
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1704
        nargs = 0;
2
claus
parents: 1
diff changeset
  1705
    }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1706
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1707
#ifdef F_NARGS
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1708
    if (((__intVal(__INST(flags)) & F_NARGS) >> F_NARGSHIFT) == nargs) 
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1709
#endif
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1710
    {
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1711
        code = __MethodInstPtr(self)->m_code;
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1712
        if (aClass == nil) {
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1713
            searchClass = dummy.ilc_class = __Class(anObject);
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1714
        } else {
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1715
            searchClass = dummy.ilc_class = aClass;
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1716
        }
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1717
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1718
        if (nargs <= 15) {
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1719
          /*
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1720
           * add virtual sender (unwinding) here later,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1721
           * to allow hiding contexts in lazy methods.
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1722
           * (this is cosmetics only; therefore its done later)
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1723
           */
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1724
          if (code) {
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1725
            /* compiled code */
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1726
            switch (nargs) {
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1727
                case 0:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1728
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy) );
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1729
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1730
                case 1:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1731
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, ap[0]) );
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1732
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1733
                case 2:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1734
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1]) );
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1735
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1736
                case 3:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1737
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, ap[0], ap[1], ap[2]) );
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1738
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1739
                case 4:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1740
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1741
                                 ap[0], ap[1], ap[2], ap[3]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1742
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1743
                case 5:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1744
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1745
                                 ap[0], ap[1], ap[2], ap[3], ap[4]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1746
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1747
                case 6:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1748
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1749
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1750
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1751
                case 7:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1752
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1753
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1754
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1755
                case 8:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1756
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1757
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1758
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1759
                case 9:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1760
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1761
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1762
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1763
                case 10:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1764
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1765
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1766
                                 ap[9]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1767
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1768
                case 11:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1769
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1770
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1771
                                 ap[9], ap[10]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1772
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1773
                case 12:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1774
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1775
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1776
                                 ap[9], ap[10], ap[11]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1777
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1778
                case 13:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1779
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1780
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1781
                                 ap[9], ap[10], ap[11], ap[12]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1782
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1783
                case 14:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1784
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1785
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1786
                                 ap[9], ap[10], ap[11], ap[12], ap[13]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1787
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1788
                case 15:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1789
                    RETURN ( (*code)(anObject, aSymbol, searchClass, &dummy, 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1790
                                 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1791
                                 ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1792
            }
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1793
          } else {
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1794
            /* interpreted code */
328
claus
parents: 326
diff changeset
  1795
#ifdef PASS_ARG_POINTER
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1796
            RETURN ( __interpret(self, nargs, anObject, aSymbol, searchClass, &dummy, ap) );
328
claus
parents: 326
diff changeset
  1797
#else
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1798
            switch (nargs) {
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1799
                case 0:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1800
                    RETURN ( __interpret(self, 0, anObject, aSymbol, searchClass, &dummy) );
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1801
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1802
                case 1:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1803
                    RETURN ( __interpret(self, 1, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1804
                                   ap[0]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1805
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1806
                case 2:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1807
                    RETURN ( __interpret(self, 2, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1808
                                   ap[0], ap[1]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1809
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1810
                case 3:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1811
                    RETURN ( __interpret(self, 3, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1812
                                   ap[0], ap[1], ap[2]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1813
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1814
                case 4:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1815
                    RETURN ( __interpret(self, 4, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1816
                                   ap[0], ap[1], ap[2], ap[3]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1817
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1818
                case 5:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1819
                    RETURN ( __interpret(self, 5, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1820
                                   ap[0], ap[1], ap[2], ap[3], ap[4]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1821
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1822
                case 6:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1823
                    RETURN ( __interpret(self, 6, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1824
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1825
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1826
                case 7:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1827
                    RETURN ( __interpret(self, 7, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1828
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1829
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1830
                case 8:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1831
                    RETURN ( __interpret(self, 8, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1832
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1833
                                   ap[7]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1834
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1835
                case 9:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1836
                    RETURN ( __interpret(self, 9, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1837
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1838
                                   ap[7], ap[8]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1839
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1840
                case 10:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1841
                    RETURN ( __interpret(self, 10, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1842
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1843
                                   ap[7], ap[8], ap[9]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1844
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1845
                case 11:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1846
                    RETURN ( __interpret(self, 11, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1847
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1848
                                   ap[7], ap[8], ap[9], ap[10]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1849
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1850
                case 12:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1851
                    RETURN ( __interpret(self, 12, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1852
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1853
                                   ap[7], ap[8], ap[9], ap[11]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1854
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1855
                case 13:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1856
                    RETURN ( __interpret(self, 13, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1857
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1858
                                   ap[7], ap[8], ap[9], ap[11], ap[12]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1859
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1860
                case 14:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1861
                    RETURN ( __interpret(self, 14, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1862
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1863
                                   ap[7], ap[8], ap[9], ap[11], ap[12], ap[13]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1864
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1865
                case 15:
2201
db0f6e86c8bb COMMA_SENDER arg is no longer supported / needed
Claus Gittinger <cg@exept.de>
parents: 2176
diff changeset
  1866
                    RETURN ( __interpret(self, 15, anObject, aSymbol, searchClass, &dummy,
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1867
                                   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1868
                                   ap[7], ap[8], ap[9], ap[11], ap[12], ap[13], ap[14]) );
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1869
            }
328
claus
parents: 326
diff changeset
  1870
#endif
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1871
          }
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1872
        }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1873
    }
1672
1b56d6e95c9e changes to call dynamic compiled code right after compilation.
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  1874
    badArgs: ;
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1875
%}.
2
claus
parents: 1
diff changeset
  1876
    (argArray isMemberOf:Array) ifFalse:[
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1877
        "
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1878
         arguments must be either nil or an array
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1879
        "
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1880
        ^ self badArgumentArray
2
claus
parents: 1
diff changeset
  1881
    ].
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1882
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1883
    (argArray size ~~ self numArgs) ifTrue:[
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1884
        "
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1885
         the method expects a different number of arguments
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1886
        "
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1887
        ^ self wrongNumberOfArguments:argArray size
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1888
    ].
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1889
    
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1890
    "/ the VM only supports a limited number of arguments in sends
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1891
    "/ (currently, 15)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1518
diff changeset
  1892
    
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1893
    ^ self tooManyArguments
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1894
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1895
    "
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1896
     (Float compiledMethodAt:#+) 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1897
        valueWithReceiver:1.0 arguments:#(2.0)
2
claus
parents: 1
diff changeset
  1898
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1899
     'the next example is a wrong one - which is detected by True's method ...'.
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1900
     (True compiledMethodAt:#printString) 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1901
        valueWithReceiver:false arguments:nil
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1902
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1903
     'the next example is a wrong one - it is nowhere detected
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1904
      and a wrong value returned ...'.
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1905
     (Point compiledMethodAt:#x) 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1906
        valueWithReceiver:(1->2) arguments:nil
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1907
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1908
     'the next example is VERY bad one - it is nowhere detected
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1909
      and may crash the system WARNING: save your work before doing this ...'.
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1910
     (Point compiledMethodAt:#x) 
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1911
        valueWithReceiver:(Object new) arguments:nil
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1912
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1913
     'the next example is a wrong one - which is detected here ...'.
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1914
     (Object compiledMethodAt:#printOn:)
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1915
        valueWithReceiver:false arguments:nil
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1916
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1917
     'the next example is a wrong one - which is detected here ...'.
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1918
     (Object compiledMethodAt:#printOn:)
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1919
        valueWithReceiver:false arguments:#() 
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1920
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1921
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1922
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1923
!Method methodsFor:'printing & storing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1924
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1925
printOn:aStream
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1926
    "put a printed representation of the receiver onto aStream.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1927
     Since methods do not store their class/selector, we have to search
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1928
     for it here."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1929
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1930
    |classAndSelector m wrapped|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1931
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1932
    wrapped := false.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1933
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1934
    aStream nextPutAll:(self classNameWithArticle).
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1935
    aStream nextPut:$(.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1936
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1937
    classAndSelector := self who.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1938
    classAndSelector isNil ifTrue:[
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1939
        "
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1940
         not anchored in any class.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1941
         check if wrapped (to be more informative in inspectors)
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1942
        "
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1943
        m := self wrapper.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1944
        m notNil ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1945
            classAndSelector := m who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1946
            wrapped := true.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1947
        ]
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1948
    ].
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1949
    classAndSelector notNil ifTrue:[
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1950
        (classAndSelector methodClass) name printOn:aStream.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1951
        aStream nextPutAll:' '.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1952
        (classAndSelector methodSelector) printOn:aStream.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1953
        wrapped ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1954
            aStream nextPutAll:'; wrapped'
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1955
        ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1956
    ] ifFalse:[
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1957
        "
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1958
         sorry, a method which is nowhere anchored
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1959
        "
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1960
        aStream nextPutAll:'unbound'
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1961
    ].
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1962
    aStream nextPut:$)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1963
48061f8659aa more queries
claus
parents: 159
diff changeset
  1964
    "
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1965
     (Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1966
     (Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1967
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1968
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1969
    "Modified: 1.11.1996 / 16:25:34 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1970
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1971
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1972
printStringForBrowserWithSelector:selector
1436
4eae8fd83654 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
  1973
    "return a printString to represent myself to the user in a browser.
4eae8fd83654 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
  1974
     Defined here to allow for browsers to deal with nonStandard pseudoMethods"
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1975
1805
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1976
    |s privInfo moreInfo p i|
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1977
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1978
    moreInfo := ''.
1800
1aa32eede53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1979
    privInfo := ''.
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1980
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1981
    self isWrapped ifTrue:[
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1982
        (MessageTracer isCounting:self) ifTrue:[
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1983
            (MessageTracer isCountingMemoryUsage:self) ifTrue:[
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1984
                moreInfo := moreInfo , 
1805
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1985
                     ' (mem usage ' , (MessageTracer memoryUsageOfMethod:self) printString , ' Bytes)'.
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1986
            ] ifFalse:[
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1987
                moreInfo := moreInfo , 
1805
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1988
                     ' (called ' , (MessageTracer executionCountOfMethod:self) printString , ' times)'.
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1989
            ]
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1990
        ] ifFalse:[
1477
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1991
            (MessageTracer isTiming:self) ifTrue:[
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1992
                i := MessageTracer executionTimesOfMethod:self.
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1993
                i notNil ifTrue:[
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1994
                    moreInfo := moreInfo , 
1805
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1995
                                ' (avg: ' , (i at:#avgTime) printString,
1477
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1996
                                ' min: ' , (i at:#minTime) printString , 
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1997
                                ' max: ' , (i at:#maxTime) printString ,
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1998
                                ' cnt: ' , (i at:#count) printString , ')'
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  1999
                ].
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  2000
            ] ifFalse:[
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  2001
                moreInfo := ' !!'
cbf97261a39c method timing info
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
  2002
            ]
1805
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2003
        ].
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2004
        p := self originalMethod privacy
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2005
    ] ifFalse:[
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2006
        p := self privacy
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2007
    ].
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2008
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2009
    p ~~ #public ifTrue:[
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2010
        privInfo := (' (* ' , p , ' *)') asText emphasizeAllWith:#italic.
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2011
    ].
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2012
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2013
    self isInvalid ifTrue:[
1813
c22f39201fe7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  2014
        moreInfo := ' (** not executable **)'.
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2015
    ].
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2016
1806
071c1c9e6bbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
  2017
    (self isLazyMethod not and:[self isUnloaded]) ifTrue:[
1805
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2018
        moreInfo := ' (** unloaded **)'
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2019
    ].
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2020
1800
1aa32eede53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  2021
    privInfo size ~~ 0 ifTrue:[
1aa32eede53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  2022
        moreInfo := privInfo , ' ' , moreInfo
1aa32eede53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  2023
    ].
1aa32eede53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  2024
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2025
    moreInfo size == 0 ifTrue:[^ selector].
1805
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  2026
1436
4eae8fd83654 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
  2027
    s := selector , moreInfo.
1813
c22f39201fe7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  2028
    self isInvalid ifTrue:[
c22f39201fe7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  2029
        s := s asText emphasizeAllWith:#color->Color red.
c22f39201fe7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  2030
    ].
1436
4eae8fd83654 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
  2031
    ^ s
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2032
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2033
    "Created: 16.4.1996 / 20:11:12 / cg"
1813
c22f39201fe7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  2034
    "Modified: 23.10.1996 / 21:01:57 / cg"
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2035
!
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2036
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2037
whoString
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2038
    "return a string as className>>selector, if this is not an unbound
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2039
     method. Otherwise return 'unbound'. Used with debugging."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2040
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2041
    |who|
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2042
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2043
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2044
    who notNil ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2045
        ^ (who methodClass) name , '>>' , (who methodSelector)
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2046
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2047
    ^ 'unbound'
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2048
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2049
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2050
     Method new whoString
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2051
     (Method compiledMethodAt:#whoString) whoString
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2052
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2053
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2054
    "Modified: 1.11.1996 / 16:27:04 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2055
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2056
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2057
!Method methodsFor:'private-compiler interface'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2058
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2059
numberOfMethodArgs:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2060
    "set the number of arguments, the method expects.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2061
     WARNING: for internal use by the compiler only.     
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2062
              playing around here with incorrect values 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2063
              may (will ?)  crash smalltalk badly.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2064
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2065
     The limitation in the max. number of arguments is due to the
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2066
     missing SENDxx functions in the VM and cases in #perform. This too 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2067
     will be removed in a later release, allowing any number of arguments.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2068
     - for use by compiler only."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2069
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2070
    (aNumber between:0 and:self class maxNumberOfArguments) ifFalse:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2071
        self error:('ST/X only supports up to a maximum of ' ,
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2072
                    self class maxNumberOfArguments printString ,
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2073
                    ' method arguments').
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2074
        ^ self
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2075
    ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2076
%{
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2077
    /* made this a primitive to get define in stc.h */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2078
#ifdef F_NARGS
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2079
    __INST(flags) = __MKSMALLINT( (__intVal(__INST(flags)) & ~F_NARGS) | (__intVal(aNumber) << F_NARGSHIFT) );
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2080
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2081
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2082
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2083
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2084
numberOfMethodVars:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2085
    "set the number of method variables - for use by compiler only.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2086
     WARNING: for internal use by the compiler only.     
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2087
              playing around here with incorrect values 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2088
              may (will ?)  crash smalltalk badly."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2089
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2090
%{  /* NOCONTEXT */
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2091
    int f = __intVal(__INST(flags));
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2092
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2093
    /* made this a primitive to get define in stc.h */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2094
    if (__isSmallInteger(aNumber)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2095
        f = (f & ~F_NVARS) | (__intVal(aNumber) << F_NVARSHIFT);
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2096
        __INST(flags) = __MKSMALLINT(f);
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2097
    }
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2098
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2099
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2100
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2101
setResourceFlag
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2102
    "mark the method as having a <resource> definition in its
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2103
     source. 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2104
     These resource definitions were found in ST-80 methods, and are
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2105
     currently not supported by ST/X (except for remembering this flag).
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2106
     It can be used to find resource-flagged methods quicker."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2107
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2108
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2109
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2110
#ifdef F_RESOURCE
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2111
    int f = __intVal(__INST(flags));
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2112
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2113
    f |= F_RESOURCE;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2114
    __INST(flags) = __MKSMALLINT(f);
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2115
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2116
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2117
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2118
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2119
!Method methodsFor:'queries'!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2120
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2121
containingClass
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2122
    "return the class I am defined in. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2123
     See comment in who."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2124
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2125
    "based on who, which has been added for ST-80 compatibility"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2126
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2127
    |who|
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2128
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2129
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2130
    who notNil ifTrue:[^ who methodClass].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2131
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2132
     none found - sorry
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2133
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2134
    ^ nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2135
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2136
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2137
     |m|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2138
     m := Object compiledMethodAt:#at:.
1855
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2139
     m containingClass   
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2140
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2141
     |m|
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2142
     m := Object class compiledMethodAt:#version.
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2143
     m containingClass   
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2144
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2145
1855
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2146
    "Modified: 1.11.1996 / 17:47:06 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2147
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2148
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2149
hasPrimitiveCode
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2150
    "return true, if the method contains primitive code; false if not.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2151
     Uses Parser to parse methods source and get the information."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2152
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2153
    |src|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2154
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2155
    "/ first a trivial reject, if the source does not
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2156
    "/ contain a '%{'
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2157
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2158
    src := self source.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2159
    src notNil ifTrue:[
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2160
        (src includesString:'%{' ) ifFalse:[
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2161
            "/ cannot contain primitive code.
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2162
            ^ false
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2163
        ]
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2164
    ].
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2165
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2166
    "/ ok; it may or may not ...
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2167
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2168
    ^ self parse:#'parseMethodSilent:' return:#hasPrimitiveCode or:false
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2169
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2170
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2171
     (Method compiledMethodAt:#hasPrimitiveCode) hasPrimitiveCode 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2172
     (Object compiledMethodAt:#at:) hasPrimitiveCode   
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2173
     (Object compiledMethodAt:#basicAt:) hasPrimitiveCode 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2174
    "
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2175
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2176
    "Modified: 22.1.1997 / 00:03:45 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2177
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2178
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2179
hasResource
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2180
    "return true if the method had a <resource> definition in its
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2181
     source. This was found in ST-80 methods, and currently not supported
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2182
     by ST/X (except for remembering this flag).
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2183
     It can be used to find resource-flagged methods quicker."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2184
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2185
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2186
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2187
#ifdef F_RESOURCE
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2188
    RETURN (((INT)__INST(flags) & __MASKSMALLINT(F_RESOURCE)) ? true : false);
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2189
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2190
%}.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2191
    ^ false
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2192
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2193
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2194
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2195
2694
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2196
homeMethod
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2197
    "for common protocol with blocks: if the receiver is a method,
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2198
     return the receiver; otherwise, if its a block, return its home
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2199
     method."
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2200
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2201
    ^ self
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2202
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2203
    "Created: 19.6.1997 / 16:13:12 / cg"
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2204
!
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2205
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2206
isInvalid
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2207
    "return true, if this method is not executable due to
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2208
     a (re)-compilation error. Since invalidation is by patching the
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2209
     methods code-pointer to a trap function, check for that here.
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2210
     (see comment in Method>>invalidCodeObject)."
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2211
2558
07e7d6fef46d removed unused var
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  2212
    |m myCode|
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2213
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2214
    myCode := self code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2215
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2216
    m := self trapMethodForNumArgs:(self numArgs).
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2217
    (m notNil and:[self ~~ m]) ifTrue:[
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2218
        (myCode notNil and:[myCode = m code]) ifTrue:[^ true].
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2219
        (byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2220
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2221
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2222
    m := Method compiledMethodAt:#uncompiledCodeObject.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2223
    (m notNil and:[self ~~ m]) ifTrue:[
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2224
        (myCode notNil and:[myCode = m code]) ifTrue:[^ true].
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2225
        (byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2226
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2227
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2228
    m := Method compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2229
    (m notNil and:[self ~~ m]) ifTrue:[
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2230
        (myCode notNil and:[myCode = m code]) ifTrue:[^ true].
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2231
        (byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2232
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2233
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2234
    ^ false
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2235
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2236
    "Modified: 4.11.1996 / 23:34:24 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2237
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2238
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2239
isMethod
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2240
    "return true, if the receiver is some kind of method;
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2241
     true returned here - the method is redefined from Object."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2242
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2243
    ^ true
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2244
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2245
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2246
methodArgAndVarNames
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2247
    "return a collection with the methods argument and variable names.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2248
     Uses Parser to parse methods source and extract the names.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2249
     Returns nil if the source is not available, or some other
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2250
     syntax/parse error occurred. For methods with no args and no vars,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2251
     an empty collection is returned."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2252
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2253
    |parser sourceString argNames varNames|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2254
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2255
    sourceString := self source.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2256
    sourceString notNil ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2257
	parser := Parser parseMethodArgAndVarSpecificationSilent:sourceString.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2258
	(parser isNil or:[parser == #Error]) ifTrue:[^ nil].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2259
	argNames := parser methodArgs.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2260
	varNames := parser methodVars.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2261
	argNames isNil ifTrue:[^ varNames].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2262
	varNames isNil ifTrue:[^ argNames].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2263
	^ (argNames , varNames)
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2264
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2265
    ^ nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2266
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2267
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2268
     (Method compiledMethodAt:#printOn:) methodArgAndVarNames
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2269
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2270
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2271
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2272
methodArgNames
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2273
    "return a collection with the methods argument names.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2274
     Uses Parser to parse methods source and extract the names."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2275
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2276
    ^ self parse:#'parseMethodSpecificationSilent:' return:#methodArgs or:nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2277
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2278
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2279
     (Method compiledMethodAt:#printOn:) methodArgNames
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2280
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2281
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2282
    "Modified: 31.10.1995 / 14:36:46 / cg"
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2283
!
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2284
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2285
methodComment
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2286
    "return the methods first comment, nil if there is none.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2287
     This is a somewhat stupid implementation."
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2288
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2289
    |text line nQuote index qIndex qIndex2 comment|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2290
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2291
    text := self source asCollectionOfLines.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2292
    (text size < 2) ifTrue:[^nil].
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2293
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2294
    line := (text at:2).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2295
    nQuote := line occurrencesOf:(Character doubleQuote).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2296
    (nQuote == 2) ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2297
	qIndex := line indexOf:(Character doubleQuote).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2298
	qIndex2 := line indexOf:(Character doubleQuote) startingAt:(qIndex + 1).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2299
	^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1)
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2300
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2301
    (nQuote == 1) ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2302
	qIndex := line indexOf:(Character doubleQuote).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2303
	comment := line copyFrom:(qIndex + 1).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2304
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2305
	index := 3.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2306
	line := text at:index.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2307
	nQuote := line occurrencesOf:(Character doubleQuote).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2308
	[nQuote ~~ 1] whileTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2309
	    comment := comment , Character cr asString , line withoutSpaces.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2310
	    index := index + 1.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2311
	    line := text at:index.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2312
	    nQuote := line occurrencesOf:(Character doubleQuote)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2313
	].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2314
	qIndex := line indexOf:(Character doubleQuote).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2315
	^ comment , Character cr asString , (line copyTo:(qIndex - 1)) withoutSpaces
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2316
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2317
    ^ nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2318
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2319
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2320
     (Method compiledMethodAt:#methodComment) methodComment
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2321
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2322
!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2323
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2324
methodVarNames
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2325
    "return a collection with the methods local-variable names.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2326
     Uses Parser to parse methods source and extract the names."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2327
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2328
    ^ self parse:#'parseMethodArgAndVarSpecificationSilent:' return:#methodVars or:nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2329
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2330
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2331
     (Method compiledMethodAt:#printOn:) methodVarNames
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2332
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2333
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2334
    "Modified: 31.10.1995 / 14:36:49 / cg"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2335
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2336
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2337
modificationTime
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2338
    "try to extract the modificationTime as a timeStamp from
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2339
     the receivers source. If there is no source or no history line, 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2340
     we do not know the modification time, and nil is returned."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2341
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2342
    |s list histLine|
877
63ebb325ed20 flush global-access cache (using snapshotID) when saving a methods binary code
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
  2343
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2344
    HistoryManager isNil ifTrue:[^ nil].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2345
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2346
    s := self source.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2347
    s isNil ifTrue:[^ nil].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2348
    list := HistoryManager getAllHistoriesFrom:s.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2349
    list size == 0 ifTrue:[^ nil].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2350
    histLine := list last.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2351
    ^ AbsoluteTime 
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2352
        fromDate:histLine date 
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2353
        andTime:histLine time
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2354
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2355
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2356
     (Method compiledMethodAt:#modificationTime) modificationTime
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2357
     (Method compiledMethodAt:#isMethod) modificationTime 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2358
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2359
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2360
    "Modified: 8.9.1995 / 15:08:22 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2361
    "Modified: 4.11.1996 / 22:28:17 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2362
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2363
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2364
parse:parseSelector return:accessSelector or:valueIfNoSource 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2365
    "helper for methodArgNames, methodVarNames etc.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2366
     Get the source, let parser parse it using parseSelector,
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2367
     return parser-info using accessSelector"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2368
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2369
    |parser sourceString|
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2370
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2371
    sourceString := self source.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2372
    sourceString notNil ifTrue:[
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2373
        parser := Parser perform:parseSelector with:sourceString.
1995
8b9aeb092b59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2374
        (parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2375
        ^ parser perform:accessSelector
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2376
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2377
    ^ valueIfNoSource
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2378
1995
8b9aeb092b59 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1992
diff changeset
  2379
    "Modified: 12.12.1996 / 15:38:59 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2380
!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2381
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2382
previousVersion
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2383
    |history|
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2384
1925
f1c8c6374af8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1923
diff changeset
  2385
    history := Class methodHistory.
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2386
    history isNil ifTrue:[^ nil].
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2387
    ^ history at:self ifAbsent:nil
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2388
1925
f1c8c6374af8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1923
diff changeset
  2389
    "Modified: 7.11.1996 / 19:06:22 / cg"
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2390
!
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2391
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2392
selector
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2393
    "return the selector under which I am found in my containingClasses
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2394
     method-table. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2395
     See comment in who."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2396
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2397
    "based on who, which has been added for ST-80 compatibility"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2398
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2399
    |who|
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2400
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2401
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2402
    who notNil ifTrue:[^ who methodSelector].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2403
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2404
     none found - sorry
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2405
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2406
    ^ nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2407
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2408
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2409
     |m|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2410
     m := Object compiledMethodAt:#at:.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2411
     m selector
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2412
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2413
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2414
    "Modified: 1.11.1996 / 16:25:48 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2415
!
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2416
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2417
who
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2418
    "return the class and selector of where I am defined in;
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2419
     nil is returned for unbound methods.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2420
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2421
     ST/X special notice: 
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2422
        returns an instance of MethodWhoInfo, which
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2423
        responds to #methodClass and #methodSelector query messages.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2424
        For backward- (& ST-80) compatibility, the returned object also
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2425
        responds to #at:1 and #at:2 messages.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2426
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2427
     Implementation notice:
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2428
        Since there is no information of the containing class 
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2429
        in the method, we have to do a search here.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2430
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2431
        Normally, this is not a problem, except when a method is
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2432
        accepted in the debugger or redefined from within a method
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2433
        (maybe done indirectly, if #doIt is done recursively)
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2434
        - the information about which class the original method was 
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2435
        defined in is lost in this case.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2436
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2437
     Problem: 
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2438
        this is heavily called for in the debugger to create
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2439
        a readable context walkback. For unbound methods, it is
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2440
        slow, since the search (over all classes) will always fail.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2441
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2442
     Q: should we add a backref from the method to the class 
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2443
        and/or add a subclass of Method for unbound ones ?
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2444
     Q2: if so, what about the bad guy then, who copies methods around to
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2445
         other classes ?"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2446
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2447
    |classes cls sel|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2448
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2449
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2450
     very first, look in the class we found something the last time
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2451
     this may often give a hit, when asking who repeatingly for
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2452
     a context chain. (keep last by its name, to not keep classes from
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2453
     being garbage collected)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2454
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2455
    LastWhoClass notNil ifTrue:[
1855
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2456
        cls := Smalltalk at:LastWhoClass ifAbsent:nil.
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2457
        cls notNil ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2458
            sel := cls selectorAtMethod:self.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2459
            sel notNil ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2460
                ^ MethodWhoInfo class:cls selector:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2461
"/                ^ Array with:cls with:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2462
            ].
1855
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2463
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2464
            cls := cls class.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2465
            sel := cls selectorAtMethod:self.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2466
            sel notNil ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2467
                ^ MethodWhoInfo class:cls selector:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2468
"/                ^ Array with:cls with:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2469
            ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2470
        ]
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2471
    ].
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  2472
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2473
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2474
     first, limit the search to global classes only - 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2475
     since probability is high, that the receiver is found in there ...
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2476
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2477
    classes := Smalltalk allClasses.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2478
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2479
     instance methods are usually more common - search those first
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2480
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2481
    classes do:[:aClass |
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2482
        |sel|
350
claus
parents: 345
diff changeset
  2483
2518
303563f538e3 avoid an extra message send in #who
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  2484
        sel := aClass selectorAtMethod:self ifAbsent:nil.
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2485
        sel notNil ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2486
            aClass isMeta ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2487
                cls := aClass soleInstance.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2488
                cls notNil ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2489
                    LastWhoClass := cls name
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2490
                ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2491
            ] ifFalse:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2492
                LastWhoClass := aClass name.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2493
            ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2494
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2495
            ^ MethodWhoInfo class:aClass selector:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2496
"/            ^ Array with:aClass with:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2497
        ].
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2498
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2499
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2500
    LastWhoClass := nil.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2501
    classes do:[:aClass |
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2502
        |sel|
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2503
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2504
        sel := aClass class selectorAtMethod:self.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2505
        sel notNil ifTrue:[ 
1855
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2506
            aClass isMeta ifTrue:[
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2507
                cls := aClass soleInstance.
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2508
                cls notNil ifTrue:[
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2509
                    LastWhoClass := cls name
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2510
                ].
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2511
            ] ifFalse:[
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2512
                LastWhoClass := aClass name.
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2513
            ].
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2514
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  2515
            ^ MethodWhoInfo class:aClass class selector:sel
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2516
"/            ^ Array with:aClass class with:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2517
        ].
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2518
    ].
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2519
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2520
     mhmh - must be a method of some anonymous class (i.e. one not
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2521
     in the Smalltalk dictionary). Search all instances of Behavior
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2522
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2523
    Behavior allSubInstancesDo:[:someClass |
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2524
        |sel|
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2525
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2526
        sel := someClass selectorAtMethod:self.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2527
        sel notNil ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2528
            ^ MethodWhoInfo class:someClass selector:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2529
"/            ^ Array with:someClass with:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2530
        ]
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2531
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2532
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2533
     none found - sorry
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2534
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2535
    ^ nil
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2536
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2537
    "typical situation: some well-known class"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2538
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2539
     |m|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2540
     m := Object compiledMethodAt:#copy.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2541
     m who
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2542
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2543
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2544
    "untypical situation: an anonymous class"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2545
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2546
     |m cls|
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2547
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2548
     Object 
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2549
        subclass:#FunnyClass 
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2550
        instanceVariableNames:'foo'
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2551
        classVariableNames:''
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2552
        poolDictionaries:''
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2553
        category:'testing'.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2554
     cls := Smalltalk at:#FunnyClass.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2555
     Smalltalk removeClass:cls.
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2556
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2557
     cls compile:'testMethod1:arg foo:=arg'.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2558
     cls compile:'testMethod2 ^ foo'.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2559
     m := cls compiledMethodAt:#testMethod1:.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2560
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2561
     m who
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2562
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2563
2518
303563f538e3 avoid an extra message send in #who
Claus Gittinger <cg@exept.de>
parents: 2262
diff changeset
  2564
    "Modified: 2.4.1997 / 16:38:34 / cg"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2565
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2566
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2567
wrapper
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2568
    "only for wrapped methods: return the wrapper.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2569
     Thats the WrapperMethod which contains myself."
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2570
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2571
    WrappedMethod allInstancesDo:[:m |
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2572
	m originalMethod == self ifTrue:[^ m].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2573
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2574
    ^ nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2575
! !
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  2576
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2577
!Method methodsFor:'trap methods'!
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  2578
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2579
makeInvalid
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2580
    "make the receiver an invalid method, which raises an invalidCodeObject
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2581
     signal when executed. This is not for public use - it is required for
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2582
     the objectFileLoader to invalidate methods whose code is unloaded."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2583
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2584
    |invldMethod|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2585
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2586
    invldMethod := self trapMethodForNumArgs:(self numArgs).
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2587
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2588
    self byteCode:nil.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2589
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2590
    "Created: 17.9.1995 / 15:00:52 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2591
    "Modified: 4.11.1996 / 23:04:34 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2592
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2593
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2594
makeUncompiled
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2595
    "make the receiver an uncompiled method, which raises an invalidCodeObject
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2596
     signal when executed. This is not for public use - it is required for
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2597
     the compiler to invalidate methods which cannot be compiled due to errors
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2598
     after a class definition change (for example: instvars are no longer there)."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2599
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2600
    |invldMethod|
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2601
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2602
    invldMethod := self class compiledMethodAt:#uncompiledCodeObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2603
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2604
    self byteCode:nil.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2605
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2606
    "Created: 17.9.1995 / 15:01:14 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2607
    "Modified: 4.11.1996 / 23:04:46 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2608
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2609
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2610
makeUnloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2611
    "make the receiver an unloaded method, which raises an invalidCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2612
     signal when executed. This is not for public use - it is required for
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2613
     the objectFileLoader to invalidate methods for which a shared library has
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2614
     been removed."
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2615
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2616
    |invldMethod|
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2617
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2618
    invldMethod := self class compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2619
    self code:invldMethod code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2620
    self byteCode:nil.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2621
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2622
    "Created: 4.11.1996 / 22:59:21 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2623
    "Modified: 4.11.1996 / 23:04:52 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2624
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2625
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2626
trapMethodForNumArgs:numArgs
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2627
    |trapSel|
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2628
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2629
    trapSel := #(
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2630
                  #'invalidCodeObject'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2631
                  #'invalidCodeObjectWith:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2632
                  #'invalidCodeObjectWith:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2633
                  #'invalidCodeObjectWith:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2634
                  #'invalidCodeObjectWith:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2635
                  #'invalidCodeObjectWith:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2636
                  #'invalidCodeObjectWith:with:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2637
                  #'invalidCodeObjectWith:with:with:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2638
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2639
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2640
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2641
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2642
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2643
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2644
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:'
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2645
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:with:'
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2646
                ) at:(numArgs + 1).
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2647
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2648
    ^ Method compiledMethodAt:trapSel.
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2649
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2650
    "Created: 4.11.1996 / 21:58:58 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2651
    "Modified: 4.11.1996 / 23:18:05 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2652
! !
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2653
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2654
!Method::MethodWhoInfo class methodsFor:'documentation'!
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2655
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2656
documentation
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2657
"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2658
    In earlier times, Method>>who returned an array filled
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2659
    with the methods class and selector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2660
    This was done, since a smalltalk method cannot return multiple
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2661
    values, but 2 values had to be returned from that method.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2662
    Thus, the who-interface was used as:
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2663
        info := <someMethod> who.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2664
        class := info at:1.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2665
        sel := info at:2.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2666
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2667
    Sure, this is ugly coding style, and the system has been changed to return
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2668
    an object (an instance of MethodWhoInfo) which responds to the two
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2669
    messages: #methodClass and #methodSelector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2670
    This allows to write things much more intuitive:
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2671
        info := <someMethod> who.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2672
        class := info methodClass.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2673
        sel := info methodSelector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2674
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2675
    However, to be backward compatible, the returned object still responds to
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2676
    the #at: message, but only allows inices of 1 and 2 to be used.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2677
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2678
    The MethodWhoInfo class is private to Method - its not visible to other
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2679
    classes.
2242
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2680
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2681
    [author:]
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2682
        Claus Gittinger
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2683
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2684
    [see also:]
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2685
        Method
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2686
"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2687
! !
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2688
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2689
!Method::MethodWhoInfo class methodsFor:'instance creation'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2690
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2691
class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2692
    "return a new MethodWhoInfo object;
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2693
     this is a private interface for Method"
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2694
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2695
    ^ self basicNew class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2696
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2697
    "Modified: 2.1.1997 / 15:27:59 / cg"
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2698
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2699
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2700
!Method::MethodWhoInfo methodsFor:'accessing'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2701
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2702
methodClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2703
    "return the class which contains the method represented by myself"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2704
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2705
    ^ myClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2706
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2707
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2708
     (Method compiledMethodAt:#who) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2709
     (Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2710
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2711
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2712
    "Modified: 2.1.1997 / 14:59:02 / cg"
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2713
!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2714
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2715
methodSelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2716
    "return the selector under which the the method represented by myself
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2717
     is found in the class"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2718
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2719
    ^ mySelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2720
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2721
    "Modified: 2.1.1997 / 14:59:24 / cg"
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2722
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2723
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2724
!Method::MethodWhoInfo methodsFor:'compatibility'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2725
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2726
at:index
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2727
    "simulate the old behavior (when Method>>who returned an array)"
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2728
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2729
    index == 1 ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2730
        ^ myClass
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2731
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2732
    index == 2 ifTrue:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2733
        ^ mySelector
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2734
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2735
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2736
    "/ sigh - full compatibility ?
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2737
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2738
    index isInteger ifFalse:[
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2739
        ^ self indexNotInteger
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2740
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2741
    ^ self subscriptBoundsError:index
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2742
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2743
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2744
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2745
!Method::MethodWhoInfo methodsFor:'private accessing'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2746
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2747
class:cls selector:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2748
    myClass := cls.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2749
    mySelector := sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2750
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2751
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2752
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2753
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
  2754
!Method class methodsFor:'documentation'!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2755
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2756
version
2694
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  2757
    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.130 1997-06-19 14:16:47 cg Exp $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2758
! !
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2759
Method initialize!