Method.st
author Claus Gittinger <cg@exept.de>
Mon, 18 Mar 1996 15:42:32 +0100
changeset 1103 614ebfdc0c9d
parent 1093 1e742016eea0
child 1133 961f2b095c22
permissions -rw-r--r--
added query if executable
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
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    16
		LastWhoClass'
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
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    21
!Method class methodsFor:'documentation'!
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    22
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    23
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    24
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    25
 COPYRIGHT (c) 1989 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
    26
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    27
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    28
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    29
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    31
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    32
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    33
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    34
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    35
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    37
documentation
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    38
"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    39
    this class defines protocol for executable methods;
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    40
    both compiled and interpreted methods are represented by this class.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    41
    Compiled methods have a non-nil code field, while interpreted methods have
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    42
    a nil code field and non-nil byteCode field.
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    43
    If there are both non-nil code and bytecode fields, the VM will execute
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    44
    the machine-code of a method. If both are nil when executed, a noByteCode
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    45
    message is sent by the VM to the method where a signal is raised.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    46
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    47
    The methods sourcecode is represented by source and sourcePosition:
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    48
    - if sourcePosition is a Number, the source-field is the fileName and
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    49
      sourcePosition is the character offset of the source-chunk in this source file.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    50
    - If sourcePosition is nil, the source is the string in the source field.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    51
    (an old version used ExternalString instances here, but that lead to
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    52
     10000 additional little objects ...)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    53
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    54
    The flags field defines things like the number of method-locals,
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    55
    method arguments and stack requirements (for interpreted methods).
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    56
    Do not depend on any value in the flags field - it may change without
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    57
    notice.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    58
438
claus
parents: 423
diff changeset
    59
    Notice, that in ST/X, method can be subclassed; executable code is
claus
parents: 423
diff changeset
    60
    identified not by being a subclass of Block or Method, but instead by
claus
parents: 423
diff changeset
    61
    having the executable flag bit set in the class. The VM can execute anything
claus
parents: 423
diff changeset
    62
    which is identified as executable (assuming that the first instance variable
claus
parents: 423
diff changeset
    63
    is the machine-code address) - this allows for easy future extension.
claus
parents: 423
diff changeset
    64
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    65
    Instance variables:
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    66
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
    67
	source          <String>        the source itself (if sourcePosition isNil)
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
    68
					or the fileName where the source is found
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    69
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
    70
	sourcePosition  <Integer>       the position of the methods chunk in the file
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    71
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
    72
	category        <Symbol>        the methods category
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
    73
	package         <Symbol>        the package, in which the methods was defined
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    74
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    75
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    76
    Class variables:
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    77
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    78
	PrivateMethodSignal             raised on privacy violation (see docu)
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    79
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    80
	LastFileReference               weak reference to the last sourceFile
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    81
	LastSourceFileName              to speedup source access via NFS
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    82
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    83
    WARNING: layout known by compiler and runtime system - dont change
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    84
"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
    85
!
48061f8659aa more queries
claus
parents: 159
diff changeset
    86
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
    87
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
    88
"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    89
    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
    90
    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
    91
    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
    92
    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
    93
    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
    94
    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
    95
    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
    96
    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
    97
"
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
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   100
privacy 
48061f8659aa more queries
claus
parents: 159
diff changeset
   101
"
48061f8659aa more queries
claus
parents: 159
diff changeset
   102
    ST/X includes an EXPERIMENTAL implementation of method privacy.
48061f8659aa more queries
claus
parents: 159
diff changeset
   103
    Individual methods may be set to private or protected via the
48061f8659aa more queries
claus
parents: 159
diff changeset
   104
    #setPrivate and #setProtected messages. Also, categories may be
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   105
    filedIn as a whole as private using #privateMethodsFor: or as
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   106
    protected using #protectedMethodsFor: instead of the well known #methodsFor:.
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   107
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   108
    The additional #publicMethodsFor: is for documentation purposes, and
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   109
    is equivalent to #methodsFor: (also to support fileIn of ENVY methods).
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   110
48061f8659aa more queries
claus
parents: 159
diff changeset
   111
    Private methods may be executed only when called via a self or super-send
48061f8659aa more queries
claus
parents: 159
diff changeset
   112
    from the superclass, the class itself or subclasses.
415
claus
parents: 414
diff changeset
   113
    Protected methods may not be called from subclasses, i.e. they may only
claus
parents: 414
diff changeset
   114
    be called via self sends from within the current class.
claus
parents: 414
diff changeset
   115
    (i.e. private methods are less private than protected ones)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   116
48061f8659aa more queries
claus
parents: 159
diff changeset
   117
    When such a situation arises, the VM (runtime system) will raise the
48061f8659aa more queries
claus
parents: 159
diff changeset
   118
    PrivateMethodSignal exception (if nonNil), which usually brings you into the
48061f8659aa more queries
claus
parents: 159
diff changeset
   119
    debugger.
48061f8659aa more queries
claus
parents: 159
diff changeset
   120
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   121
    If PrivateMethodSignal is nil, the VM will not check for this, and
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   122
    execution is as usual. (you may want to nil-it for production code,
48061f8659aa more queries
claus
parents: 159
diff changeset
   123
    and leave it non nil during development).
48061f8659aa more queries
claus
parents: 159
diff changeset
   124
48061f8659aa more queries
claus
parents: 159
diff changeset
   125
    NOTICE: there is no (not yet ?) standard defined for method privacy,
48061f8659aa more queries
claus
parents: 159
diff changeset
   126
    however, the interface was designed to be somewhat ENVY compatible (from
48061f8659aa more queries
claus
parents: 159
diff changeset
   127
    what can be deduced by reading PD code).
48061f8659aa more queries
claus
parents: 159
diff changeset
   128
    Also, the usability of privacy is still to be tested.
415
claus
parents: 414
diff changeset
   129
    This interface, the implementation and the rules for when a privacy violation
claus
parents: 414
diff changeset
   130
    may change (in case of some ANSI standard being defined).
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   131
    Be warned and send me suggestions & critics (constructive ;-)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   132
"
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
   133
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   134
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   135
!Method class methodsFor:'initialization'!
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   136
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   137
initialize
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   138
    PrivateMethodSignal isNil ifTrue:[
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   139
	"EXPERIMENTAL"
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   140
	PrivateMethodSignal := ExecutionErrorSignal newSignalMayProceed:true.
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   141
	PrivateMethodSignal nameClass:self message:#privateMethodSignal.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   142
	PrivateMethodSignal notifierString:'attempt to execute private/protected method'.
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   143
    ]
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   144
! !
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   145
345
claus
parents: 343
diff changeset
   146
!Method class methodsFor:'Signal constants'!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   147
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   148
privateMethodSignal
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   149
    "return the signal raised when a private/protected method is called
48061f8659aa more queries
claus
parents: 159
diff changeset
   150
     by some other object (i.e. not a self- or super send)"
48061f8659aa more queries
claus
parents: 159
diff changeset
   151
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   152
    ^ PrivateMethodSignal
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   153
! !
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   154
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
   155
!Method class 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
   156
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   157
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
   158
    "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
   159
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   160
    |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
   161
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   162
    "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
   163
    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
   164
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   165
	 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
   166
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   167
	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
   168
	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
   169
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   170
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   171
	 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
   172
	 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
   173
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   174
	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
   175
	    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
   176
	].
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
	^ 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
   178
    ].
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
    "
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
     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
   181
    "
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
    ^ 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
   183
!
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
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
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
   186
    "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
   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
    |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
   189
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
    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
   191
    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
   192
    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
   193
    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
   194
    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
   195
    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
   196
    sourcePos isNil 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
   197
	source := 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
   198
    ].
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
    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
   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
    snapId == ObjectMemory snapshotID 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
   202
	ObjectMemory incrementSnapshotID
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
    ].
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
    m := Method basicNew.
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
    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
   207
    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
   208
    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
   209
    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
   210
    sourcePos isNil 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
   211
	m source: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
   212
    ] 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
   213
	m sourceFilename:sourceFilename position:sourcePos
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
    ].
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
    ^ 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
   216
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
    "Created: 16.1.1996 / 14:44:08 / 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
   218
! !
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
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   220
!Method class methodsFor:'queries'!
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   221
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   222
isBuiltInClass
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   223
    "this class is known by the run-time-system"
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   224
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   225
    ^ self == Method
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   226
!
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   227
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   228
maxNumberOfArguments
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   229
    "this limit will be removed in one of the next versions ..."
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   230
423
claus
parents: 421
diff changeset
   231
    ^ 15  "cannot be easily changed; should ask the VM about this number"
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   232
!
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   233
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   234
methodPrivacySupported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   235
    "return true, if the system was compiled to support methodPrivacy.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   236
     You should not depend on that feature being available."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   237
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   238
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   239
#if defined(F_PRIVATE) || defined(F_CLASSPRIVATE)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   240
    RETURN (true);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   241
#else
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   242
    RETURN (false);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   243
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   244
%}
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   245
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   246
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   247
!Method class methodsFor:'special'!
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   248
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   249
flushSourceStreamCache
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   250
    LastSourceFileName := nil
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   251
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   252
    "Created: 9.2.1996 / 19:05:28 / cg"
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   253
! !
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   254
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   255
!Method methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   256
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
   257
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
   258
    "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
   259
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
   260
    ^ category
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   261
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   262
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
   263
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
   264
    "set the methods category"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   265
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
   266
    category := aStringOrSymbol asSymbol
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   267
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   268
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   269
clearCalledFlag
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   270
    "mark the method as never called.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   271
     The called flag will be set by the interpreter whenever a method
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   272
     is called for the very first time, to support coverage tests.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   273
     This is EXPERIMENTAL, nonStandard and not yet fully implemented."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   274
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   275
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   276
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   277
#ifdef F_CALLED
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   278
    int f = _intVal(_INST(flags));
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   279
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   280
    f &= ~F_CALLED;
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   281
    _INST(flags) = _MKSMALLINT(f);
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   282
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   283
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   284
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   285
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   286
comment
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   287
    "return the methods comment.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   288
     This is done by searching for and returning the first comment
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   289
     from the methods source (excluding any double-quotes). 
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   290
     Returns nil if there is no comment (or source is not available)."
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   291
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   292
    |src stream|
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   293
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   294
    src := self source.
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   295
    src isNil ifTrue:[^ nil].
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   296
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   297
    stream := ReadStream on:src.
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   298
    (stream skipThrough:Character doubleQuote) isNil ifTrue:[^ nil].
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   299
    ^ stream upTo:Character doubleQuote.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   300
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   301
    "
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   302
     (Method compiledMethodAt:#comment) comment 
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   303
    "
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   304
!
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   305
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   306
flags
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   307
    "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
   308
     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
   309
     may change without notice."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   310
a27a279701f8 Initial revision
claus
parents:
diff changeset
   311
    ^ flags
a27a279701f8 Initial revision
claus
parents:
diff changeset
   312
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   313
    "Modified: 8.3.1996 / 13:20:48 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   314
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   315
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
   316
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
   317
    ^ source
414
claus
parents: 400
diff changeset
   318
!
claus
parents: 400
diff changeset
   319
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   320
numberOfMethodArgs
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   321
    "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
   322
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   323
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   324
    /* 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
   325
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   326
#ifdef F_NARGS
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   327
    RETURN (_MKSMALLINT((_intVal(_INST(flags)) & F_NARGS) >> F_NARGSHIFT));
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   328
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   329
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   330
.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   331
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   332
     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
   333
     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
   334
     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
   335
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   336
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   337
    ^ self methodArgNames size
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   338
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   339
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   340
numberOfMethodVars
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   341
    "return the number of method local variables. 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   342
     Do not depend on the returned value - future optimizations
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   343
     may change things here (i.e. when moving block-locals into
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   344
     surrounding method for inlining).
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   345
     - for debugging only."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   346
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   347
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   348
    /* 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
   349
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   350
    RETURN (_MKSMALLINT((_intVal(_INST(flags)) & F_NVARS) >> F_NVARSHIFT));
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   351
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   352
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   353
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   354
package
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   355
    "return the package-symbol"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   356
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   357
    ^ package
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   358
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   359
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   360
package:aSymbol
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   361
    "set the package-symbol"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   362
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   363
    package := aSymbol
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
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   366
source
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   367
    "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
   368
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   369
    |aStream fileName junk w myClass mgr className|
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
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   372
     if sourcePosition is nonNil, its the fileName and
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   373
     sourcePosition is the offset.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   374
     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
   375
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   376
    sourcePosition isNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   377
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   378
    source notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   379
"/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   380
"/ original (old) code:
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   381
"/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   382
"/        aStream := Smalltalk systemFileStreamFor:('source/' , source).
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   383
"/        aStream notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   384
"/            aStream position:sourcePosition.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   385
"/            junk := aStream nextChunk.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   386
"/            aStream close
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   387
"/        ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   388
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   389
        "/ 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
   390
        "/ 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
   391
        "/ 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
   392
        "/ 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
   393
        "/ Neat trick.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   394
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   395
        LastSourceFileName = source ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   396
            aStream := LastFileReference at:1.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   397
        ].
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
        aStream isNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   400
            "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   401
            "/ 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
   402
            "/ first
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   403
            "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   404
            (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
   405
                fileName := Smalltalk getSourceFileName:source.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   406
                fileName notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   407
                    aStream := fileName asFilename readStream.
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
            ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   410
            aStream isNil ifTrue:[
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
                "/ 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
   413
                "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   414
                w := self who.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   415
                w notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   416
                    myClass := w at:1.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   417
                    aStream := myClass sourceStreamFor:source.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   418
                ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   419
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   420
                aStream isNil ifTrue:[
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
                    "/ nope - look in standard places 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   423
                    "/ (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
   424
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   425
                    mgr notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   426
                        fileName := Smalltalk getSourceFileName:source.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   427
                        fileName notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   428
                            aStream := fileName asFilename readStream.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   429
                        ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   430
                    ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   431
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   432
                    "/ final chance: try current directory
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
                    aStream isNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   435
                        aStream := source asFilename readStream.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   436
                    ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   437
                ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   438
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   439
                (aStream isNil and:[w isNil and:[source notNil]]) ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   440
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   441
                    "/ 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
   442
                    "/ 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
   443
                    "/ (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
   444
                    "/ 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
   445
                    "/ and retry.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   446
                    "/
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   447
                    className := Smalltalk classNameForFile:source.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   448
                    className knownAsSymbol ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   449
                        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
   450
                        myClass notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   451
                            aStream := myClass sourceStreamFor:source.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   452
                        ]
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
                ]                
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   455
            ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   456
        ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   457
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   458
        aStream notNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   459
            aStream position:sourcePosition.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   460
            junk := aStream nextChunk.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   461
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   462
            "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   463
             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
   464
            "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   465
            LastFileReference isNil ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   466
                LastFileReference := WeakArray new:1
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   467
            ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   468
            LastFileReference at:1 put:aStream.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   469
            LastSourceFileName := source
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   470
        ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   471
    ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   472
    ^ junk
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
    "Modified: 9.2.1996 / 19:09:18 / cg"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   475
!
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
source:aString
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   478
    "set the methods sourcestring"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   479
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   480
    source := aString.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   481
    sourcePosition := nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   482
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   483
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   484
sourceFilename
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   485
    "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
   486
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   487
    sourcePosition notNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   488
    ^ nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   489
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   490
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   491
sourceFilename:aFileName position:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   492
    "set the methods sourcefile/position"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   493
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   494
    source := aFileName.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   495
    sourcePosition := aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   496
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   497
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   498
sourcePosition
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   499
    "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
   500
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   501
    ^ sourcePosition
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   502
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   503
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   504
stackSize
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   505
    "return the number of temporaries needed as stack in the context. 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   506
     Do not depend on the returned value - future optimizations
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   507
     may change things here.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   508
     - for debugging only."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   509
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   510
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   511
    /* 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
   512
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   513
    RETURN (_MKSMALLINT((_intVal(_INST(flags)) & F_NSTACK) >> F_NSTACKSHIFT));
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   514
%}
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
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   517
!Method methodsFor:'accessing-visibility'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   518
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
   519
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
   520
    "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
   521
     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
   522
     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
   523
     it in its message lookup.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   524
     (i.e. setting a method to #ignored, and sending that selector,
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   525
      leads to either the superclasses implementation to be called, 
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   526
      or a doesNotUnderstand exception to be raised)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   527
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
   528
     Notice: this is a nonstandard feature, not supported
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   529
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   530
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   531
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   532
     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
   533
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   534
%{  /* 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
   535
#if defined(F_IGNORED) && defined(M_PRIVACY)
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   536
    int f = _intVal(_INST(flags));
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   537
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
   538
    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
   539
	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
   540
    }
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   541
#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
   542
%}.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   543
    ^ false
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   544
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   545
48061f8659aa more queries
claus
parents: 159
diff changeset
   546
isPrivate
48061f8659aa more queries
claus
parents: 159
diff changeset
   547
    "return true, if this is a private method.
48061f8659aa more queries
claus
parents: 159
diff changeset
   548
     Execution of private methods is only allowed via self/super sends
48061f8659aa more queries
claus
parents: 159
diff changeset
   549
     from superclasses, the class itself or subclasses.
48061f8659aa more queries
claus
parents: 159
diff changeset
   550
     If a private method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
   551
     error (PrivateMethodSignal) is raised.
48061f8659aa more queries
claus
parents: 159
diff changeset
   552
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
   553
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   554
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   555
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
   556
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
   557
48061f8659aa more queries
claus
parents: 159
diff changeset
   558
%{  /* NOCONTEXT */
48061f8659aa more queries
claus
parents: 159
diff changeset
   559
    /* I made this a primitive to get the define constant from stc.h */
48061f8659aa more queries
claus
parents: 159
diff changeset
   560
748
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   561
#if defined(F_PRIVATE) && defined(M_PRIVACY)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   562
    int f = _intVal(_INST(flags));
48061f8659aa more queries
claus
parents: 159
diff changeset
   563
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   564
    if ((f & M_PRIVACY) == F_PRIVATE) {
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   565
	RETURN (true);
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   566
    }
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   567
#endif
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   568
%}.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   569
    ^ false
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   570
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   571
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   572
isProtected
48061f8659aa more queries
claus
parents: 159
diff changeset
   573
    "return true, if this is a protected method.
48061f8659aa more queries
claus
parents: 159
diff changeset
   574
     Execution of protected methods is only allowed via self sends
48061f8659aa more queries
claus
parents: 159
diff changeset
   575
     from superclasses or the class itself.
48061f8659aa more queries
claus
parents: 159
diff changeset
   576
     If a protected method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
   577
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   578
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   579
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
   580
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   581
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   582
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
   583
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
   584
48061f8659aa more queries
claus
parents: 159
diff changeset
   585
%{  /* NOCONTEXT */
48061f8659aa more queries
claus
parents: 159
diff changeset
   586
    /* I made this a primitive to get the define constant from stc.h */
48061f8659aa more queries
claus
parents: 159
diff changeset
   587
748
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   588
#if defined(F_CLASSPRIVATE) && defined(M_PRIVACY)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   589
    int f = _intVal(_INST(flags));
48061f8659aa more queries
claus
parents: 159
diff changeset
   590
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   591
    if ((f & M_PRIVACY) == F_CLASSPRIVATE) {
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   592
	RETURN (true);
48061f8659aa more queries
claus
parents: 159
diff changeset
   593
    }
48061f8659aa more queries
claus
parents: 159
diff changeset
   594
#endif
48061f8659aa more queries
claus
parents: 159
diff changeset
   595
%}.
48061f8659aa more queries
claus
parents: 159
diff changeset
   596
    ^ false
48061f8659aa more queries
claus
parents: 159
diff changeset
   597
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   598
48061f8659aa more queries
claus
parents: 159
diff changeset
   599
isPublic
48061f8659aa more queries
claus
parents: 159
diff changeset
   600
    "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
   601
     This is the default and how other smalltalk implementations treat all methods.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   602
360
claus
parents: 350
diff changeset
   603
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
   604
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   605
360
claus
parents: 350
diff changeset
   606
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
   607
     It may change or even vanish (if it shows to be not useful)."
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   608
48061f8659aa more queries
claus
parents: 159
diff changeset
   609
%{  /* NOCONTEXT */
48061f8659aa more queries
claus
parents: 159
diff changeset
   610
    /* I made this a primitive to get the define constant from stc.h */
48061f8659aa more queries
claus
parents: 159
diff changeset
   611
748
Claus Gittinger <cg@exept.de>
parents: 747
diff changeset
   612
#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
   613
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   614
    int f = _intVal(_INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   615
# ifdef F_PRIVATE
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   616
    if ((f & M_PRIVACY) == F_PRIVATE) {
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   617
	RETURN (false);
48061f8659aa more queries
claus
parents: 159
diff changeset
   618
    }
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   619
# endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   620
# ifdef F_CLASSPRIVATE
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   621
    if ((f & M_PRIVACY) == F_CLASSPRIVATE) {
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   622
	RETURN (false);
48061f8659aa more queries
claus
parents: 159
diff changeset
   623
    }
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   624
# endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   625
# ifdef F_IGNORED
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   626
    if ((f & M_PRIVACY) == F_IGNORED) {
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   627
	RETURN (false);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   628
    }
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   629
# endif
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   630
#endif
48061f8659aa more queries
claus
parents: 159
diff changeset
   631
%}.
48061f8659aa more queries
claus
parents: 159
diff changeset
   632
    ^ true
48061f8659aa more queries
claus
parents: 159
diff changeset
   633
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   634
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   635
isRestricted
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   636
    "return the flag bit stating that this method is restricted.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   637
     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
   638
     'trap restricted mode' (-->ObjectMemory) otherise a runtime 
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   639
     error (PrivateMethodSignal) is raised.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   640
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   641
     Notice: method restriction is a nonstandard feature, not supported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   642
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   643
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   644
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   645
     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
   646
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   647
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   648
#ifdef F_RESTRICTED
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   649
    int f = _intVal(_INST(flags));
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   650
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   651
    if (f & F_RESTRICTED) {
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   652
	RETURN (true);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   653
    }
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   654
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   655
%}.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   656
    ^ 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
   657
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   658
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   659
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
   660
    "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
   661
     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
   662
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   663
     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
   664
     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
   665
     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
   666
     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
   667
     (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
   668
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   669
     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
   670
     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
   671
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   672
    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
   673
    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
   674
    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
   675
    ^ #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
   676
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   677
    "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
   678
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   679
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   680
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
   681
    "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
   682
     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
   683
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   684
     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
   685
     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
   686
     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
   687
     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
   688
     (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
   689
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   690
     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
   691
     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
   692
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   693
    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
   694
	"/
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   695
	"/ 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
   696
	"/
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   697
	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
   698
	    ^ 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
   699
	].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   700
	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
   701
    ] 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
   702
	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
   703
	    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
   704
	] 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
   705
	    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
   706
		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
   707
	    ] 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
   708
		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
   709
		    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
   710
		]
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   711
	    ]
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   712
	]
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   713
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   714
    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
   715
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   716
    "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
   717
!
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   718
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   719
restricted:aBoolean
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   720
    "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
   721
     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
   722
     'trap restricted mode' (-->ObjectMemory) otherise a runtime
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   723
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   724
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   725
     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
   726
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   727
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   728
     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
   729
     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
   730
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   731
%{  /* NOCONTEXT */
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   732
    /* 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
   733
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   734
#ifdef F_RESTRICTED
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   735
    int f = _intVal(_INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   736
    int old;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   737
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   738
    old = f;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   739
    if (aBoolean == true) 
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   740
	f |= F_RESTRICTED;
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   741
    else
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   742
	f &= ~F_RESTRICTED;
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   743
    _INST(flags) = _MKSMALLINT(f);
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   744
    if (old & F_RESTRICTED)
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   745
	RETURN(true);
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   746
#endif
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   747
%}.
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   748
    ^ false
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   749
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   750
    "
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   751
     (ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   752
    "
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   753
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   754
    "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
   755
!
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   756
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
   757
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
   758
    "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
   759
     (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
   760
      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
   761
      or a doesNotUnderstand exception to be raised)
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   762
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
   763
     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
   764
     by other smalltalk implementations and not specified in the ANSI spec.
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   765
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
   766
     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
   767
     It may change or even vanish (if it shows to be not useful)."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   768
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   769
%{  /* NOCONTEXT */
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   770
    int f = _intVal(_INST(flags));
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   771
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
   772
#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
   773
    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
   774
#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
   775
    _INST(flags) = _MKSMALLINT(f);
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
%}
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
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
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
   780
    "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
   781
     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
   782
     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
   783
     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
   784
     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
   785
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
     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
   787
     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
   788
     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
   789
     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
   790
     (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
   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
     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
   793
     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
   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
%{  /* 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
   796
    /* 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
   797
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
#if defined(F_PRIVATE) && 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
   799
    int f = _intVal(_INST(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
   800
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   801
    f = (f & ~M_PRIVACY) | F_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
   802
    _INST(flags) = _MKSMALLINT(f);
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   803
#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
   804
%}
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   805
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   806
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   807
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
   808
    "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
   809
     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
   810
     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
   811
     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
   812
     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
   813
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   814
     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
   815
     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
   816
     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
   817
     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
   818
     (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
   819
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   820
     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
   821
     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
   822
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   823
%{  /* 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
   824
    /* 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
   825
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   826
#if defined(F_CLASSPRIVATE) && 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
   827
    int f = _intVal(_INST(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
   828
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   829
    f = (f & ~M_PRIVACY) | F_CLASSPRIVATE;
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   830
    _INST(flags) = _MKSMALLINT(f);
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   831
#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
   832
%}
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   833
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   834
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   835
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
   836
    "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
   837
     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
   838
     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
   839
     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
   840
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
     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
   842
     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
   843
     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
   844
     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
   845
     (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
   846
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)."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   849
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   850
%{  /* 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
   851
    /* 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
   852
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
#ifdef 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
    int f = _intVal(_INST(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
   855
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   856
    f = f & ~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
   857
    _INST(flags) = _MKSMALLINT(f);
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
#endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   859
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
   860
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   861
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
   862
!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
   863
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
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
   865
    "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
   866
     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
   867
     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
   868
     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
   869
     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
   870
     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
   871
     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
   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
    |doMachineCode mthd|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   874
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
   875
    byteCode 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
   876
	"
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
	 is already a 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
   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
	^ self
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   880
    ].
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
    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
   882
    [
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   883
	mthd := self 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
   884
    ] valueNowOrOnUnwindDo:[
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
	Compiler stcCompilation:doMachineCode.
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
    ^ mthd
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   888
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
   889
    "Created: 24.10.1995 / 14:02:32 / 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
   890
    "Modified: 24.10.1995 / 14:17:21 / 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
   891
!
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
   892
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
   893
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
   894
    "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
   895
     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
   896
     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
   897
     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
   898
     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
   899
     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
   900
     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
   901
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
    |temporaryMethod cls sourceString silent lazy|
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
   903
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
   904
    byteCode notNil ifTrue:[
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   905
        "
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   906
         is already a bytecoded method
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   907
        "
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   908
        ^ 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
   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
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   911
    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
   912
    cls isNil ifTrue:[
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   913
        'METHOD: cannot generate bytecode (no class for compilation)' errorPrintNL.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   914
        ^ 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
   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
    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
   917
    sourceString isNil ifTrue:[
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   918
        'METHOD: cannot generate bytecode (no source for compilation)' errorPrintNL.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   919
        ^ nil
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
   920
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   921
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   922
    "
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
   923
     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
   924
     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
   925
     dont want a lazy method ...
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   926
    "
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
   927
    Class withoutUpdatingChangesDo:[
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   928
        silent := Smalltalk silentLoading:true.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   929
        lazy := Compiler compileLazy:false.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   930
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   931
        [
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   932
            |compiler|
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   933
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   934
            compiler := cls compilerClass.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   935
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   936
            "/
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   937
            "/ kludge - have to make ST/X's compiler protocol
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   938
            "/ be compatible to ST-80's
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   939
            "/
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   940
            (compiler respondsTo:#compile:forClass:inCategory:notifying:install:skipIfSame:)
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   941
            ifTrue:[
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   942
                temporaryMethod := compiler
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   943
                                     compile:sourceString
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   944
                                     forClass:cls
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   945
                                     inCategory:(self category)
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   946
                                     notifying:nil
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   947
                                     install:false.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   948
            ] ifFalse:[
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   949
                temporaryMethod := compiler new
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   950
                                     compile:sourceString 
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   951
                                     in:cls 
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   952
                                     notifying:nil 
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   953
                                     ifFail:nil
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   954
            ].
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   955
        ] valueNowOrOnUnwindDo:[
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   956
            Compiler compileLazy:lazy.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   957
            Smalltalk silentLoading:silent.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   958
        ]
463
447ead9f870c be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   959
    ].
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
   960
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   961
        'METHOD: cannot generate bytecode (contains primitive code or error)' errorPrintNL.
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   962
        ^ 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
   963
    ].
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   964
    "
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
   965
     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
   966
    "
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
    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
   968
    ^ temporaryMethod
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   969
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
   970
    "Created: 24.10.1995 / 14:02:30 / cg"
1087
6cb00ecfbc6d nicer message
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   971
    "Modified: 7.3.1996 / 19:19:12 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   972
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   973
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
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
   975
    "tell the newly restored Font about restoration"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   976
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
   977
    self code 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
   978
	"built-in method - already complete"
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
	^ self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   980
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   981
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
   982
    ^ super readBinaryContentsFrom: stream manager: manager
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   983
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   984
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
   985
storeBinaryDefinitionOn: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
   986
    "only store bytecode-methods - machinecode methods are 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
   987
     as class/selector pair and a lookup is done when restored.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   988
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
   989
     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
   990
     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
   991
     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
   992
     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
   993
     method does not contain primitive code."
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
   994
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
   995
    |storedMethod who|
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   996
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
   997
    byteCode isNil 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
   998
	self code 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
   999
	    (who := self who) 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
  1000
		"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1001
		 machine code only - assume its a 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
  1002
		 and store the class/selector 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
  1003
		 The restored method may not be exactly the same ...
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1004
		"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1005
		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
  1006
		stream nextPutByte:0.   "means: 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
  1007
		manager putIdOf:(who at:1) 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
  1008
		manager putIdOf:(who at:2) 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
  1009
		^ self
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
	    ]
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1011
	].
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1012
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
  1013
	storedMethod := self 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
  1014
	storedMethod isNil 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
  1015
	    self error:'store of built-in method failed'.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1016
	    ^ 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
  1017
	].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1018
	^ storedMethod storeBinaryDefinitionOn: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
  1019
    ].
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1020
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
  1021
    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
  1022
    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
  1023
    self storeBinaryDefinitionBodyOn:stream manager:manager
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1024
!
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1025
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
  1026
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
  1027
    "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
  1028
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1029
    |m code srcPos|
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1030
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
  1031
    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
  1032
    category 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
  1033
    byteCode isNil 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
  1034
	m := self 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
  1035
	code 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
  1036
	    code := m byteCode
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1037
	] 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
  1038
	    m := self
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1039
	]
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1040
    ] 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
  1041
	m := self.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1042
	code := byteCode
391
claus
parents: 384
diff changeset
  1043
    ].
362
claus
parents: 360
diff changeset
  1044
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
  1045
    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
  1046
    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
  1047
    manager sourceMode == #discard 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
  1048
	nil storeBinaryOn:stream manager:manager. "/ sourceFileName
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
	nil storeBinaryOn:stream manager:manager. "/ 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
  1050
	nil storeBinaryOn:stream manager:manager. "/ 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
  1051
    ] 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
  1052
	m sourceFilename 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
  1053
	manager sourceMode == #reference 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
  1054
	    srcPos := m 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
  1055
	] 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
  1056
	    srcPos := 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
  1057
	].
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
	srcPos 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
  1059
	srcPos isNil 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
  1060
	    m source 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
  1061
	].
391
claus
parents: 384
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
    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
  1064
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1065
    "Created: 16.1.1996 / 14:41:45 / 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
!Method methodsFor:'copying'!
438
claus
parents: 423
diff changeset
  1069
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
  1070
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
  1071
    "redefined to change source ref into a real string"
438
claus
parents: 423
diff changeset
  1072
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
  1073
    |aCopy|
438
claus
parents: 423
diff changeset
  1074
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
  1075
    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
  1076
    sourcePosition 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
  1077
	aCopy source:(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
  1078
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1079
    ^ aCopy
438
claus
parents: 423
diff changeset
  1080
! !
claus
parents: 423
diff changeset
  1081
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1082
!Method methodsFor:'error handling'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1083
328
claus
parents: 326
diff changeset
  1084
invalidCodeObject
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1085
    "this method is triggered by the interpreter when a nil or non method
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1086
     is about to be executed.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1087
     In this case, the VM sends this to the bad method (the receiver).
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1088
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1089
     Also, the Compiler creates methods with their code/bytecode set to
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1090
     this method if - after a class change - a method cannot be compiled
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1091
     and is therefore no longer executable (for example, after an instvar
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1092
     has been removed, and a method still tries to access this instvar)
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1093
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1094
     Thus, we arrive here, when playing around in a classes methodArray,
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1095
     or compiler/runtime system is broken :-(, 
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1096
     or you ignore the error messages during some recompile."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1097
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1098
    ^ InvalidCodeSignal
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1099
	raiseRequestWith:self
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1100
	errorString:'invalid method - not executable'.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1101
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1102
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1103
privateMethodCalled
980
0ab2f56ecfc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1104
    "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
  1105
360
claus
parents: 350
diff changeset
  1106
     If you continue in the debugger, the method will be called,
415
claus
parents: 414
diff changeset
  1107
     and further privacy exceptions will NOT be reported at this call location, 
360
claus
parents: 350
diff changeset
  1108
     until any new method is compiled, or the privacy of any method changes,
claus
parents: 350
diff changeset
  1109
     or the caches are flushed.
claus
parents: 350
diff changeset
  1110
     (the reason is that after the continue, the method is enterred into the
claus
parents: 350
diff changeset
  1111
      calling cache, for which method privacy is not checked.
claus
parents: 350
diff changeset
  1112
      Any of the above actions flushes this cache and a privacy check
claus
parents: 350
diff changeset
  1113
      is performed again.)
claus
parents: 350
diff changeset
  1114
     Future versions may not enter private methods into the cache, to fix this
claus
parents: 350
diff changeset
  1115
     (unobvious) behavior. However, then you will get an exception for EVERY
claus
parents: 350
diff changeset
  1116
     call to a private method ...
claus
parents: 350
diff changeset
  1117
claus
parents: 350
diff changeset
  1118
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
  1119
     by other smalltalk implementations and not specified in the ANSI spec.
claus
parents: 350
diff changeset
  1120
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
  1121
     It may change or even vanish (if it shows to be not useful)."
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1122
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1123
    ^ PrivateMethodSignal raise
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
  1124
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1125
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1126
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
  1127
    "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
  1128
     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
  1129
     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
  1130
     For those methods, the compiler generated a method object consisting
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1131
     of the original source code, but with this methods machine/byte 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
  1132
     Therefore, we patch (kludge) the lineNumber information, to show 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
  1133
     first line (instead of the real line below)"
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
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1135
    thisContext setLineNumber: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
  1136
    ^ InvalidCodeSignal
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1137
	raiseRequestWith:self
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1138
	errorString:'invalid method - not compiled'.
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
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1140
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1141
wrongNumberOfArguments:numberGiven
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1142
    "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
  1143
     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
  1144
     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
  1145
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1146
    ^ ArgumentSignal
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1147
	raiseRequestWith:self
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1148
	errorString:('method got ' , numberGiven printString ,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1149
		     ' args while ' , self numberOfMethodArgs printString , ' where expected')
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1150
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1151
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1152
!Method methodsFor:'executing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1153
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1154
valueWithReceiver:anObject arguments:argArray
2
claus
parents: 1
diff changeset
  1155
    "low level call of a methods code - BIG DANGER ALERT.
claus
parents: 1
diff changeset
  1156
     Perform the receiver-method on anObject as receiver and argArray as
claus
parents: 1
diff changeset
  1157
     arguments. This does NO message lookup at all and mimics a
claus
parents: 1
diff changeset
  1158
     traditional function call.
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1159
     This method is provided for debugging- and breakpoint-support 
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1160
     (replacing a method by a stub and recalling the original), or to implement
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1161
     experimental MI implementations - it is not for general use. 
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1162
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1163
     The receiver must be a method compiled in anObjects class or one of its 
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1164
     superclasses and also, the number of arguments given must match the methods
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1165
     expectations -
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1166
     - otherwise strange things (and also strange crashes) can occur.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1167
     The system is NOT always detecting a wrong method/receiver combination.
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1168
     YOU HAVE BEEN WARNED."
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1169
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1170
    ^ self valueWithReceiver:anObject arguments:argArray selector:nil search:nil
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1171
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1172
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1173
valueWithReceiver:anObject arguments:argArray selector:aSymbol
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1174
    "low level call of a methods code - BIG DANGER ALERT.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1175
     Perform the receiver-method on anObject as receiver and argArray as
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1176
     arguments. This does NO message lookup at all and mimics a
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1177
     traditional function call.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1178
     This method is provided for debugging- and breakpoint-support 
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1179
     (replacing a method by a stub and recalling the original), or to implement
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1180
     experimental MI implementations - it is not for general use. 
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1181
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1182
     The receiver must be a method compiled in anObjects class or one of its 
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1183
     superclasses and also, the number of arguments given must match the methods
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1184
     expectations -
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1185
     - otherwise strange things (and also strange crashes) can occur.
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1186
     The system is NOT always detecting a wrong method/receiver combination.
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1187
     YOU HAVE BEEN WARNED."
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1188
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1189
    ^ self valueWithReceiver:anObject 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1190
		   arguments:argArray 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1191
		    selector:aSymbol 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1192
		      search:nil
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1193
		      sender:nil
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1194
!
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1195
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1196
valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1197
    "low level call of a methods code - BIG DANGER ALERT.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1198
     Perform the receiver-method on anObject as receiver and argArray as
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1199
     arguments. This does NO message lookup at all and mimics a
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1200
     traditional function call.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1201
     This method is provided for debugging- and breakpoint-support 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1202
     (replacing a method by a stub and recalling the original), or to implement
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1203
     experimental MI implementations - it is not for general use. 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1204
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1205
     The receiver must be a method compiled in anObjects class or one of its 
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1206
     superclasses and also, the number of arguments given must match the methods
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1207
     expectations -
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1208
     - otherwise strange things (and also strange crashes) can occur.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1209
     The system is NOT always detecting a wrong method/receiver combination.
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1210
     YOU HAVE BEEN WARNED."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1211
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1212
    ^ self valueWithReceiver:anObject 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1213
		   arguments:argArray 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1214
		    selector:aSymbol 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1215
		      search:nil
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1216
		      sender:nil
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1217
!
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1218
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1219
valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1220
    "low level call of a methods code - BIG DANGER ALERT.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1221
     Perform the receiver-method on anObject as receiver and argArray as
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1222
     arguments. This does NO message lookup at all and mimics a
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1223
     traditional function call.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1224
     This method is provided for debugging- and breakpoint-support 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1225
     (replacing a method by a stub and recalling the original), or to implement
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1226
     experimental MI implementations - it is not for general use. 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1228
     The receiver must be a method compiled in anObjects class or one of its 
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1229
     superclasses and also, the number of arguments given must match the methods
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1230
     expectations -
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1231
     - otherwise strange things (and also strange crashes) can occur.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1232
     The system is NOT always detecting a wrong method/receiver combination.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1233
     YOU HAVE BEEN WARNED."
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1234
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1235
%{
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1236
    OBJFUNC code;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1237
    OBJ searchClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1238
    static struct inlineCache dummy = _DUMMYILC0;
2
claus
parents: 1
diff changeset
  1239
    int nargs;
claus
parents: 1
diff changeset
  1240
    OBJ *ap;
claus
parents: 1
diff changeset
  1241
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1242
    if (__isArray(argArray)) {
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1243
	nargs = _arraySize(argArray);
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1244
	ap = _ArrayInstPtr(argArray)->a_element;
2
claus
parents: 1
diff changeset
  1245
    } else {
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1246
	if (argArray == nil) {
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1247
	    nargs = 0;
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1248
	} else
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1249
	    nargs = -1;
2
claus
parents: 1
diff changeset
  1250
    }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1251
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1252
#ifdef F_NARGS
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1253
    if (((_intVal(_INST(flags)) & F_NARGS) >> F_NARGSHIFT) == nargs) 
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1254
#endif
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1255
    {
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1256
	code = _MethodInstPtr(self)->m_code;
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1257
	if (aClass == nil) {
328
claus
parents: 326
diff changeset
  1258
	    searchClass = dummy.ilc_class = __Class(anObject);
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1259
	} else {
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1260
	    searchClass = dummy.ilc_class = aClass;
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1261
	}
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1262
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1263
	if (nargs <= 15) {
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1264
	  /*
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1265
	   * add virtual sender (unwinding) here later,
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1266
	   * to allow hiding contexts in lazy methods.
328
claus
parents: 326
diff changeset
  1267
	   * (this is cosmetics only; therefore its done later)
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1268
	   */
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1269
	  if (code) {
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1270
	    /* compiled code */
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1271
	    switch (nargs) {
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1272
		case 0:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1273
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1274
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1275
		case 1:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1276
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, ap[0]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1277
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1278
		case 2:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1279
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, ap[0], ap[1]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1280
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1281
		case 3:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1282
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, ap[0], ap[1], ap[2]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1283
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1284
		case 4:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1285
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1286
				 ap[0], ap[1], ap[2], ap[3]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1287
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1288
		case 5:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1289
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1290
				 ap[0], ap[1], ap[2], ap[3], ap[4]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1291
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1292
		case 6:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1293
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1294
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1295
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1296
		case 7:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1297
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1298
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1299
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1300
		case 8:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1301
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1302
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1303
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1304
		case 9:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1305
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1306
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1307
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1308
		case 10:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1309
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1310
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1311
				 ap[9]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1312
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1313
		case 11:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1314
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1315
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1316
				 ap[9], ap[10]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1317
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1318
		case 12:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1319
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1320
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1321
				 ap[9], ap[10], ap[11]) );
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1322
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1323
		case 13:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1324
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1325
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1326
				 ap[9], ap[10], ap[11], ap[12]) );
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1327
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1328
		case 14:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1329
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1330
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1331
				 ap[9], ap[10], ap[11], ap[12], ap[13]) );
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1332
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1333
		case 15:
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1334
		    RETURN ( (*code)(anObject, aSymbol, SND_COMMA searchClass, &dummy, 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1335
				 ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6], ap[7], ap[8], 
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1336
				 ap[9], ap[10], ap[11], ap[12], ap[13], ap[14]) );
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1337
	    }
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1338
	  } else {
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1339
	    /* interpreted code */
328
claus
parents: 326
diff changeset
  1340
#ifdef PASS_ARG_POINTER
claus
parents: 326
diff changeset
  1341
	    RETURN ( __interpret(self, nargs, anObject, aSymbol, SND_COMMA searchClass, ap) );
claus
parents: 326
diff changeset
  1342
#else
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1343
	    switch (nargs) {
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1344
		case 0:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1345
		    RETURN ( __interpret(self, 0, anObject, aSymbol, SND_COMMA searchClass) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1346
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1347
		case 1:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1348
		    RETURN ( __interpret(self, 1, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1349
				   ap[0]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1350
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1351
		case 2:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1352
		    RETURN ( __interpret(self, 2, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1353
				   ap[0], ap[1]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1354
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1355
		case 3:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1356
		    RETURN ( __interpret(self, 3, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1357
				   ap[0], ap[1], ap[2]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1358
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1359
		case 4:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1360
		    RETURN ( __interpret(self, 4, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1361
				   ap[0], ap[1], ap[2], ap[3]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1362
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1363
		case 5:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1364
		    RETURN ( __interpret(self, 5, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1365
				   ap[0], ap[1], ap[2], ap[3], ap[4]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1366
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1367
		case 6:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1368
		    RETURN ( __interpret(self, 6, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1369
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1370
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1371
		case 7:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1372
		    RETURN ( __interpret(self, 7, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1373
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1374
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1375
		case 8:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1376
		    RETURN ( __interpret(self, 8, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1377
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1378
				   ap[7]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1379
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1380
		case 9:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1381
		    RETURN ( __interpret(self, 9, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1382
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1383
				   ap[7], ap[8]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1384
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1385
		case 10:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1386
		    RETURN ( __interpret(self, 10, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1387
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1388
				   ap[7], ap[8], ap[9]) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1389
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1390
		case 11:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1391
		    RETURN ( __interpret(self, 11, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1392
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1393
				   ap[7], ap[8], ap[9], ap[10]) );
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1394
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1395
		case 12:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1396
		    RETURN ( __interpret(self, 12, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1397
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1398
				   ap[7], ap[8], ap[9], ap[11]) );
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1399
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1400
		case 13:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1401
		    RETURN ( __interpret(self, 13, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1402
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1403
				   ap[7], ap[8], ap[9], ap[11], ap[12]) );
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1404
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1405
		case 14:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1406
		    RETURN ( __interpret(self, 14, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1407
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1408
				   ap[7], ap[8], ap[9], ap[11], ap[12], ap[13]) );
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1409
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1410
		case 15:
1037
4488f834cb6b only one __interpret
Claus Gittinger <cg@exept.de>
parents: 980
diff changeset
  1411
		    RETURN ( __interpret(self, 15, anObject, aSymbol, SND_COMMA searchClass,
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1412
				   ap[0], ap[1], ap[2], ap[3], ap[4], ap[5], ap[6],
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1413
				   ap[7], ap[8], ap[9], ap[11], ap[12], ap[13], ap[14]) );
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1414
	    }
328
claus
parents: 326
diff changeset
  1415
#endif
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1416
	  }
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1417
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1418
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1419
%}
2
claus
parents: 1
diff changeset
  1420
.
claus
parents: 1
diff changeset
  1421
    (argArray isMemberOf:Array) ifFalse:[
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1422
	"
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1423
	 arguments must be either nil or an array
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1424
	"
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1425
	^ self badArgumentArray
2
claus
parents: 1
diff changeset
  1426
    ].
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1427
    (argArray size ~~ self numberOfMethodArgs) ifTrue:[
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1428
	"
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1429
	 the method expects a different number of arguments
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1430
	"
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1431
	^ self wrongNumberOfArguments:argArray size
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1432
    ].
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1433
    "
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1434
     the VM only supports a limited number of arguments in sends
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1435
    "
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1436
    ^ self tooManyArguments
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1437
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1438
    "
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1439
     (Float compiledMethodAt:#+) 
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1440
	valueWithReceiver:1.0 arguments:#(2.0)
2
claus
parents: 1
diff changeset
  1441
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1442
     '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
  1443
     (True compiledMethodAt:#printString) 
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1444
	valueWithReceiver:false arguments:nil
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1445
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1446
     '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
  1447
      and a wrong value returned ...'.
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1448
     (Point compiledMethodAt:#x) 
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1449
	valueWithReceiver:(1->2) arguments:nil
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1450
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1451
     '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
  1452
      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
  1453
     (Point compiledMethodAt:#x) 
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1454
	valueWithReceiver:(Object new) arguments:nil
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1455
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1456
     '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
  1457
     (Object compiledMethodAt:#printOn:)
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1458
	valueWithReceiver:false arguments:nil
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1459
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1460
     '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
  1461
     (Object compiledMethodAt:#printOn:)
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1462
	valueWithReceiver:false arguments:#() 
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1463
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1464
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1465
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1466
!Method methodsFor:'printing & storing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1467
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1468
printOn:aStream
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1469
    "put a printed representation of the receiver onto aStream.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1470
     Since methods do not store their class/selector, we have to search
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1471
     for it here."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1472
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1473
    |classAndSelector m wrapped|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1474
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1475
    wrapped := false.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1476
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1477
    aStream nextPutAll:(self classNameWithArticle).
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1478
    aStream nextPut:$(.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1479
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1480
    classAndSelector := self who.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1481
    classAndSelector isNil ifTrue:[
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1482
	"
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1483
	 not anchored in any class.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1484
	 check if wrapped (to be more informative in inspectors)
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1485
	"
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1486
	m := self wrapper.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1487
	m notNil ifTrue:[
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1488
	    classAndSelector := m who.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1489
	    wrapped := true.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1490
	]
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1491
    ].
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1492
    classAndSelector notNil ifTrue:[
48061f8659aa more queries
claus
parents: 159
diff changeset
  1493
	(classAndSelector at:1) name printOn:aStream.
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1494
	aStream nextPutAll:' '.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1495
	(classAndSelector at:2) printOn:aStream.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1496
	wrapped ifTrue:[
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1497
	    aStream nextPutAll:'; wrapped'
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1498
	].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1499
    ] ifFalse:[
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
  1500
	"
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1501
	 sorry, a method which is nowhere anchored
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
  1502
	"
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1503
	aStream nextPutAll:'unbound'
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1504
    ].
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1505
    aStream nextPut:$)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1506
48061f8659aa more queries
claus
parents: 159
diff changeset
  1507
    "
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1508
     (Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1509
     (Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1510
    "
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
  1511
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1512
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1513
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
  1514
    "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
  1515
     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
  1516
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1517
    |w|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1518
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1519
    w := self 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
  1520
    w 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
  1521
	^ (w at:1) name , '>>' , (w 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
  1522
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1523
    ^ '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
  1524
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1525
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1526
     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
  1527
     (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
  1528
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1529
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1530
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1531
!Method methodsFor:'private-compiler interface'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1532
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1533
flags:newFlags
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1534
    "set the flags (number of method variables, stacksize).
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1535
     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
  1536
              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
  1537
              may crash smalltalk badly.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1538
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1539
     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
  1540
     may change without notice."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1541
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1542
    "/ protect myself a bit - putting in an object would crash me ...
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1543
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1544
    (newFlags isMemberOf:SmallInteger) ifTrue:[
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1545
        flags := newFlags
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1546
    ]
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1547
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1548
    "Modified: 8.3.1996 / 13:26:05 / cg"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1549
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1550
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1551
numberOfMethodArgs:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1552
    "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
  1553
     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
  1554
              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
  1555
              may (will ?)  crash smalltalk badly.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1556
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1557
     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
  1558
     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
  1559
     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
  1560
     - for use by compiler only."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1561
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1562
    (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
  1563
        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
  1564
                    self class maxNumberOfArguments printString ,
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1565
                    ' method arguments').
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1566
        ^ self
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1567
    ].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1568
%{
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1569
    /* 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
  1570
#ifdef F_NARGS
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1571
    _INST(flags) = _MKSMALLINT( (_intVal(_INST(flags)) & ~F_NARGS) | (_intVal(aNumber) << F_NARGSHIFT) );
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1572
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1573
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1574
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1575
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1576
numberOfMethodVars:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1577
    "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
  1578
     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
  1579
              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
  1580
              may (will ?)  crash smalltalk badly."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1581
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1582
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1583
    int f = _intVal(_INST(flags));
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1584
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1585
    /* 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
  1586
    if (__isSmallInteger(aNumber)) {
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1587
        f = (f & ~F_NVARS) | (_intVal(aNumber) << F_NVARSHIFT);
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1588
        _INST(flags) = _MKSMALLINT(f);
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1589
    }
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1590
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1591
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1592
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1593
setResourceFlag
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1594
    "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
  1595
     source. 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1596
     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
  1597
     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
  1598
     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
  1599
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1600
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1601
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1602
#ifdef F_RESOURCE
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1603
    int f = _intVal(_INST(flags));
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1604
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1605
    f |= F_RESOURCE;
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1606
    _INST(flags) = _MKSMALLINT(f);
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1607
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1608
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1609
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1610
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1611
stackSize:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1612
    "set the depth of the local stack.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1613
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1614
     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
  1615
              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
  1616
              may crash smalltalk badly.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1617
              (if the runtime library was compiled with DEBUG, 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1618
               a bad stack will be detected and triggers an error)"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1619
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1620
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1621
    int f = _intVal(_INST(flags));
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1622
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1623
    /* 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
  1624
    if (__isSmallInteger(aNumber)) {
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1625
        f = (f & ~F_NSTACK) | (_intVal(aNumber) << F_NSTACKSHIFT);
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1626
        _INST(flags) = _MKSMALLINT(f);
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1627
    }
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1628
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1629
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1630
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
  1631
!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
  1632
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1633
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
  1634
    "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
  1635
     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
  1636
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1637
    "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
  1638
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1639
    |pair|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1640
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1641
    pair := self 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
  1642
    pair notNil ifTrue:[^ pair at: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
  1643
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1644
     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
  1645
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1646
    ^ 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
  1647
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1648
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1649
     |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
  1650
     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
  1651
     m 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
  1652
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1653
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1654
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1655
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
  1656
    "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
  1657
     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
  1658
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1659
    |src|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1660
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
  1661
    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
  1662
    src 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
  1663
	(src includesString:'%{' ) 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
  1664
	    "/ cannot 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
  1665
	    ^ 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
  1666
	]
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1667
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1668
    ^ 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
  1669
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1670
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1671
     (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
  1672
     (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
  1673
     (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
  1674
    "
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1675
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
  1676
    "Modified: 31.10.1995 / 14:43:37 / 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
  1677
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1678
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1679
hasResource
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1680
    "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
  1681
     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
  1682
     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
  1683
     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
  1684
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1685
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1686
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1687
#ifdef F_RESOURCE
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1688
    RETURN (((INT)_INST(flags) & __MASKSMALLINT(F_RESOURCE)) ? true : false);
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1689
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1690
%}.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1691
    ^ false
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1692
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1693
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1694
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1695
1103
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1696
isExecutable
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1697
    "return true, if this method is executable.
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1698
     I.e. neither an invalidated nor an unloaded method"
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1699
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1700
    self isInvalid ifTrue:[^ false].
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1701
    ^ byteCode notNil or:[self code notNil]
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1702
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1703
    "Created: 18.3.1996 / 15:38:52 / cg"
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1704
!
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1705
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
  1706
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
  1707
    "return true, if this method is not executable due to
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1708
     a (re)-compilation error. (see comment in Method>>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
  1709
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1710
    |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
  1711
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1712
    m := Method compiledMethodAt:#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
  1713
    self ~~ m 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
  1714
	(self code notNil and:[self code = m code]) ifTrue:[^ 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
  1715
	(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ 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
  1716
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1717
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
  1718
    m := Method 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
  1719
    self ~~ m 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
  1720
	(self code notNil and:[self code = m code]) ifTrue:[^ 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
  1721
	(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ 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
  1722
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1723
    m := Metaclass compiledMethodAt:#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
  1724
    self ~~ m 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
  1725
	(self code notNil and:[self code = m code]) ifTrue:[^ 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
  1726
	(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ 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
  1727
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1728
    ^ 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
  1729
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1730
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1731
isLazyMethod
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1732
    "return true, if this is a lazy 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
  1733
     False is returned here - this method is redefined in LazyMethod"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1734
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1735
    ^ 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
  1736
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1737
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1738
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
  1739
    "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
  1740
     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
  1741
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1742
    ^ 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
  1743
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1744
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1745
isWrapped
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1746
    "return true, if this is a wrapper 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
  1747
     False is returned here - this method is redefined in WrappedMethod"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1748
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1749
    ^ 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
  1750
!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1751
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
  1752
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
  1753
    "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
  1754
     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
  1755
     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
  1756
     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
  1757
     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
  1758
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1759
    |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
  1760
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1761
    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
  1762
    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
  1763
	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
  1764
	(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
  1765
	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
  1766
	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
  1767
	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
  1768
	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
  1769
	^ (argNames , varNames)
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1770
    ].
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
  1771
    ^ 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
  1772
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1773
    "
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
  1774
     (Method compiledMethodAt:#printOn:) methodArgAndVarNames
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1775
    "
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
  1776
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1777
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1778
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
  1779
    "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
  1780
     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
  1781
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1782
    ^ 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
  1783
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1784
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1785
     (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
  1786
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1787
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1788
    "Modified: 31.10.1995 / 14:36:46 / cg"
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1789
!
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1790
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
  1791
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
  1792
    "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
  1793
     This is a somewhat stupid implementation."
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1794
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
  1795
    |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
  1796
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1797
    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
  1798
    (text size < 2) ifTrue:[^nil].
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1799
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
  1800
    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
  1801
    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
  1802
    (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
  1803
	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
  1804
	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
  1805
	^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1)
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1806
    ].
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
  1807
    (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
  1808
	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
  1809
	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
  1810
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1811
	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
  1812
	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
  1813
	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
  1814
	[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
  1815
	    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
  1816
	    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
  1817
	    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
  1818
	    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
  1819
	].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1820
	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
  1821
	^ 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
  1822
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1823
    ^ 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
  1824
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1825
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1826
     (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
  1827
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1828
!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1829
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
  1830
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
  1831
    "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
  1832
     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
  1833
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1834
    ^ 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
  1835
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1836
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1837
     (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
  1838
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1839
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1840
    "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
  1841
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1842
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1843
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
  1844
    "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
  1845
     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
  1846
     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
  1847
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1848
    |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
  1849
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
  1850
    HistoryManager 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
  1851
    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
  1852
    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
  1853
    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
  1854
    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
  1855
    histLine := list last.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1856
    ^ AbsoluteTime date:histLine date time:histLine 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
  1857
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1858
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1859
     (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
  1860
     (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
  1861
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1862
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1863
    "Modified: 8.9.1995 / 15:08:22 / 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
  1864
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1865
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1866
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
  1867
    "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
  1868
     Get the source, let parser parse it using parseSelector,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1869
     return parser info using accessSelector"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1870
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1871
    |parser sourceString|
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  1872
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
  1873
    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
  1874
    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
  1875
	parser := Parser perform:parseSelector with: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
  1876
	(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
  1877
	^ parser perform:accessSelector
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1878
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1879
    ^ 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
  1880
!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1881
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
  1882
referencesGlobal:aGlobalSymbol
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1883
    "return true, if this method references the global
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1884
     bound to aGlobalSymbol."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1885
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1886
    |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
  1887
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1888
    (lits := self literals) isNil ifTrue:[^ 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
  1889
    ^ (lits identityIndexOf:aGlobalSymbol startingAt:1) ~~ 0
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1890
!
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  1891
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
  1892
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
  1893
    "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
  1894
     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
  1895
     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
  1896
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1897
    "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
  1898
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1899
    |pair|
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1900
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
  1901
    pair := self 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
  1902
    pair notNil ifTrue:[^ pair 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
  1903
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1904
     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
  1905
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1906
    ^ 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
  1907
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1908
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1909
     |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
  1910
     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
  1911
     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
  1912
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1913
!
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1914
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
  1915
sends:aSelectorSymbol
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1916
    "return true, if this method contains a message-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
  1917
     with aSelectorSymbol as 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
  1918
     - due to the simple check in the literal array, also simple uses 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1919
       of aSelectorSymbol as symbol will 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
  1920
       Should ask compiler, if there is really a 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
  1921
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1922
    ^ self referencesGlobal:aSelectorSymbol
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1923
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1924
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1925
wasCalled
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1926
    "return true if the method has ever been executed.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1927
     The called flag will be set by the interpreter whenever a method
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1928
     is called for the very first time, to support coverage tests.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1929
     This is EXPERIMENTAL, nonStandard and not yet fully implemented."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1930
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1931
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1932
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1933
#ifdef F_CALLED
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1934
    RETURN (((INT)_INST(flags) & __MASKSMALLINT(F_CALLED)) ? true : false);
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1935
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1936
%}.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1937
    ^ false
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1938
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1939
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1940
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1941
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
  1942
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
  1943
    "return the class and selector of where 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
  1944
     Since there is no information of the containing 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
  1945
     in the method, we have to do a search here.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1946
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1947
     Normally, this is not a problem, except when a method 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
  1948
     accepted in the debugger or redefined from within a 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
  1949
     (maybe done indirectly, if doIt is done recursively)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1950
     - the information about which class the original method was 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1951
     defined in is lost in this case.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1952
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
  1953
     Problem: this is heavily called for in the debugger to create
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1954
	      a readable context walkback. For unbound methods, 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
  1955
	      slow, since the search (over all classes) will always fail.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1956
     Q: should we add a backref from the method to the 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
  1957
	and/or add a subclass of Method for unbound 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
  1958
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1959
    |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
  1960
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1961
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1962
     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
  1963
     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
  1964
     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
  1965
     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
  1966
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1967
    LastWhoClass 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
  1968
	cls := Smalltalk at:LastWhoClass.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1969
	cls 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
  1970
	    sel := cls selectorAtMethod:self.
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
	    sel notNil ifTrue:[^ Array with:cls with: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
  1972
	]
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1973
    ].
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1974
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1975
    "
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
  1976
     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
  1977
     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
  1978
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1979
    classes := Smalltalk allClasses.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1980
    "
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
  1981
     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
  1982
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1983
    classes do:[:aClass |
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1984
	|sel|
350
claus
parents: 345
diff changeset
  1985
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
  1986
	sel := aClass selectorAtMethod:self.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1987
	sel notNil ifTrue:[LastWhoClass := aClass name.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1988
			   ^ Array with:aClass with:sel].
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1989
    ].
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
  1990
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1991
    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
  1992
    classes do:[:aClass |
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1993
	|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
  1994
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1995
	sel := aClass class selectorAtMethod:self.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1996
	sel notNil ifTrue:[^ Array with:aClass class with:sel].
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1997
    ].
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1998
    "
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
  1999
     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
  2000
     in the Smalltalk dictionary). Search all instances of Behavior
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2001
    "
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
  2002
    Behavior allSubInstancesDo:[:someClass |
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2003
	|sel|
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2004
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
  2005
	sel := someClass selectorAtMethod:self.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2006
	sel notNil ifTrue:[^ Array with:someClass with: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
  2007
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2008
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2009
     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
  2010
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2011
    ^ nil
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2012
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
  2013
    "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
  2014
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2015
     |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
  2016
     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
  2017
     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
  2018
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2019
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2020
    "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
  2021
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2022
     |m cls|
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2023
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
  2024
     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
  2025
	subclass:#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
  2026
	instanceVariableNames:'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
  2027
	classVariableNames:''
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2028
	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
  2029
	category:'testing'.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2030
     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
  2031
     Smalltalk removeClass:cls.
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2032
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
  2033
     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
  2034
     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
  2035
     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
  2036
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
     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
  2038
    "
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2039
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2040
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
  2041
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
  2042
    "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
  2043
     Thats the WrapperMethod which contains myself."
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2044
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
  2045
    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
  2046
	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
  2047
    ].
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
    ^ 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
  2049
! !
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  2050
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
  2051
!Method methodsFor:'trap methods'!
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  2052
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
  2053
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
  2054
    "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
  2055
     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
  2056
     the objectFileLoader to invalidate methods whose code is unloaded."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2057
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
  2058
    |invldMethod|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2059
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
  2060
    invldMethod := self class compiledMethodAt:#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
  2061
    self code:invldMethod 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
  2062
    self byteCode:invldMethod byteCode.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2063
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2064
    "Created: 17.9.1995 / 15:00:52 / claus"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2065
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2066
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
  2067
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
  2068
    "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
  2069
     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
  2070
     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
  2071
     after a class definition change (for example: instvars are no longer there)."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2072
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
  2073
    |invldMethod|
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2074
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
  2075
    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
  2076
    self code:invldMethod 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
  2077
    self byteCode:invldMethod byteCode.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2078
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2079
    "Created: 17.9.1995 / 15:01:14 / 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
  2080
! !
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2081
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
  2082
!Method class methodsFor:'documentation'!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2083
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
  2084
version
1103
614ebfdc0c9d added query if executable
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  2085
    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.79 1996-03-18 14:42:32 cg Exp $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2086
! !
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
  2087
Method initialize!