Object.st
author Claus Gittinger <cg@exept.de>
Fri, 08 May 1998 12:29:18 +0200
changeset 3425 f7faef75f0d8
parent 3423 b4a43b4f098b
child 3436 1a80952e6619
permissions -rw-r--r--
tuned word & doubleWord access for i386
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) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 143
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
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    13
nil subclass:#Object
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    14
	instanceVariableNames:''
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    15
	classVariableNames:'ErrorSignal HaltSignal MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    16
		UserInterruptSignal RecursionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    17
		ExceptionInterruptSignal SubscriptOutOfBoundsSignal
3101
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
    18
		IndexNotFoundSignal NonIntegerIndexSignal NotFoundSignal
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
    19
		KeyNotFoundSignal ElementOutOfBoundsSignal UserNotificationSignal
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
    20
		InformationSignal WarningSignal PrimitiveFailureSignal
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
    21
		DeepCopyErrorSignal AbortSignal ErrorRecursion Dependencies
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
    22
		InfoPrinting ActivityNotificationSignal InternalErrorSignal
3423
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
    23
		NonWeakDependencies SynchronizationSemaphores ObjectAttributes
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
    24
		OSSignalInterruptSignal'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    25
	poolDictionaries:''
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    26
	category:'Kernel-Objects'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    27
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    28
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
    29
!Object class methodsFor:'documentation'!
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    30
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    31
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    32
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    33
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
    34
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    35
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    37
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    38
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    39
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    40
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    41
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    42
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    43
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    44
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    45
dependencies
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    46
"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    47
   ST/X dependencies are slightly modified from ST-80's 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    48
   (we think they are better ;-).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    49
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    50
   One problem occuring very often in ST-80 is that some object
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    51
   cannot be garbage collected because some dependency is present,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    52
   having the object as a dependent of some other object.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    53
   In ST-80, this association remains alive (because a Dictionary
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    54
   is used to hold dependents) - even if no other references exist to
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    55
   to dependent or the dependee.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    56
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    57
   This means, that in ST-80, a #release is mandatory in order to
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    58
   prevent memory leaks.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    59
   We think, that this is a bad solution, since after all, exactly that
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    60
   kind of work should be performed by a garbage collector - you should not
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    61
   need to care about dependencies.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    62
   From a philosophical point of view, why should some object depend on 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    63
   something that the programmer considers a dead object ?
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    64
   (well - worse than that: it seems that some ST-80 code even depends on
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    65
    that behavior)
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    66
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    67
   In order to limit the trouble, ST-80 reimplemented the way dependents
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    68
   are stored in the model class - this one keeps the dependents locally,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    69
   so these dependents go away, once the model is reclaimed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    70
   That may make things even more confusing: with models, no #release is
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    71
   needed, with general objects it is mandatory.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    72
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    73
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    74
   In ST/X, dependencies are implemented using a WeakDictionary; this means,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    75
   that once the dependee dies, the dependency association is removed automatically,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    76
   and the dependent can be reclaimed by the garbage collector, if no other
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    77
   references exist to the dependent.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    78
   In order to (at least) provide a mechanism for the old behavior
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    79
   (in case your application heavily depends on the ST-80 mechanism), complementary
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    80
   protocol to add nonWeak dependencies is provided 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    81
   (see #addNonWeakDependent / #removeNonWeakDependent).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    82
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    83
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    84
   Caveat:
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
    85
      since interests are implemented using InterestConverter (which are simply
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    86
      forwarding messages), these must use the nonWeak mechanism (as done in ST-80
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    87
      automatically).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    88
      The reason is that there are usually no direct references to the converters,
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    89
      and those would be reclaimed if stored in a weakDictionary.
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
    90
      This means, that those interests MUST be removed with #retractInterest
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    91
      (which is bug-compatible to ST-80). 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    92
      We rewrite things to provide a more convenient mechanism in the future ...
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    93
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    94
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    95
   I like to hear comments on the above - do you think its better ?
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    96
"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    97
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    98
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    99
documentation
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   100
"
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   101
   Object is the superclass of most other classes. 
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   102
   (except for nil-subclasses, which inherit nothing,
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   103
    to catch any message into their #doesNotUnderstand: method)
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   104
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   105
   Protocol which is common to every object is defined here.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   106
   Also some utility stuff (like notify) and error handling is implemented here.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   107
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   108
   Object has no instance variables (and may not get any added). One reason is, that
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   109
   UndefinedObject and SmallInteger are also inheriting from Object - these two cannot 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   110
   have instance variables (due to their implementation). 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   111
   The other reason is that the runtime system (VM) knows about the layout of some built-in 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   112
   classes (think of Class, Method, Block and also Integer or Float). 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   113
   If you were allowed to add instance variables to Object, the VM had to be recompiled 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   114
   (and also rewritten in some places).
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   115
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   116
   [Class variables:]
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   117
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   118
	ErrorSignal     <Signal>        Signal raised for error/error: messages
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   119
					also, parent of all other signals.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   120
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   121
	HaltSignal      <Signal>        Signal raised for halt/halt: messages
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   122
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   123
	MessageNotUnderstoodSignal      Signals raised for various error conditions
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   124
	UserInterruptSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   125
	RecursionInterruptSignal 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   126
	ExceptionInterruptSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   127
	SubscriptOutOfBoundsSignal 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   128
	NonIntegerIndexSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   129
	NotFoundSignal 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   130
	KeyNotFoundSignal 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   131
	ElementOutOfBoundsSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   132
	InformationSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   133
	WarningSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   134
	DeepCopyErrorSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   135
	InternalErrorSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   136
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   137
	AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   138
					BUT, the debugger will only raise it if it is handled.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   139
					By handling the abortSignal, you can control where the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   140
					debuggers abort-function resumes execution in case of
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   141
					an error.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   142
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   143
	ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e. 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   144
					an error while handling an error).
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   145
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   146
	Dependencies     <WeakDependencyDictionary>  
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   147
					keeps track of object dependencies.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   148
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   149
	InfoPrinting     <Boolean>      controls weather informational messages 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   150
					are printed.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   151
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   152
	ActivityNotificationSignal <QuerySignal> 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   153
					 raised on #activityNotification:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   154
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   155
	NonWeakDependencies <Dictionary> keeps track of object dependencies.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   156
					 Dependents stay alive.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   157
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   158
	SynchronizationSemaphores <WeakIdentityDictionary>
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   159
					 Semaphores for per-object-monitor.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   160
                                        
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   161
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   162
    [author:]
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   163
	Claus Gittinger
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   164
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   165
"
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   166
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   167
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   168
!Object class methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   169
a27a279701f8 Initial revision
claus
parents:
diff changeset
   170
initialize
a27a279701f8 Initial revision
claus
parents:
diff changeset
   171
    "called only once - initialize signals"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   172
a27a279701f8 Initial revision
claus
parents:
diff changeset
   173
    ErrorSignal isNil ifTrue:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   174
	"/ have a chicken & egg problem here;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   175
	"/ signal wants object to be initialized,
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   176
	"/ Object needs the genericSignal from Signal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   177
	"/ So, make certain that on exists here.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   178
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   179
	Signal initGenericSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   180
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   181
	ErrorSignal := Signal genericSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   182
	ErrorSignal nameClass:self message:#errorSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   183
	ErrorSignal notifierString:'error encountered'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   184
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   185
	HaltSignal := ErrorSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   186
	HaltSignal nameClass:self message:#haltSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   187
	HaltSignal notifierString:'halt encountered'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   188
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   189
	MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   190
	MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   191
	MessageNotUnderstoodSignal notifierString:'message not understood'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   192
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   193
	PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   194
	PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   195
	PrimitiveFailureSignal notifierString:'primitive failed'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   196
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   197
	InternalErrorSignal := ErrorSignal newSignalMayProceed:false.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   198
	InternalErrorSignal nameClass:self message:#internalError.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   199
	InternalErrorSignal notifierString:'VM internal error: '.
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   200
362
claus
parents: 359
diff changeset
   201
"/        UserInterruptSignal := ErrorSignal newSignalMayProceed:true.
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   202
	UserInterruptSignal := (Signal new) mayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   203
	UserInterruptSignal nameClass:self message:#userInterruptSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   204
	UserInterruptSignal notifierString:'user Interrupt'.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   205
362
claus
parents: 359
diff changeset
   206
"/        RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false.
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   207
	RecursionInterruptSignal := (Signal new) mayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   208
	RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   209
	RecursionInterruptSignal notifierString:'recursion limit reached'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   210
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   211
	ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   212
	ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   213
	ExceptionInterruptSignal notifierString:'exception Interrupt'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   214
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   215
	NotFoundSignal := ErrorSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   216
	NotFoundSignal nameClass:self message:#notFoundSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   217
	NotFoundSignal notifierString:'no such element'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   218
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   219
	IndexNotFoundSignal := NotFoundSignal newSignalMayProceed:false.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   220
	IndexNotFoundSignal nameClass:self message:#indexNotFoundSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   221
	IndexNotFoundSignal notifierString:'bad index: '.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   222
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   223
	SubscriptOutOfBoundsSignal := IndexNotFoundSignal newSignalMayProceed:false.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   224
	SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   225
	SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   226
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   227
	ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   228
	ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   229
	ElementOutOfBoundsSignal notifierString:'element not appropriate or out of bounds'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   230
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   231
	KeyNotFoundSignal := NotFoundSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   232
	KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   233
	KeyNotFoundSignal notifierString:'no such key: '.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   234
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   235
	NonIntegerIndexSignal := IndexNotFoundSignal newSignalMayProceed:false.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   236
	NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   237
	NonIntegerIndexSignal notifierString:'index must be integer'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   238
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   239
	UserNotificationSignal := QuerySignal new.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   240
	UserNotificationSignal nameClass:self message:#userNotificationSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   241
	UserNotificationSignal notifierString:'user notifiaction wanted'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   242
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   243
	InformationSignal := UserNotificationSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   244
	InformationSignal nameClass:self message:#informationSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   245
	InformationSignal notifierString:'information'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   246
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   247
	WarningSignal := UserNotificationSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   248
	WarningSignal nameClass:self message:#warnungSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   249
	WarningSignal notifierString:'warning'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   250
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   251
	ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   252
	ActivityNotificationSignal nameClass:self message:#activityNotificationSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   253
	ActivityNotificationSignal notifierString:'activity'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   254
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   255
	DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   256
	DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   257
	DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   258
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   259
	"
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   260
	 AbortSignal is not a child of ErrorSignal -
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   261
	 this would complicate abort from within a signal handler
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   262
	"
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   263
	AbortSignal := Signal genericSignal newSignalMayProceed:true.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   264
	AbortSignal nameClass:self message:#abortSignal.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   265
	AbortSignal notifierString:'unhandled abort signal'.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   266
3423
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   267
	"
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   268
	 OSSignalInterruptSignal is not a child of ErrorSignal -
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   269
	 it requires explicit catching.
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   270
	 If unhandled, a debugger is entered.
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   271
	"
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   272
	OSSignalInterruptSignal := Signal genericSignal newSignalMayProceed:true.
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   273
	OSSignalInterruptSignal nameClass:self message:#osSignalInterruptSignal.
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   274
	OSSignalInterruptSignal notifierString:'OS signal interrupt'.
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   275
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   276
	ObjectAttributes isNil ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   277
	    ObjectAttributes := WeakIdentityDictionary new.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   278
	].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   279
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   280
	Dependencies isNil ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   281
	    Dependencies := WeakDependencyDictionary new.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   282
	].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   283
	NonWeakDependencies isNil ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   284
	    NonWeakDependencies := IdentityDictionary new.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   285
	].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   286
	SynchronizationSemaphores isNil ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   287
	    SynchronizationSemaphores := WeakIdentityDictionary new.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
   288
	].
356
claus
parents: 348
diff changeset
   289
    ].
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   290
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   291
    "/ initialize InfoPrinting to the VM's infoPrint setting
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   292
    "/ (which can be turned off via a command line argument)
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   293
    InfoPrinting := ObjectMemory infoPrinting.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   294
a27a279701f8 Initial revision
claus
parents:
diff changeset
   295
    "Object initialize"
812
00db9c0646fe notificationsignals are no longer children of ErrorSignal
Claus Gittinger <cg@exept.de>
parents: 783
diff changeset
   296
3101
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   297
    "Modified: / 28.1.1997 / 19:38:58 / stefan"
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
   298
    "Modified: / 22.1.1998 / 21:23:40 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
   299
    "Modified: / 3.2.1998 / 18:55:09 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   300
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   301
3175
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   302
!Object class methodsFor:'ST80 compatibility'!
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   303
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   304
rootError
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   305
    "return the signal used for error/error: - handling.
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   306
     Same as errorSignal for ST80 compatibility."
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   307
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   308
    ^ ErrorSignal
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   309
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   310
    "Created: / 15.1.1998 / 23:47:05 / stefan"
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   311
! !
b0181a625671 #rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents: 3159
diff changeset
   312
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   313
!Object class methodsFor:'Signal constants'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   314
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   315
abortSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   316
    "return the signal used to abort user actions. This signal is only
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
   317
     raised if caught (by the debugger), and will lead way out of the
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   318
     currently active doIt/printIt or inspectIt. (also some others use
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   319
     this for a save abort)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   320
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   321
    ^ AbortSignal
579
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   322
!
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   323
782
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   324
activityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   325
    "return the signal used for activity notifications.
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   326
     A handler for this signal gets all #activityNotification: sends"
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   327
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   328
    ^ ActivityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   329
!
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   330
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   331
deepCopyErrorSignal 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   332
    "return the signal raised when a deepcopy is asked for
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   333
     an object which cannot do this (for example, BlockClosures
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   334
     or Contexts)."
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   335
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   336
    ^ DeepCopyErrorSignal
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   337
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   338
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   339
elementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   340
    "return the signal used for element error reporting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   341
     (this signal is used for example when a value not in 0..255 is to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   342
      be put into a bytearray)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   343
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   344
    ^ ElementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   345
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   346
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   347
errorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   348
    "return the signal used for error/error: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   349
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   350
    ^ ErrorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   351
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   352
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   353
exceptionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   354
    "return the signal used for exception (display errors) error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   355
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   356
    ^ ExceptionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   357
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   358
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   359
haltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   360
    "return the signal used for halt/halt: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   361
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   362
    ^ HaltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   363
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   364
3101
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   365
indexNotFoundSignal
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   366
    "return the signal used for bad index error reporting.
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   367
     This is also the parentSignal of the nonIntegerIndex- and
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   368
     subscriptOutOfBoundsSignal"
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   369
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   370
    ^ IndexNotFoundSignal
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   371
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   372
    "Created: / 8.11.1997 / 19:15:48 / cg"
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   373
!
6bb441e14a95 added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents: 3078
diff changeset
   374
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   375
informationSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   376
    "return the signal used for informations. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   377
     A handler for this signal gets all #information: sends"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   378
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   379
    ^ InformationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   380
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   381
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   382
internalErrorSignal
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   383
    "return the signal used to report internal (VM-) errors."
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   384
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   385
    ^ InternalErrorSignal
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   386
!
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   387
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   388
keyNotFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   389
    "return the signal used for no such key error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   390
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   391
    ^ KeyNotFoundSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   392
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   393
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   394
messageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   395
    "return the signal used for doesNotUnderstand: - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   396
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   397
    ^ MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   398
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   399
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   400
nonIntegerIndexSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   401
    "return the signal used for bad subscript error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   402
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   403
    ^ NonIntegerIndexSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   404
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   405
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   406
notFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   407
    "return the signal used for no element found error reporting"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   408
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   409
    ^ NotFoundSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   410
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   411
3423
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   412
osSignalInterruptSignal 
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   413
    "return the signal used for OS-signal error reporting;
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   414
     This is only raised if handled - otherwise, a debugger is entered."
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   415
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   416
    ^ OSSignalInterruptFoundSignal
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   417
!
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
   418
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   419
primitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   420
    "return the signal used for primitiveFailed - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   421
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   422
    ^ PrimitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   423
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   424
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   425
privateMethodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   426
    "return the signal used for privateMethod - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   427
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   428
    ^ MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   429
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   430
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   431
recursionInterruptSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   432
    "return the signal used for recursion overflow error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   433
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   434
    ^ RecursionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   435
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   436
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   437
subscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   438
    "return the signal used for subscript error reporting.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   439
     (this signal is used for example when an array is accessed with an
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   440
      index less than 1 or greater than the array size)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   441
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   442
    ^ SubscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   443
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   444
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   445
userInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   446
    "return the signal used for ^C interrupts handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   447
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   448
    ^ UserInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   449
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   450
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   451
userNotificationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   452
    "the parent signal used with information and warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   453
     Handling this allows handling of both information- and warning notifications."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   454
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   455
    ^ UserNotificationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   456
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   457
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   458
warningSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   459
    "return the signal used for warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   460
     A handler for this signal gets all #warn: sends"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   461
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   462
    ^ WarningSignal
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   463
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   464
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   465
!Object class methodsFor:'info messages'!
356
claus
parents: 348
diff changeset
   466
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   467
infoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   468
    "return the flag which controls information messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   469
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   470
    ^ InfoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   471
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   472
356
claus
parents: 348
diff changeset
   473
infoPrinting:aBoolean
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   474
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   475
356
claus
parents: 348
diff changeset
   476
    "turn on/off printing of information messages.
claus
parents: 348
diff changeset
   477
     If the argument, aBoolean is false, infoPrint will not output
claus
parents: 348
diff changeset
   478
     messages. The default is true."
claus
parents: 348
diff changeset
   479
claus
parents: 348
diff changeset
   480
    InfoPrinting := aBoolean
claus
parents: 348
diff changeset
   481
! !
claus
parents: 348
diff changeset
   482
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   483
!Object class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   484
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   485
isBuiltInClass
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   486
    "return true, if this class is known by the run-time-system,
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   487
     i.e. you cannot add/remove instance variables without recompiling
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   488
     the VM.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   489
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   490
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   491
    ^ self == Object
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   492
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   493
    "Modified: 23.4.1996 / 16:00:07 / cg"
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   494
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   495
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   496
!Object methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   497
a27a279701f8 Initial revision
claus
parents:
diff changeset
   498
at:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   499
    "return the indexed instance variable with index, anInteger;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   500
     this method can be redefined in subclasses."
a27a279701f8 Initial revision
claus
parents:
diff changeset
   501
a27a279701f8 Initial revision
claus
parents:
diff changeset
   502
    ^ self basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   503
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   504
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   505
at:index put:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   506
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   507
     this method can be redefined in subclasses. Returns anObject (sigh)"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   508
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   509
    ^ self basicAt:index put:anObject
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   510
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   511
    "Modified: 19.4.1996 / 11:13:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   512
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   513
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   514
basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   515
    "return the indexed instance variable with index, anInteger.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   516
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   517
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   518
a27a279701f8 Initial revision
claus
parents:
diff changeset
   519
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   520
329
claus
parents: 325
diff changeset
   521
    REGISTER int nbytes, indx;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   522
    OBJ myClass;
329
claus
parents: 325
diff changeset
   523
    REGISTER char *pFirst;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   524
    unsigned char *cp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   525
    unsigned short *sp;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   526
    short *ssp;
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   527
#ifdef alpha64
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   528
#   define int32        int
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   529
#else
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   530
#   define int32        long
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   531
#endif
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   532
    unsigned int32 *lp;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   533
    int32 *slp;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   534
    unsigned int32 ul;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   535
    int32 l;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   536
    OBJ *op;
329
claus
parents: 325
diff changeset
   537
    REGISTER int n;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   538
a27a279701f8 Initial revision
claus
parents:
diff changeset
   539
    /*
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   540
     * notice the missing test for self being a nonNilObject -
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   541
     * this can be done since basicAt: is defined both in UndefinedObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   542
     * and SmallInteger
a27a279701f8 Initial revision
claus
parents:
diff changeset
   543
     */
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   544
    if (__isSmallInteger(index)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   545
	myClass = __qClass(self);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   546
	indx = __intVal(index) - 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   547
	n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   548
	n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   549
	nbytes = __qSize(self) - n /* nInstBytes */;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   550
	pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   551
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   552
	switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   553
	    case __MASKSMALLINT(POINTERARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   554
	    case __MASKSMALLINT(WKPOINTERARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   555
		/*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   556
		 * pointers
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   557
		 */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   558
		if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   559
		    op = (OBJ *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   560
		    RETURN ( *op );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   561
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   562
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   563
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   564
	    case __MASKSMALLINT(BYTEARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   565
		/*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   566
		 * (unsigned) bytes
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   567
		 */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   568
		if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   569
		    cp = (unsigned char *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   570
		    RETURN ( __MKSMALLINT(*cp & 0xFF) );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   571
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   572
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   573
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   574
	    case __MASKSMALLINT(FLOATARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   575
		/*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   576
		 * native floats
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   577
		 */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   578
		if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   579
		    float *fp;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   580
		    OBJ v;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   581
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   582
		    fp = (float *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   583
		    __qMKSFLOAT(v, *fp);
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   584
		    RETURN (v);
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   585
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   586
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   587
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   588
	    case __MASKSMALLINT(DOUBLEARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   589
		/*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   590
		 * native doubles
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   591
		 */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   592
		if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   593
		    double *dp;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   594
		    OBJ v;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   595
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   596
#ifdef NEED_DOUBLE_ALIGN
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   597
		    /*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   598
		     * care for filler
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   599
		     */
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   600
		    pFirst += sizeof(FILLTYPE);
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   601
#endif
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   602
		    dp = (double *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   603
		    __qMKFLOAT(v, *dp);
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   604
		    RETURN (v);
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   605
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   606
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   607
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   608
	    case __MASKSMALLINT(WORDARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   609
		/*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   610
		 * unsigned 16bit ints
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   611
		 */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   612
		if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   613
		    sp = (unsigned short *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   614
		    RETURN ( __MKSMALLINT(*sp & 0xFFFF) );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   615
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   616
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   617
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   618
	    case __MASKSMALLINT(SWORDARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   619
		/*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   620
		 * signed 16bit ints
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   621
		 */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   622
		if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   623
		    ssp = (short *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   624
		    RETURN ( __MKSMALLINT(*ssp) );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   625
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   626
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   627
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   628
	    case __MASKSMALLINT(LONGARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   629
		/*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   630
		 * unsigned native 32bit ints
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   631
		 */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   632
		if ((indx >= 0) && (indx < (nbytes / sizeof(int32)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   633
		    lp = (unsigned int32 *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   634
		    ul = *lp;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   635
		    if (ul <= _MAX_INT)
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   636
			RETURN ( __MKSMALLINT(ul) );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   637
		    RETURN ( __MKULARGEINT(ul) );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   638
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   639
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   640
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   641
	    case __MASKSMALLINT(SLONGARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   642
		/*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   643
		 * signed native 32bit ints
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   644
		 */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   645
		if ((indx >= 0) && (indx < (nbytes / sizeof(int32)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   646
		    slp = (int32 *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   647
		    l = *slp;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   648
		    if ((l >= _MIN_INT) && (l <= _MAX_INT))
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   649
			RETURN ( __MKSMALLINT(l) );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   650
		    RETURN ( __MKLARGEINT(l) );
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   651
		}
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   652
		break;
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   653
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   654
    }
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   655
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   656
#   undef int32
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   657
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   658
%}.
10
claus
parents: 5
diff changeset
   659
    index isInteger ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   660
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   661
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   662
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   663
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   664
a27a279701f8 Initial revision
claus
parents:
diff changeset
   665
basicAt:index put:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   666
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   667
     Returns anObject (sigh).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   668
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   669
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   670
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   671
a27a279701f8 Initial revision
claus
parents:
diff changeset
   672
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   673
a27a279701f8 Initial revision
claus
parents:
diff changeset
   674
    register int nbytes, indx;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   675
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   676
    register char *pFirst;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   677
    char *cp;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   678
    unsigned short *sp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   679
    short *ssp;
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   680
#ifdef alpha64
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   681
#   define int32        int
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   682
#else
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   683
#   define int32        long
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   684
#endif
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   685
    unsigned int32 *lp;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   686
    int32 *slp;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   687
    OBJ *op;
329
claus
parents: 325
diff changeset
   688
/*    int nInstBytes, ninstvars, flags; */
claus
parents: 325
diff changeset
   689
    REGISTER int n;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   690
    unsigned int u;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   691
    int val;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   692
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   693
    /* notice the missing test for self being a nonNilObject -
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
   694
       this can be done since basicAt: is defined both in UndefinedObject
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   695
       and SmallInteger */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   696
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   697
    if (__isSmallInteger(index)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   698
	indx = __intVal(index) - 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   699
	myClass = __qClass(self);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   700
	n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   701
	n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   702
	nbytes = __qSize(self) - n /* nInstBytes */;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   703
	pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   704
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   705
	switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   706
	    case __MASKSMALLINT(POINTERARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   707
	    case __MASKSMALLINT(WKPOINTERARRAY):
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   708
		if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   709
		    op = (OBJ *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   710
		    *op = anObject;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   711
		    __STORE(self, anObject);
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   712
		    RETURN ( anObject );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   713
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   714
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   715
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   716
	    case __MASKSMALLINT(BYTEARRAY):
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   717
		if (__isSmallInteger(anObject)) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   718
		    val = __intVal(anObject);
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   719
		    if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   720
			if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   721
			    cp = pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   722
			    *cp = val;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   723
			    RETURN ( anObject );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   724
			}
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   725
		    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   726
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   727
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   728
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   729
	    case __MASKSMALLINT(FLOATARRAY):
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   730
		if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   731
		    float *fp;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   732
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   733
		    fp = (float *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   734
		    if (__isFloatLike(anObject)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   735
			*fp = (float)(__floatVal(anObject));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   736
			RETURN ( anObject );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   737
		    }
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   738
		    if (__isSmallInteger(anObject)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   739
			*fp = (float) __intVal(anObject);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   740
			RETURN ( anObject );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   741
		    }
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   742
		    if (__isShortFloat(anObject)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   743
			*fp = __shortFloatVal(anObject);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   744
			RETURN ( anObject );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   745
		    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   746
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   747
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   748
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   749
	    case __MASKSMALLINT(DOUBLEARRAY):
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   750
		if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   751
		    double *dp;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   752
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   753
#ifdef NEED_DOUBLE_ALIGN
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   754
		    /*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   755
		     * care for filler
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   756
		     */
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   757
		    pFirst += sizeof(FILLTYPE);
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   758
#endif
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   759
		    dp = (double *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   760
		    if (__isFloatLike(anObject)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   761
			*dp = __floatVal(anObject);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   762
			RETURN ( anObject );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   763
		    }
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   764
		    if (__isSmallInteger(anObject)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   765
			*dp = (double) __intVal(anObject);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   766
			RETURN ( anObject );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   767
		    }
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   768
		    if (__isShortFloat(anObject)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   769
			*dp = (double)__shortFloatVal(anObject);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   770
			RETURN ( anObject );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   771
		    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   772
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   773
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   774
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   775
	    case __MASKSMALLINT(WORDARRAY):
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   776
		if (__isSmallInteger(anObject)) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   777
		    val = __intVal(anObject);
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   778
		    if ((val >= 0) && (val <= 0xFFFF)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   779
			if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   780
			    sp = (unsigned short *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   781
			    *sp = val;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   782
			    RETURN ( anObject );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   783
			}
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   784
		    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   785
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   786
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   787
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   788
	    case __MASKSMALLINT(SWORDARRAY):
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   789
		if (__isSmallInteger(anObject)) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   790
		    val = __intVal(anObject);
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   791
		    if ((val >= -32768) && (val < 32768)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   792
			if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   793
			    ssp = (short *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   794
			    *ssp = val;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   795
			    RETURN ( anObject );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   796
			}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   797
		    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   798
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   799
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   800
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   801
	    case __MASKSMALLINT(SLONGARRAY):
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   802
		if ((indx >= 0) && (indx < (nbytes / sizeof(int32)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   803
		    slp = (int32 *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   804
		    if (__isSmallInteger(anObject)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   805
			*slp = __intVal(anObject);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   806
			RETURN ( anObject );
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   807
		    }
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   808
		    n = __signedLongIntVal(anObject);
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   809
		    /*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   810
		     * zero means failure for an int larger than 4 bytes 
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   811
		     * (would be a smallInteger) 
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   812
		     */
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   813
		    if (n) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   814
			*slp = n;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   815
			RETURN ( anObject );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   816
		    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   817
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   818
		break;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   819
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   820
	    case __MASKSMALLINT(LONGARRAY):
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   821
		if ((indx >= 0) && (indx < (nbytes / sizeof(int32)))) {
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   822
		    lp = (unsigned int32 *)pFirst + indx;
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   823
		    if (anObject == __MKSMALLINT(0)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   824
			*lp = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   825
			RETURN ( anObject );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   826
		    }
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   827
		    u = __longIntVal(anObject);
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   828
		    /*
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   829
		     * zero means failure for an int larger than 4 bytes
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   830
		     * (would be a smallInteger)
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   831
		     */
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   832
		    if (u) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   833
			*lp = u;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   834
			RETURN ( anObject );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   835
		    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
   836
		}
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   837
		break;
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   838
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   839
    }
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   840
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   841
#   undef int32
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   842
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   843
%}.
10
claus
parents: 5
diff changeset
   844
    index isInteger ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   845
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   846
	 the index should be an integer number
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   847
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   848
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   849
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   850
    (index between:1 and:self size) ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   851
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   852
	 the index is less than 1 or greater than the size of the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   853
	 receiver collection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   854
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   855
	^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   856
    ].
643
04b2025af0e3 use new isFLoatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   857
    (self class isFloatsOrDoubles) ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   858
	anObject isNumber ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   859
	    ^ self basicAt:index put:(anObject asFloat)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   860
	]
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   861
    ].
10
claus
parents: 5
diff changeset
   862
    anObject isInteger ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   863
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   864
	 the object to put into the receiver collection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   865
	 should be an integer number
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   866
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   867
	^ self elementNotInteger
2
claus
parents: 1
diff changeset
   868
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   869
    "
213
3b56a17534fd *** empty log message ***
claus
parents: 202
diff changeset
   870
     the object to put into the receiver collection
362
claus
parents: 359
diff changeset
   871
     is not an instance of the expected element class,
claus
parents: 359
diff changeset
   872
     or the value is  not within the elements valid range.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   873
    "
2
claus
parents: 1
diff changeset
   874
    ^ self elementBoundsError
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   875
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   876
    "Modified: 19.4.1996 / 11:14:10 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   877
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   878
2574
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   879
byteAt:index
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   880
    "return the byte at index. 
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   881
     This is only allowed for non-pointer indexed objects
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   882
     (i.e. byteArrays, wordArrays, floatArrays etc.).
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   883
     The receivers indexed instvars are treated as an uninterpreted
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   884
     collection of bytes.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   885
     Only useful with binary storage."
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   886
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   887
%{  /* NOCONTEXT */
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   888
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   889
    REGISTER int indx;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   890
    int nIndex;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   891
    REGISTER OBJ slf;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   892
    REGISTER OBJ cls;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   893
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   894
    if (__isSmallInteger(index)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   895
	slf = self;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   896
	if (__isNonNilObject(slf)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   897
	    cls = __qClass(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   898
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   899
	    switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   900
		case __MASKSMALLINT(BYTEARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   901
		case __MASKSMALLINT(WORDARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   902
		case __MASKSMALLINT(LONGARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   903
		case __MASKSMALLINT(SWORDARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   904
		case __MASKSMALLINT(SLONGARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   905
		case __MASKSMALLINT(FLOATARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   906
		case __MASKSMALLINT(DOUBLEARRAY):
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   907
		    indx = __intVal(index) - 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   908
		    indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   909
		    nIndex = __byteArraySize(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   910
		    if ((unsigned)indx < (unsigned)nIndex) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   911
			RETURN ( __MKSMALLINT(__ByteArrayInstPtr(slf)->ba_element[indx]) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   912
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   913
		    break;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   914
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   915
	}
2574
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   916
    }
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   917
%}.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   918
    "/ index not integer or index out of range
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   919
    "/ or non-byte indexable receiver
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   920
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   921
    ^ self primitiveFailed
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   922
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   923
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   924
     Point new byteAt:1
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   925
     (ByteArray with:1 with:2) byteAt:2
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   926
     (WordArray with:1) byteAt:1       
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   927
     (FloatArray with:1.0) byteAt:2 
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   928
     'hello' byteAt:1               
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   929
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   930
!
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   931
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   932
byteAt:index put:byteValue
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   933
    "set the byte at index. 
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   934
     This is only allowed for non-pointer indexed objects
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   935
     (i.e. byteArrays, wordArrays, floatArrays etc.).
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   936
     The receivers indexed instvars are treated as an uninterpreted
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   937
     collection of bytes.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   938
     Only useful with binary storage."
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   939
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   940
%{  /* NOCONTEXT */
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   941
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   942
    REGISTER int indx;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   943
    int val, nIndex;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   944
    REGISTER OBJ slf;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   945
    REGISTER OBJ cls;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   946
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   947
    if (__bothSmallInteger(index, byteValue)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   948
	val = __intVal(byteValue);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   949
	if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   950
	    slf = self;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   951
	    if (__isNonNilObject(slf)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   952
		cls = __qClass(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   953
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   954
		switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   955
		    case __MASKSMALLINT(BYTEARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   956
		    case __MASKSMALLINT(WORDARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   957
		    case __MASKSMALLINT(LONGARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   958
		    case __MASKSMALLINT(SWORDARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   959
		    case __MASKSMALLINT(SLONGARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   960
		    case __MASKSMALLINT(FLOATARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   961
		    case __MASKSMALLINT(DOUBLEARRAY):
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   962
			indx = __intVal(index) - 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   963
			indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   964
			nIndex = __byteArraySize(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   965
			if ((unsigned)indx < (unsigned)nIndex) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   966
			    __ByteArrayInstPtr(slf)->ba_element[indx] = val;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   967
			    RETURN ( byteValue );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   968
			}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   969
			break;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   970
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   971
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   972
	}
2574
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   973
    }
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   974
%}.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   975
    "/ index not integer or index out of range
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   976
    "/ or non-byte indexable receiver
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   977
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   978
    ^ self primitiveFailed
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   979
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   980
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   981
     (ByteArray with:1 with:2) byteAt:2 put:3; yourself
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   982
     'hello' copy byteAt:1 put:105; yourself              
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   983
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   984
!
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   985
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   986
instVarAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   987
    "return a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   988
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   989
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   990
a27a279701f8 Initial revision
claus
parents:
diff changeset
   991
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   992
a27a279701f8 Initial revision
claus
parents:
diff changeset
   993
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   994
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   995
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   996
    if (__isSmallInteger(index)) {
329
claus
parents: 325
diff changeset
   997
	myClass = __Class(self);
755
eaab1d1dacbd _-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents: 751
diff changeset
   998
	idx = __intVal(index) - 1;
357
claus
parents: 356
diff changeset
   999
	/*
claus
parents: 356
diff changeset
  1000
	 * do not allow return of non-object fields.
claus
parents: 356
diff changeset
  1001
	 * if subclass did not make privisions for that,
claus
parents: 356
diff changeset
  1002
	 * we wont do so here ...
claus
parents: 356
diff changeset
  1003
	 */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
  1004
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
357
claus
parents: 356
diff changeset
  1005
	    if (idx == 0) {
claus
parents: 356
diff changeset
  1006
		RETURN ( nil )
claus
parents: 356
diff changeset
  1007
	    }
claus
parents: 356
diff changeset
  1008
	}
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1009
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1010
	if ((idx >= 0) && (idx < ninstvars)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1011
	    RETURN ( __InstPtr(self)->i_instvars[idx] );
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1012
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1013
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1014
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1015
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1016
    index isInteger ifFalse:[
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1017
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1018
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1019
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1020
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1021
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1022
instVarAt:index put:value
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1023
    "change a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  1024
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  1025
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1026
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1027
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1028
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1029
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1030
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1031
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
  1032
    if (__isSmallInteger(index)) {
329
claus
parents: 325
diff changeset
  1033
	myClass = __Class(self);
755
eaab1d1dacbd _-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents: 751
diff changeset
  1034
	idx = __intVal(index) - 1;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1035
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
357
claus
parents: 356
diff changeset
  1036
	/*
claus
parents: 356
diff changeset
  1037
	 * do not allow setting of non-object fields.
claus
parents: 356
diff changeset
  1038
	 * if subclass did not make privisions for that,
claus
parents: 356
diff changeset
  1039
	 * we wont do so here ...
claus
parents: 356
diff changeset
  1040
	 */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
  1041
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
357
claus
parents: 356
diff changeset
  1042
	    if (idx == 0) {
claus
parents: 356
diff changeset
  1043
		RETURN ( nil )
claus
parents: 356
diff changeset
  1044
	    }
claus
parents: 356
diff changeset
  1045
	}
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1046
	if ((idx >= 0) && (idx < ninstvars)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  1047
	    __InstPtr(self)->i_instvars[idx] = value;
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1048
	    __STORE(self, value);
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1049
	    RETURN ( value );
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1050
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1051
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1052
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1053
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1054
    index isInteger ifFalse:[
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1055
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1056
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1057
    ^ self subscriptBoundsError:index
359
claus
parents: 357
diff changeset
  1058
!
claus
parents: 357
diff changeset
  1059
claus
parents: 357
diff changeset
  1060
instVarNamed:name 
claus
parents: 357
diff changeset
  1061
    "return a non-indexed instance variables value by name;
claus
parents: 357
diff changeset
  1062
     peeking into an object this way is not very object oriented 
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1063
     - use with care if at all (provided for inspectors and memory usage monitor).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1064
     Notice, this access is very slow (because the classes instVar-description has to be
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1065
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
  1066
claus
parents: 357
diff changeset
  1067
    ^ self instVarAt:(self class instVarOffsetOf:name)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1068
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1069
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1070
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1071
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1072
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1073
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1074
     p instVarNamed:'x'  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1075
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1076
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1077
    "Modified: 19.4.1996 / 11:12:39 / cg"
359
claus
parents: 357
diff changeset
  1078
!
claus
parents: 357
diff changeset
  1079
1528
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1080
instVarNamed:name ifAbsent:exceptionBlock
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1081
    "return a non-indexed instance variables value by name,
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1082
     or the value of exceptionBlock, if there is no such instance variable.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1083
     peeking into an object this way is not very object oriented 
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1084
     - use with care if at all (provided for inspectors and memory usage monitor).
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1085
     Notice, this access is very slow (because the classes instVar-description has to be
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1086
     parsed ad runtime)"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1087
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1088
    |idx|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1089
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1090
    idx := self class instVarOffsetOf:name.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1091
    idx isNil ifTrue:[^ exceptionBlock value].
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1092
    ^ self instVarAt:idx
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1093
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1094
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1095
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1096
     |p|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1097
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1098
     p := Point x:10 y:20.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1099
     p instVarNamed:'x'  
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1100
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1101
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1102
    "Created: 6.7.1996 / 23:02:49 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1103
    "Modified: 6.7.1996 / 23:03:41 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1104
!
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
  1105
359
claus
parents: 357
diff changeset
  1106
instVarNamed:name put:value
claus
parents: 357
diff changeset
  1107
    "set a non-indexed instance variable by name;
claus
parents: 357
diff changeset
  1108
     peeking into an object this way is not very object oriented 
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1109
     - if at all, use with care (provided for protocol completeness).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1110
     Notice, this access is very slow (because the classes instVar-description has to be
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1111
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
  1112
claus
parents: 357
diff changeset
  1113
    ^ self instVarAt:(self class instVarOffsetOf:name) put:value
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1114
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1115
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1116
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1117
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1118
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1119
     p instVarNamed:'x' put:30.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1120
     p  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1121
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1122
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  1123
    "Modified: 19.4.1996 / 11:12:49 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1124
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1125
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1126
!Object methodsFor:'attributes access'!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1127
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1128
objectAttributeAt:key 
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1129
    "return the attribute for a given key or nil if not found"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1130
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1131
    | attrs |
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1132
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1133
    attrs := self objectAttributes.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1134
    (attrs notNil and:[attrs size > 0]) ifTrue:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1135
	^ attrs at:key ifAbsent:[]
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1136
    ].
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1137
    ^ nil
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1138
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1139
    "Created: / 22.1.1998 / 21:29:17 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1140
    "Modified: / 3.2.1998 / 18:55:55 / cg"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1141
!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1142
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1143
objectAttributeAt:key put:anObject
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1144
    "store the attribute anObject referenced by key into the receiver"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1145
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1146
    |wasBlocked|
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1147
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1148
    "/ must do this save from interrupts, since the attributes collection
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1149
    "/ is possibly accessed from multiple threads ...
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1150
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1151
    wasBlocked := OperatingSystem blockInterrupts.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1152
    [
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1153
	| attrs |
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1154
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1155
	attrs := self objectAttributes.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1156
	(attrs isNil or:[attrs size == 0]) ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1157
	    attrs := WeakIdentityDictionary new.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1158
	    attrs at:key put:anObject.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1159
	    self objectAttributes:attrs.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1160
	] ifFalse:[ 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1161
	    attrs at:key put:anObject.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1162
	].
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1163
    ] valueNowOrOnUnwindDo:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1164
	wasBlocked ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1165
	    OperatingSystem unblockInterrupts
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1166
	]
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1167
    ]
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1168
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1169
    "Attaching additional attributes (slots) to an arbitrary object:
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1170
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1171
     |p|
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1172
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1173
     p := Point new.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1174
     p objectAttributeAt:#color put:#green.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1175
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1176
     p objectAttributeAt:#color
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1177
    "
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1178
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1179
    "Created: / 22.1.1998 / 21:29:25 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1180
    "Modified: / 3.2.1998 / 18:57:58 / cg"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1181
!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1182
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1183
objectAttributes
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1184
    "return a Collection of attributes - nil if there is none.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1185
     The default implementation here uses a global WeakDictionary to store
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1186
     attributes
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1187
     This may be too slow for high frequency slot access,
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1188
     therefore, some classes may redefine this for better performance.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1189
     Notice the mentioning of a WeakDictionary - read the classes documentation."
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1190
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1191
    ^ ObjectAttributes at:self ifAbsent:[#()]
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1192
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1193
    "Created: / 22.1.1998 / 21:29:30 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1194
    "Modified: / 3.2.1998 / 18:58:31 / cg"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1195
!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1196
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1197
objectAttributes:aCollection
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1198
    "set the collection of attributes.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1199
     The default implementation here uses a global Dictionary to store
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1200
     attributes which may be too slow for high frequency change&update.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1201
     Therefore, some classes may redefine this for better performance."
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1202
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1203
    "/ must do this save from interrupts, since the attributes collection
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1204
    "/ is possibly accessed from multiple threads.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1205
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1206
    (OperatingSystem blockInterrupts) ifTrue:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1207
	"/ the common case - already blocked
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1208
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1209
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1210
	    ObjectAttributes removeKey:self ifAbsent:[]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1211
	] ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1212
	    ObjectAttributes at:self put:aCollection
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1213
	].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1214
	^ self
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1215
    ].
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1216
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1217
    [
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1218
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1219
	    ObjectAttributes removeKey:self ifAbsent:[]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1220
	] ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1221
	    ObjectAttributes at:self put:aCollection
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1222
	].
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1223
    ] valueNowOrOnUnwindDo:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1224
	OperatingSystem unblockInterrupts
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1225
    ]
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1226
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1227
    "Created: / 22.1.1998 / 21:29:35 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1228
    "Modified: / 3.2.1998 / 18:58:10 / cg"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1229
!
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1230
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1231
removeObjectAttribute:anObject
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1232
    "make the argument, anObject be no attribute of the receiver"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1233
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1234
    |wasBlocked|
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1235
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1236
    "/ must do this save from interrupts, since the attributes collection
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1237
    "/ is possibly accessed from multiple threads.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1238
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1239
    wasBlocked := OperatingSystem blockInterrupts.
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1240
    [
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1241
	|attrs n a|
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1242
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1243
	attrs := self objectAttributes.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1244
	attrs notNil ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1245
	    attrs remove:anObject ifAbsent:[].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1246
	    attrs size == 0 ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1247
		self objectAttributes:nil
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1248
	    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1249
	]
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1250
    ] valueNowOrOnUnwindDo:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1251
	wasBlocked ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1252
	    OperatingSystem unblockInterrupts
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1253
	]
3268
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1254
    ]
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1255
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1256
    "Created: / 22.1.1998 / 21:29:39 / av"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1257
    "Modified: / 3.2.1998 / 18:58:13 / cg"
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1258
! !
0974cb253cad incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents: 3259
diff changeset
  1259
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1260
!Object methodsFor:'binary storage'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1261
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1262
hasSpecialBinaryRepresentation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1263
    "return true, if the receiver has a special binary representation;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1264
     default here is false, but can be redefined in class which provide
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1265
     their own storeBinary/readBinary methods.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1266
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1267
     Normal user classes should not use this, it is meant as a hook for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1268
     special classes such as True, False, UndefinedObject or SmallInteger.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1269
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1270
     If your instances should be stored in a special way, see
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1271
     #representBinaryOn: and #readBinaryContentsFromdata:manager:."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1272
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1273
    ^ false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1274
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1275
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1276
readBinaryContentsFrom:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1277
    "reconstruct the receivers instance variables by reading a binary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1278
     binary representation from stream. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1279
     This is a general implementation, walking over instances 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1280
     and loading each recursively using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1281
     Redefined by some classes to read a more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1282
     (see String, SmallInteger etc).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1283
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1284
     Notice, that the object is already recreated as an empty corps
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1285
     with instance variables all nil and bit-instances (bytes, words etc.) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1286
     already read and restored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1287
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1288
     Also notice: this method is not called for if a private representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1289
     has been stored (see representBinaryOn:). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1290
     In that case, #readBinaryContentsFromData:manager: is called, which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1291
     has to be reimplemented in the objects class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1292
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1293
    |size "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1294
     instvarArray|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1295
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1296
    stream next == 1 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1297
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1298
	"/ special representation ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1299
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1300
	instvarArray := Array new:(size := stream nextNumber:3).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1301
	1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1302
	    instvarArray basicAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1303
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1304
	self readBinaryContentsFromData:instvarArray manager:manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1305
	^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1306
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1307
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1308
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1309
    "/ standard representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1310
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1311
    size := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1312
    size ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1313
	self class isPointers ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1314
	    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1315
		self basicAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1316
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1317
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1318
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1319
    size := self class instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1320
    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1321
	self instVarAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1322
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1323
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1324
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1325
readBinaryContentsFromData:instvarArray manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1326
    "reconstruct the receivers instance variables by filling instance
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1327
     variables with values from instvarArray. This array contains the instvars
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1328
     as specified in #representBinaryOn: when the object was stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1329
     It is the receivers responsibility to set its instance variables in the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1330
     same order from that array."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1331
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1332
    ^ self subclassResponsibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1333
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1334
    "typical implementation (see also comment in #representBinaryOn:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1335
     (for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1336
      which did not store baz and wants baz to be reinitialized to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1337
      some constant string)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1338
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1339
	foo := instvarArray at:1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1340
	bar := instvarArray at:2.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1341
	baz := 'aConstant'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1342
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1343
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1344
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1345
representBinaryOn:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1346
    "this method is called by the storage manager to ask objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1347
     if they wish to provide their own binary representation.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1348
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1349
     If they want to do so, they should return an array containing all
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1350
     instance variables (named & indexed pointer) to be stored. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1351
     If not redefined, this method returns nil which means that all 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1352
     instance variables are to be stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1353
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1354
     It should be redefined in objects which do not want all instance variables
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1355
     to be stored (for example: objects which keep references to a view etc.).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1356
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1357
     If this is redefined returning non-nil, the corresponding class needs
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1358
     a redefined instance method named #readBinaryContentsFromData:manager:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1359
     which has to fill the receivers named (and optionally indexed pointer)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1360
     instance variables with corresponding values from a data array."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1361
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1362
    ^ nil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1363
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1364
    "typical implementation:  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1365
     (see also comment in #readBinaryContentsFromData:manager:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1366
     for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1367
     which does not want to store baz:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1368
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1369
     representBinaryOn:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1370
	|data|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1371
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1372
	data := Array new:2.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1373
	data at:1 put:foo.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1374
	data at:2 put:bar.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1375
	^ data
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1376
    "
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1377
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1378
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1379
storeBinaryDefinitionBodyOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1380
    "append a binary representation of the receivers body onto stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1381
     This is a general implementation walking over instances storing
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1382
     each recursively as an ID using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1383
     Can be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1384
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1385
    |basicSize    "{ Class: SmallInteger }"
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1386
     instSize     "{ Class: SmallInteger }"
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1387
     specialSize  "{ Class: SmallInteger }"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1388
     myClass specialRep pointers|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1389
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1390
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1391
    instSize := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1392
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1393
    (pointers := myClass isPointers) ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1394
	"/
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1395
	"/ inst size not needed - if you uncomment the line below,
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1396
	"/ also uncomment the corresponding line in
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1397
	"/ Object>>binaryDefinitionFrom:manager:
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1398
	"/
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1399
	"/ stream nextPut:instSize. "mhmh this limits us to 255 named instvars"
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1400
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1401
	myClass isVariable ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1402
	    stream nextNumber:3 put:(basicSize := self basicSize)
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1403
	] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1404
	    basicSize := 0
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1405
	].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1406
    ] ifFalse: [
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1407
	stream nextNumber:4 put:(basicSize := self basicSize).
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1408
	myClass isBytes ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1409
	    1 to:basicSize do:[:i |
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1410
		stream nextPut:(self basicAt:i)
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1411
	    ]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1412
	] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1413
	    myClass isWords ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1414
		1 to:basicSize do:[:i |
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1415
		    stream nextNumber:2 put:(self basicAt: i)
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1416
		]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1417
	    ] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1418
		myClass isLongs ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1419
		    1 to:basicSize do:[:i |
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1420
			stream nextNumber:4 put:(self basicAt: i)
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1421
		    ]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1422
		] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1423
		    myClass isFloats ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1424
			"could do it in one big write on machines which use IEEE floats ..."
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1425
			1 to:basicSize do:[:i |
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1426
			    Float storeBinaryIEEESingle:(self basicAt:i) on:stream
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1427
			]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1428
		    ] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1429
			myClass isDoubles ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1430
			    "could do it in one big write on machines which use IEEE doubles ..."
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1431
			    1 to:basicSize do:[:i |
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1432
				Float storeBinaryIEEEDouble:(self basicAt:i) on:stream
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1433
			    ]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1434
			] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1435
			    "/ should never be reached ...
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1436
			    1 to:basicSize do:[:i |
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1437
				manager putIdOf:(self basicAt:i) on:stream
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1438
			    ]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1439
			]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1440
		    ]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1441
		]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1442
	    ]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1443
	].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1444
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1445
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1446
    (pointers or:[instSize ~~ 0]) ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1447
	specialRep := self representBinaryOn:manager.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1448
	specialRep notNil ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1449
	    specialSize := specialRep basicSize.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1450
	    stream nextPut:1.     "/ means: private representation follows
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1451
	    stream nextNumber:3 put:specialSize.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1452
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1453
	    1 to:specialSize do:[:i |
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1454
		manager putIdOf:(specialRep at:i) on:stream
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1455
	    ].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1456
	] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1457
	    stream nextPut:0.     "/ means: normal representation follows
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1458
				  "/ index pointers followed by named instanceVars
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1459
	    pointers ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1460
		basicSize ~~ 0 ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1461
		    1 to:basicSize do:[:i |
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1462
			manager putIdOf:(self basicAt:i) on:stream
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1463
		    ].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1464
		].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1465
	    ].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1466
	    instSize ~~ 0 ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1467
		1 to:instSize do:[:i |
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1468
		    manager putIdOf:(self instVarAt:i) on:stream
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1469
		]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1470
	    ].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1471
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1472
    ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1473
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1474
    "Modified: / 2.11.1997 / 14:43:29 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1475
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1476
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1477
storeBinaryDefinitionOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1478
    "append a binary representation of the receiver onto stream.
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1479
     This is an internal interface for binary storage mechanism.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1480
     This method first stores the class, then the body, which is done
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1481
     in a separate method to allow redefinition of the bodies format.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1482
     Can be redefined in subclasses to write more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1483
     (see String, SmallInteger etc)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1484
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1485
    manager putIdOfClass:(self class) on:stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1486
    self storeBinaryDefinitionBodyOn:stream manager:manager
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1487
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1488
    "Modified: 23.4.1996 / 09:31:12 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1489
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1490
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1491
storeBinaryOn:aStreamOrFilename
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1492
    "Writes a description of the receiver onto aStreamOrFilename, in a way that allows
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1493
     the object's structure to be reconstructed from the stream's contents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1494
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1495
    BinaryOutputManager store:self on:aStreamOrFilename
899
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1496
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1497
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1498
     |a s1 s2|
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1499
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1500
     s1 := 'hello'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1501
     s2 := 'world'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1502
     a := Array new:5.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1503
     a at:1 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1504
     a at:2 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1505
     a at:3 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1506
     a at:4 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1507
     a storeBinaryOn:'test.boss'
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1508
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1509
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1510
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1511
     (BinaryObjectStorage onOld:'test.boss' asFilename readStream)
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1512
	next
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1513
	    inspect
899
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1514
    "
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1515
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  1516
    "Modified: / 1.11.1997 / 21:16:24 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1517
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1518
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1519
storeBinaryOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1520
    "append a binary representation of the receiver onto stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1521
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1522
    manager putIdOf:self on:stream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1523
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1524
1826
aa574220fff4 category rename
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
  1525
!Object methodsFor:'change & update'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1526
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1527
broadcast:aSelectorSymbol
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1528
    "send a message with selector aSelectorSymbol to all my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1529
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1530
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1531
	dependent perform:aSelectorSymbol
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1532
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1533
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1534
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1535
broadcast:aSelectorSymbol with:anArgument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1536
    "send a message with selector aSelectorSymbol with an additional
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1537
     argument anArgument to all my dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1538
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1539
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1540
	dependent perform:aSelectorSymbol with:anArgument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1541
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1542
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1543
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1544
changeRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1545
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1546
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1547
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1548
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1549
	dependent updateRequest ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1550
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1551
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1552
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1553
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1554
changeRequest:aParameter
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1555
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1556
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1557
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1558
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1559
	(dependent updateRequest:aParameter) ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1560
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1561
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1562
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1563
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1564
changeRequest:aParameter from:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1565
    "the receiver wants to change - check if all dependents
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1566
     except anObject grant the request, and return true if so.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1567
     The argument anObject is typically going to be the one who is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1568
     about to send the change request."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1569
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1570
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1571
	dependent == anObject ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1572
	    (dependent updateRequest:aParameter) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1573
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1574
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1575
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1576
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1577
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1578
changeRequestFrom:anObject
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1579
    "the receiver wants to change - check if all dependents
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1580
     except anObject grant the request, and return true if so.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1581
     The argument anObject is typically going to be the one who is
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1582
     about to send the change request."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1583
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1584
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1585
	dependent == anObject ifFalse:[
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1586
	    (dependent updateRequest) ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1587
	]
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1588
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1589
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1590
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1591
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1592
changed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1593
    "notify all dependents that the receiver has changed.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1594
     Each dependent gets a '#update:'-message with the original
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1595
     receiver as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1596
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1597
    self changed:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1598
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1599
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1600
changed:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1601
    "notify all dependents that the receiver has changed somehow.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1602
     Each dependent gets a '#update:'-message with aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1603
     as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1604
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1605
    self changed:aParameter with:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1606
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1607
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1608
changed:aParameter with:anArgument
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1609
    "notify all dependents that the receiver has changed somehow.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1610
     Each dependent gets a  '#update:with:from:'-message, with aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1611
     and anArgument as arguments."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1612
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1613
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1614
	dependent update:aParameter with:anArgument from:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1615
    ]
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1616
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1617
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1618
update:aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1619
    "the message is sent to a dependent, when one of the objects
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1620
     on whom the receiver depends, has changed. The argument aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1621
     is either the changed object or the argument to the #changed: message.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1622
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1623
     Default behavior here is to do nothing"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1624
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1625
    ^ self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1626
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1627
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1628
update:aParameter with:anArgument
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1629
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1630
     Default is to try update:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1631
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1632
    ^ self update:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1633
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1634
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1635
update:aParameter with:anArgument from:sender
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1636
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1637
     Default is to try update:with:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1638
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1639
    ^ self update:aParameter with:anArgument
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1640
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1641
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1642
updateRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1643
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1644
     Default here is to grant updates - may be used
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1645
     to lock updates if someone is making other changes
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1646
     from within an update. Or if someone has locked its
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1647
     state and does not want others to change things.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1648
     However, these dependents must all honor the
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1649
     changeRequest - ifTrue - change protocol. I.e. they
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1650
     must first ask all others via changeRequest, and only do the change
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1651
     it returns true. The others must decide in updateRequest and
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1652
     return true if they think a change is ok."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1653
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1654
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1655
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1656
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1657
updateRequest:aSymbol
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1658
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1659
     Default here a simple updateRequest"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1660
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1661
    ^ self updateRequest
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1662
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1663
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1664
!Object methodsFor:'cleanup'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1665
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1666
lowSpaceCleanup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1667
    "ignored here - redefined in some classes to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1668
     cleanup in low-memory situations"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1669
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1670
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1671
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1672
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1673
!Object methodsFor:'comparing'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1674
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1675
= anObject
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1676
    "return true, if the receiver and the arg have the same structure.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1677
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1678
	This method is partially open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1679
	identical objects are always considered equal.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1680
	redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1681
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1682
    ^ self == anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1683
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1684
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1685
== anObject
2505
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1686
    "return true, if the receiver and the arg are the same object.
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1687
     Never redefine this in any class.
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1688
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1689
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1690
	- redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1691
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1692
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1693
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1694
    RETURN ( (self == anObject) ? true : false );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1695
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1696
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1697
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1698
hash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1699
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1700
     This hash should return same values for objects with same
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1701
     contents (i.e. use this to hash on structure)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1702
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1703
    ^ self identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1704
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1705
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1706
identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1707
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1708
     This hash should return same values for the same object (i.e. use
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1709
     this to hash on identity of objects).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1710
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1711
     We cannot use the Objects address (as other smalltalks do) since
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1712
     no object-table exists and the hashval must not change when objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1713
     are moved by the collector. Therefore we assign each object a unique
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1714
     Id in the object header itself as its hashed upon.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1715
     (luckily we have 11 bits spare to do this - unluckily its only 11 bits).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1716
     Time will show, if 11 bits are enough; if not, another entry in the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1717
     object header will be needed, adding 4 bytes to every object. Alternatively,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1718
     hashed-upon objects could add an instvar containing the hash value."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1719
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1720
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1721
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1722
    REGISTER unsigned hash;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1723
    static unsigned nextHash = 0;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1724
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1725
    if (__isNonNilObject(self)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1726
	hash = __GET_HASH(self);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1727
	if (hash == 0) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1728
	    /* has no hash yet */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1729
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1730
	    if (++nextHash > __MAX_HASH__) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1731
		nextHash = 1;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1732
	    }
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1733
	    hash = nextHash;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1734
	    __SET_HASH(self, hash);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1735
	}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1736
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1737
	/*
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1738
	 * now, we got 11 bits for hashing;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1739
	 * make it as large as possible; since most hashers use the returned
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1740
	 * key and take it modulo some prime number, this will allow for
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1741
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1742
	 */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1743
	hash = __MAKE_HASH__(hash);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1744
	RETURN ( __MKSMALLINT(hash) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1745
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1746
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1747
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1748
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1749
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1750
identityHashForBinaryStore
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1751
    "hash which is usable if the object does not change its class
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1752
     and does not #become something else, while the hash is used.
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1753
     This is only used by the binary storage mechanism, during the
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1754
     object writing phase."
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1755
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1756
%{  /* NOCONTEXT */
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1757
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1758
    REGISTER unsigned hash, hash1, hash2, sz;
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1759
    OBJ o;
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1760
    static unsigned nextHash = 0;
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1761
    static unsigned nextClassHash = 0;
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1762
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1763
    if (__isNonNilObject(self)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1764
	/*
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1765
	 * my own identityHash
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1766
	 */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1767
	hash1 = __GET_HASH(self);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1768
	if (hash1 == 0) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1769
	    /* has no hash yet */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1770
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1771
	    if (++nextHash > __MAX_HASH__) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1772
		nextHash = 1;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1773
	    }
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1774
	    hash1 = nextHash;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1775
	    __SET_HASH(self, hash1);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1776
	}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1777
	/*
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1778
	 * my classes identityHash
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1779
	 */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1780
	o = __qClass(self);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1781
	hash2 = __GET_HASH(o);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1782
	if (hash2 == 0) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1783
	    /* has no hash yet */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1784
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1785
	    if (++nextClassHash > __MAX_HASH__) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1786
		nextClassHash = 1;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1787
	    }
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1788
	    hash2 = nextClassHash;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1789
	    __SET_HASH(o, hash2);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1790
	}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1791
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1792
	/*
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1793
	 * some bits of my size
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1794
	 */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1795
	sz = __qSize(self);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1796
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1797
	/*
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1798
	 * now, we got 11 + 11 + 8 bits for hashing;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1799
	 * make it as large as possible; since most hashers use the returned
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1800
	 * key and take it modulo some prime number, this will allow for
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1801
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1802
	 */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1803
	hash = (hash1 << 11) | hash2;           /* 22 bits */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1804
	hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1805
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1806
	while ((hash & 0x20000000) == 0) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1807
	    hash <<= 1;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1808
	}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1809
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  1810
	RETURN ( __MKSMALLINT(hash) );
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1811
    }
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1812
%}.
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1813
    ^ nil "never reached, since UndefinedObject and SmallInteger are not hashed upon in binary storage"
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1814
!
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1815
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1816
isNil
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1817
    "return true, if the receiver is nil.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1818
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1819
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1820
	- redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1821
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1822
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1823
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1824
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1825
notNil
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1826
    "return true, if the receiver is not nil.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1827
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1828
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1829
	- redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1830
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1831
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1832
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1833
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1834
sameContentsAs:anObject
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1835
    "return true, if the receiver and the arg have the same contents
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1836
     in both the named instance vars and any indexed instVars."
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1837
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1838
    |myClass otherClass
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1839
     sz "{ Class: SmallInteger }" |
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1840
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1841
    myClass := self class.
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1842
    myClass isVariable ifTrue:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1843
	sz := self basicSize.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1844
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1845
	"compare the indexed variables"
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1846
	1 to:sz do:[:i | 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1847
	    (self basicAt:i) ~~ (anObject basicAt:i) ifTrue:[^ false].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1848
	]
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1849
    ].
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1850
3385
31a7cbc6cf32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  1851
    "compare the instance variables"
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1852
    sz := myClass instSize.
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1853
    1 to:sz do:[:i | 
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  1854
	(self instVarAt:i) ~~ (anObject instVarAt:i) ifTrue:[^ false].
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1855
    ].
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1856
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1857
    ^ true
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1858
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1859
    "
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1860
     #(1 2 3 4) sameContentsAsIn:#[1 2 3 4] asArray 
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1861
     (1@2) sameContentsAsIn:(1->2)
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1862
    "
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1863
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1864
    "Created: / 21.4.1998 / 15:56:40 / cg"
3385
31a7cbc6cf32 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3384
diff changeset
  1865
    "Modified: / 21.4.1998 / 15:58:15 / cg"
3384
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1866
!
b0f2f2aca95f added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents: 3380
diff changeset
  1867
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1868
~= anObject
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1869
    "return true, if the receiver and the arg do not have the same structure.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1870
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1871
	This method is partially open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1872
	identical objects are never considered unequal.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1873
	redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1874
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1875
    ^ (self = anObject) not
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1876
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1877
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1878
~~ anObject
2505
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1879
    "return true, if the receiver and the arg are not the same object.
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1880
     Never redefine this in any class.
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1881
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1882
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  1883
	- redefining it may not work as expected."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1884
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1885
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1886
    RETURN ( (self == anObject) ? false : true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1887
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1888
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1889
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1890
!Object methodsFor:'converting'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1891
3007
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  1892
-> anObject
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  1893
    "return an association with the receiver as key and
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  1894
     the argument as value"
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  1895
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  1896
    ^ Association key:self value:anObject
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  1897
!
8d3e37e159c0 category change
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
  1898
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1899
asValue
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1900
    "return a valueHolder for for the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1901
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1902
    ^ ValueHolder with:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1903
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1904
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1905
!Object methodsFor:'copying'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1906
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1907
copy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1908
    "return a copy of the receiver - defaults to shallowcopy here.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1909
     Notice, that copy does not copy dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1910
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1911
    ^ self shallowCopy postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1912
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1913
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1914
deepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1915
    "return a copy of the object with all subobjects also copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1916
     This method DOES handle cycles/self-refs; however the receivers
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1917
     class is not copied (to avoid the 'total' copy).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1918
     This deepCopy is a bit slower than the old (unsecure) one, since it
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1919
     keeps track of already copied objects. If you are sure, that your
1129
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  1920
     copied object does not include duplicates (or you do not care) and
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1921
     no cycles, you can use the old simpleDeepCopy, which avoids this overhead,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1922
     but may run into trouble.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1923
     Notice, that copy does not copy dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1924
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1925
    ^ self deepCopyUsing:(IdentityDictionary new)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1926
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1927
    "an example which is not handled by the old deepCopy:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1928
    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1929
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1930
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1931
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1932
     a deepCopy inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1933
    "
1129
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  1934
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  1935
    "Modified: 27.3.1996 / 16:31:20 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1936
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1937
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1938
deepCopyError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1939
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1940
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1941
    "raise a signal, that deepCopy is not allowed for this object"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1942
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1943
    ^ DeepCopyErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1944
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1945
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1946
deepCopyUsing:aDictionary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1947
    "a helper for deepCopy; return a copy of the object with 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1948
     all subobjects also copied. If the to-be-copied object is in the dictionary, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1949
     use the value found there. The class of the receiver is not copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1950
     This method DOES handle cycles/self references."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1951
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1952
    |myClass aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1953
     sz "{ Class: SmallInteger }" 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1954
     iOrig iCopy|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1955
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1956
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1957
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1958
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1959
	aCopy := myClass basicNew:sz.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1960
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1961
	sz := 0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1962
	aCopy := myClass basicNew
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1963
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1964
    aCopy setHashFrom:self.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1965
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1966
    aDictionary at:self put:aCopy.
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1967
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1968
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1969
     copy indexed instvars - if any
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1970
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1971
    sz ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1972
	myClass isBits ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1973
	    "block-copy indexed instvars"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1974
	    aCopy replaceFrom:1 to:sz with:self startingAt:1
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1975
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1976
	    "individual deep copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1977
	    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1978
		iOrig := self basicAt:i.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1979
		iOrig notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1980
		    (aDictionary includesKey:iOrig) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1981
			iCopy := aDictionary at:iOrig
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1982
		    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1983
			iCopy := iOrig deepCopyUsing:aDictionary.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1984
		    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1985
		    aCopy basicAt:i put:iCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1986
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1987
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1988
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1989
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1990
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1991
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1992
     copy the instance variables
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1993
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1994
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1995
    sz ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1996
	1 to:sz do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1997
	    iOrig := self instVarAt:i.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1998
	    iOrig notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1999
		(aDictionary includesKey:iOrig) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2000
		    iCopy := aDictionary at:iOrig
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2001
		] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2002
		    iCopy := iOrig deepCopyUsing:aDictionary.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2003
		].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2004
		aCopy instVarAt:i put:iCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2005
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2006
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2007
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2008
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2009
    ^ aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2010
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2011
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2012
postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2013
    "this is for compatibility with ST-80 code, which uses postCopy for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2014
     cleanup after copying, while ST/X passes the original in postCopyFrom:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2015
     (see there)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2016
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2017
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2018
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2019
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2020
setHashFrom:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2021
    "set my identity-hash key to be the same as anObjects hash key. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2022
     This is an ST/X speciality, which is NOT available in other (especially OT based) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2023
     Smalltalks, and may not be available in future ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2024
     DO NEVER use this for normal application code."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2025
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2026
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2027
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2028
    REGISTER unsigned h;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2029
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2030
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2031
	h = __GET_HASH(anObject);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2032
	__SET_HASH(self, h);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2033
	RETURN (self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2034
    }
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2035
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2036
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2037
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2038
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2039
shallowCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2040
    "return a copy of the object with shared subobjects (a shallow copy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2041
     i.e. the copy shares referenced instvars with its original."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2042
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2043
%{  /* NOCONTEXT */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2044
    int ninsts, spc;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2045
    int sz;
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3063
diff changeset
  2046
    OBJ theCopy;
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2047
    OBJ cls;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2048
    int flags;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2049
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2050
    cls = __qClass(self);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2051
    flags = __intVal(__ClassInstPtr(cls)->c_flags);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2052
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2053
    /*
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2054
     * bail out for special objects ..
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2055
     */
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2056
    if (((flags & ~ARRAYMASK) == 0)
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2057
     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
2652
63fe707c52da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2651
diff changeset
  2058
	sz = __qSize(self);
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  2059
	__PROTECT__(self);
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2060
	__qNew(theCopy, sz);    /* OBJECT ALLOCATION */
3078
e48f06979043 binary storage tuning
Claus Gittinger <cg@exept.de>
parents: 3066
diff changeset
  2061
	__UNPROTECT__(self);
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2062
	if (theCopy) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2063
	    cls = __qClass(self);
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2064
	    spc = __qSpace(theCopy);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2065
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2066
	    theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2067
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2068
	    sz = sz - OHDR_SIZE;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2069
	    if (sz) {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2070
		char *src, *dst;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2071
3066
eb7489e8275a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3063
diff changeset
  2072
		src = (char *)(__InstPtr(self)->i_instvars);
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2073
		dst = (char *)(__InstPtr(theCopy)->i_instvars);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2074
#ifdef bcopy4
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2075
		{
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2076
		    /* care for odd-number of longs */
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2077
		    int nW = sz >> 2;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2078
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2079
		    if (sz & 3) {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2080
			nW++;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2081
		    }
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2082
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2083
		    bcopy4(src, dst, nW);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2084
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2085
#else
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2086
		bcopy(src, dst, sz);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2087
#endif
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2088
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2089
		flags &= ARRAYMASK;
2652
63fe707c52da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2651
diff changeset
  2090
		if (flags == POINTERARRAY) {
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2091
		    ninsts = __BYTES2OBJS__(sz);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2092
		} else {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2093
		    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2094
		}
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2095
		if (ninsts) {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2096
		    do {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2097
			OBJ el;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2098
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2099
			el = __InstPtr(theCopy)->i_instvars[ninsts-1];
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2100
			__STORE_SPC(theCopy, el, spc);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2101
		    } while (--ninsts);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2102
		}
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2103
	    }
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2104
	    RETURN (theCopy);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2105
	}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2106
    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2107
%}.
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2108
    "/ fallBack for special objects & memoryAllocation failure case
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2109
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2110
    ^ self slowShallowCopy
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2111
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2112
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2113
shallowCopyForFinalization
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2114
    "this is used to aquire a copy to be used for finalization -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2115
     (the copy will get a dispose-notification; see the documentation in the Registry class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2116
     This method can be redefined for more efficient copying - especially for large objects."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2117
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2118
    ^ self shallowCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2119
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2120
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2121
simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2122
    "return a copy of the object with all subobjects also copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2123
     This method does NOT handle cycles - but is included to allow this 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2124
     slightly faster copy in situations where it is known that
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2125
     no recursive references occur (LargeIntegers for example).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2126
     NOTICE: you will run into trouble, when trying this with recursive
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2127
     objects (usually recursionInterrupt or memory-alert).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2128
     This method corresponds to the 'traditional' deepCopy found in
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2129
     the Blue book."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2130
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2131
    |myClass aCopy 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2132
     sz "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2133
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2134
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2135
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2136
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2137
	aCopy := myClass basicNew:sz.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2138
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2139
	"copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2140
	1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2141
	    aCopy basicAt:i put:((self basicAt:i) simpleDeepCopy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2142
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2143
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2144
	aCopy := myClass basicNew 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2145
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2146
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2147
    "copy the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2148
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2149
    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2150
	aCopy instVarAt:i put:((self instVarAt:i) simpleDeepCopy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2151
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2152
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2153
    ^ aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2154
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2155
    "a bad example (but ST/X should survive ...)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2156
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2157
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2158
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2159
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2160
     a simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2161
    "
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2162
!
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2163
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2164
slowShallowCopy
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2165
    "return a copy of the object with shared subobjects (a shallow copy)
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2166
     i.e. the copy shares referenced instvars with its original.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2167
     This method is only invoked as a fallback from #shallowCopy."
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2168
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2169
    |myClass aCopy 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2170
     sz "{ Class: SmallInteger }" |
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2171
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2172
    myClass := self class.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2173
    myClass isVariable ifTrue:[
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2174
	sz := self basicSize.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2175
	aCopy := myClass basicNew:sz.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2176
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2177
	"copy the indexed variables"
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2178
	1 to:sz do:[:i | 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2179
	    aCopy basicAt:i put:(self basicAt:i) 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2180
	]
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2181
    ] ifFalse:[
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2182
	aCopy := myClass basicNew
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2183
    ].
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2184
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2185
    "copy the instance variables"
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2186
    sz := myClass instSize.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2187
    1 to:sz do:[:i | 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2188
	aCopy instVarAt:i put:(self instVarAt:i) 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2189
    ].
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2190
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  2191
    ^ aCopy
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2192
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2193
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2194
!Object methodsFor:'debugging'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2195
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2196
basicInspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2197
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2198
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2199
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2200
     this method should NOT be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2201
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2202
    Inspector isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2203
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2204
	 for systems without GUI
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2205
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2206
	Transcript showCR:'no Inspector'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2207
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2208
	Inspector openOn:self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2209
    ]
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  2210
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  2211
    "Modified: 18.5.1996 / 15:43:25 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2212
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2213
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2214
inspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2215
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2216
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2217
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2218
     this method (or better: inspectorClass) can be redefined in subclasses 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2219
     to start special inspectors."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2220
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2221
    |cls|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2222
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2223
    cls := self inspectorClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2224
    cls isNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2225
	^ self basicInspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2226
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2227
    cls openOn:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2228
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2229
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2230
     Object new inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2231
     (1 @ 2) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2232
     Smalltalk inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2233
     #(1 2 3) asOrderedCollection inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2234
     (Color red) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2235
     (Image fromFile:'bitmaps/garfield.gif') inspect
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  2236
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2237
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2238
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2239
inspectorClass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2240
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2241
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2242
    "return the class to use for inspect. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2243
     Can (should) be redefined in classes for which a better inspector is available"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2244
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2245
    ^ Inspector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2246
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2247
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2248
mustBeKindOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2249
    "for compatibility & debugging support: 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2250
     check if the receiver isKindOf:aClass and raise an error if not.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2251
     Notice:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2252
	it is VERY questionable, if it makes sense to add manual
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2253
	type checks to a dynamically typed language like smalltalk. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2254
	It will, at least, slow down performance,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2255
	make your code less reusable and clutter your code with stupid sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2256
	of this selector. Also, read the comment in isKindOf:, regarding the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2257
	use of isXXX check methods.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2258
     You see: The author does not like this at all ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2259
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2260
    (self isKindOf:aClass) ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2261
	self error:'argument is not of expected type'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2262
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2263
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2264
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2265
obsoleteMethodWarning
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2266
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2267
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2268
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2269
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2270
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2271
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2272
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2273
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2274
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2275
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2276
    self obsoleteMethodWarning:nil from:thisContext sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2277
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2278
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2279
obsoleteMethodWarning:message
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2280
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2281
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2282
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2283
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2284
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2285
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2286
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2287
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2288
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2289
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2290
    self obsoleteMethodWarning:message from:thisContext sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2291
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2292
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2293
obsoleteMethodWarning:message from:aContext
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2294
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2295
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2296
    "in methods which are going to be obsoleted, a self-send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2297
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2298
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2299
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2300
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2301
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2302
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2303
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2304
    |spec|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2305
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2306
    spec := aContext methodPrintString.
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2307
    ('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2308
    ('         And may not be present in future ST/X versions.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2309
    ('         called from ' , aContext sender printString) errorPrintCR.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2310
    message notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2311
	'------>  ' errorPrint. message errorPrintCR
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2312
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2313
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2314
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2315
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2316
    "
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2317
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2318
    "Modified: 10.1.1997 / 19:08:42 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2319
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2320
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2321
!Object methodsFor:'dependents access'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2322
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2323
addDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2324
    "make the argument, anObject be a dependent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2325
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2326
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2327
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2328
    "/ must do this save from interrupts, since the dependents collection
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2329
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2330
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2331
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2332
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2333
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2334
    [
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2335
	|deps dep|
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2336
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2337
	deps := self dependents.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2338
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2339
	"/ to save a fair amount of memory in case of
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2340
	"/ many dependencies, we store a single dependent in
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2341
	"/ a WeakArray, and switch to a WeakSet if more dependents are
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2342
	"/ added.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2343
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2344
	(deps isNil or:[deps size == 0]) ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2345
	    self dependents:(WeakArray with:anObject)
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2346
	] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2347
	    deps class == WeakArray ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2348
		dep := deps at:1.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2349
		dep ~~ anObject ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2350
		    (dep isNil or:[dep == 0]) ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2351
			deps at:1 put:anObject
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2352
		    ] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2353
			self dependents:(WeakIdentitySet with:dep with:anObject)
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2354
		    ]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2355
		]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2356
	    ] ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2357
		deps add:anObject
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2358
	    ]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2359
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2360
    ] valueNowOrOnUnwindDo:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2361
	wasBlocked ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2362
	    OperatingSystem unblockInterrupts
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2363
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2364
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2365
3063
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2366
    "Modified: / 27.10.1997 / 19:35:52 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2367
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2368
3309
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2369
breakDependents
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2370
    "remove all dependencies from the receiver"
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2371
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2372
    self dependents:nil.
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2373
    self nonWeakDependents:nil
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2374
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2375
    "Modified: / 19.4.1996 / 10:55:36 / cg"
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2376
    "Created: / 27.2.1998 / 11:26:11 / stefan"
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2377
!
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2378
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2379
dependents
3222
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2380
    "return a Collection of dependents.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2381
     The default implementation here uses a global WeakDictionary to store
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2382
     dependents 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2383
     This may be too slow for high frequency change&update,
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2384
     therefore, some classes (Model) redefine this for better performance.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2385
     Notice the mentioning of a WeakDictionary - read the classes documentation."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2386
3222
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2387
    |deps|
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2388
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2389
    (deps := Dependencies at:self ifAbsent:nil) isNil ifTrue:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2390
	^ #().
3222
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2391
    ].
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2392
    ^ deps
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2393
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2394
    "Modified: / 26.1.1998 / 11:18:15 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2395
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2396
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2397
dependents:aCollection
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2398
    "set the collection of dependents.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2399
     The default implementation here uses a global Dictionary to store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2400
     dependents which may be too slow for high frequency change&update.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2401
     Therefore, some classes (Model) redefine this for better performance."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2402
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2403
    "/ must do this save from interrupts, since the dependents collection
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2404
    "/ is possibly accessed from multiple threads.
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2405
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2406
    "/ faster execution (and to avoid creation of garbage blocks).
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2407
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2408
    (OperatingSystem blockInterrupts) ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2409
	"/ the common case - already blocked
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2410
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2411
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2412
	    Dependencies removeKey:self ifAbsent:[]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2413
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2414
	    Dependencies at:self put:aCollection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2415
	].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2416
	^ self
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2417
    ].
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2418
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2419
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2420
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2421
	    Dependencies removeKey:self ifAbsent:[]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2422
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2423
	    Dependencies at:self put:aCollection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2424
	].
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2425
    ] valueNowOrOnUnwindDo:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2426
	OperatingSystem unblockInterrupts
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2427
    ]
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2428
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2429
    "Modified: 30.1.1997 / 21:22:10 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2430
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2431
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2432
dependentsDo:aBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2433
    "evaluate aBlock for all of my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2434
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2435
    |deps nwDeps|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2436
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2437
    deps := self dependents.
3222
f5f820763b97 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3177
diff changeset
  2438
    deps size ~~ 0 ifTrue:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2439
	deps do:[:d | 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2440
		    (d notNil and:[d ~~ 0]) ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2441
			aBlock value:d
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2442
		    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2443
		]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2444
    ].
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2445
    nwDeps := self nonWeakDependents.
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2446
    (nwDeps ~~ deps and:[nwDeps size ~~ 0]) ifTrue:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2447
	nwDeps do:aBlock 
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2448
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2449
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2450
    "Modified: / 30.1.1998 / 14:03:40 / cg"
1098
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2451
!
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2452
2445
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2453
myDependents
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2454
    "same as dependents - ST-80 compatibility"
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2455
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2456
    ^ self dependents
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2457
!
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2458
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2459
release
3309
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2460
    "remove all references to objects that may refer to self.
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2461
     Subclasses may redefine this method but should do a 'super release'."
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2462
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2463
    self breakDependents
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2464
3e24bdf9ba79 Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents: 3306
diff changeset
  2465
    "Modified: / 27.2.1998 / 11:29:35 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2466
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2467
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2468
removeDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2469
    "make the argument, anObject be independent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2470
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2471
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2472
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2473
    "/ must do this save from interrupts, since the dependents collection
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2474
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2475
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2476
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2477
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2478
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2479
    [
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2480
	|deps n d|
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2481
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2482
	deps := self dependents.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2483
	deps size ~~ 0 ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2484
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2485
	    "/ to save a fair amount of memory in case of
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2486
	    "/ many dependencies, we store a single dependent in
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2487
	    "/ a WeakArray, and switch to a WeakSet if more dependents are
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2488
	    "/ added. Here we have to do the inverse ...
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2489
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2490
	    deps class == WeakArray ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2491
		((d := deps at:1) == anObject 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2492
		or:[d isNil
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2493
		or:[d == 0]]) ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2494
		    self dependents:nil
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2495
		]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2496
	    ] ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2497
		deps remove:anObject ifAbsent:[].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2498
		(n := deps size) == 0 ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2499
		    self dependents:nil
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2500
		] ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2501
		    n == 1 ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2502
			d := deps firstIfEmpty:nil.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2503
			d notNil ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2504
			    deps := WeakArray with:d
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2505
			] ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2506
			    deps := nil
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2507
			].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2508
			self dependents:deps.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2509
		    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2510
		]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2511
	    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2512
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2513
    ] valueNowOrOnUnwindDo:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2514
	wasBlocked ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2515
	    OperatingSystem unblockInterrupts
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2516
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2517
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2518
3228
b6b893e8f898 must look for size of value returned by self dependents
Claus Gittinger <cg@exept.de>
parents: 3222
diff changeset
  2519
    "Modified: / 26.1.1998 / 19:51:50 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2520
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2521
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2522
!Object methodsFor:'dependents access (nonWeak)'!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2523
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2524
addNonWeakDependent:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2525
    "make the argument, anObject be a nonWeak dependent of the receiver.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2526
     Be careful: this nonWeakDependency will prevent the dependent from being 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2527
     garbage collected unless the dependency is removed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2528
     This is a private mechanism, for directed dependencies."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2529
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2530
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2531
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2532
    "/ must do this save from interrupts, since the dependents collection
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2533
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2534
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2535
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2536
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2537
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2538
    [
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2539
	|deps dep|
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2540
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2541
	deps := self nonWeakDependents.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2542
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2543
	"/ to save a fair amount of memory in case of
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2544
	"/ many dependencies, we store a single dependent in
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2545
	"/ an Array, and switch to a Set if more dependents are
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2546
	"/ added.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2547
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2548
	deps size == 0 ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2549
	    self nonWeakDependents:(Array with:anObject)
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2550
	] ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2551
	    deps class == Array ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2552
		dep := deps at:1.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2553
		dep ~~ anObject ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2554
		    self nonWeakDependents:(IdentitySet with:dep with:anObject)
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2555
		]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2556
	    ] ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2557
		deps add:anObject
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2558
	    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2559
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2560
    ] valueNowOrOnUnwindDo:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2561
	wasBlocked ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2562
	    OperatingSystem unblockInterrupts
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2563
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2564
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2565
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2566
    "Created: / 19.4.1996 / 10:54:08 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2567
    "Modified: / 30.1.1998 / 14:03:08 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2568
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2569
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2570
nonWeakDependents
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2571
    "return a Collection of nonWeakDependents - empty if there is none.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2572
     This is a private mechanism for directed dependencies."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2573
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2574
    NonWeakDependencies isNil ifTrue:[^ #()].
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2575
    ^ NonWeakDependencies at:self ifAbsent:#()
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2576
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2577
    "Created: / 19.4.1996 / 10:55:06 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2578
    "Modified: / 30.1.1998 / 14:06:47 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2579
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2580
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2581
nonWeakDependents:aCollection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2582
    "set the collection of nonWeak dependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2583
     This is a private helper for directed dependencies."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2584
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2585
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2586
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2587
	    NonWeakDependencies removeKey:self ifAbsent:[]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2588
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2589
	    NonWeakDependencies at:self put:aCollection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2590
	]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2591
    ] valueUninterruptably
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2592
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2593
    "Created: 19.4.1996 / 11:07:47 / cg"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2594
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2595
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2596
removeNonWeakDependent:anObject
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2597
    "remove a nonWeak dependency from the receiver to the argument, anObject.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2598
     (i.e. make it independent of the receiver)"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2599
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2600
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2601
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2602
    "/ must do this save from interrupts, since the dependents collection
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2603
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2604
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2605
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2606
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2607
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2608
    [
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2609
	|deps n|
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2610
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2611
	deps := self nonWeakDependents.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2612
	deps size ~~ 0 ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2613
	    deps class == Array ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2614
		(deps at:1) == anObject ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2615
		    self nonWeakDependents:nil
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2616
		]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2617
	    ] ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2618
		deps remove:anObject ifAbsent:[].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2619
		(n := deps size) == 0 ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2620
		    self nonWeakDependents:nil
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2621
		] ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2622
		    n == 1 ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2623
			self nonWeakDependents:(Array with:(deps first))
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2624
		    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2625
		]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2626
	    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2627
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2628
    ] valueNowOrOnUnwindDo:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2629
	wasBlocked ifFalse:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2630
	    OperatingSystem unblockInterrupts
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  2631
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2632
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2633
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2634
    "Created: / 19.4.1996 / 11:44:44 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  2635
    "Modified: / 30.1.1998 / 14:04:01 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2636
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2637
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2638
!Object methodsFor:'displaying'!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2639
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2640
displayOn:aGC
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2641
    "ST-80 Compatibility
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2642
     display the receiver in a graphicsContext at 0@0
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2643
     - this method allows for any object to be displayed in some view
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2644
     (although the fallBack is to display its printString ...)"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2645
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2646
    ^ self displayOn:aGC x:0 y:0.
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2647
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2648
    "Created: 29.5.1996 / 16:28:58 / cg"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2649
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2650
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2651
displayOn:aGC at:aPoint
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2652
    "ST-80 Compatibility
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2653
     display the receiver in a graphicsContext - this method allows
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2654
     for any object to be displayed in a ListView - for example."
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2655
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2656
    ^ self displayOn:aGC x:(aPoint x) y:(aPoint y).
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2657
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2658
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2659
displayOn:aGC x:x y:y
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2660
    "display the receiver in a graphicsContext - this method allows
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2661
     for any object to be displayed in a ListView - for example."
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2662
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2663
    self displayOn:aGC x:x y:y opaque:false
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2664
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2665
    "Modified: 29.5.1996 / 16:29:38 / cg"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2666
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2667
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2668
displayOn:aGc x:x y:y opaque:opaque
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2669
    "display the receiver in a graphicsContext - this method allows
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2670
     for any object to be displayed in a ListView - for example.
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2671
     The fallBack here shows the receivers displayString."
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2672
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2673
    |s|
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2674
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2675
    s := self displayString.
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2676
    opaque ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2677
	aGc displayOpaqueString:s x:x y:y.
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2678
    ] ifFalse:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2679
	aGc displayString:s x:x y:y.
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2680
    ].
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2681
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2682
    "Modified: 29.5.1996 / 16:29:38 / cg"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2683
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2684
3063
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2685
displayOpaqueOn:aGC x:x y:y
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2686
    "display the receiver in a graphicsContext - this method allows
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2687
     for any object to be displayed in a ListView - for example."
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2688
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2689
    self displayOn:aGC x:x y:y opaque:true
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2690
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2691
    "Modified: / 29.5.1996 / 16:29:38 / cg"
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2692
    "Created: / 26.10.1997 / 15:01:36 / cg"
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2693
!
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2694
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2695
displayString
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2696
    "return a string used when displaying the receiver in a view;
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2697
     for example an Inspector. This is usually the same as printString,
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2698
     but sometimes redefined for a better look."
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2699
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2700
    ^ self printString
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2701
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2702
    "
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2703
     #(1 2 3) printString    
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2704
     #(1 2 3) displayString  
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2705
     #(1 2 3) storeString
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2706
    "
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2707
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2708
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2709
heightOn:aGC
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2710
    "return the height of the receiver, if it is to be displayed on aGC"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2711
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2712
    ^ (aGC font on:aGC device) heightOf:(self displayString)
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2713
!
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2714
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2715
widthOn:aGC
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2716
    "return the width of the receiver, if it is to be displayed on aGC"
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2717
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2718
    ^ (aGC font on:aGC device) widthOf:(self displayString)
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2719
! !
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
  2720
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2721
!Object methodsFor:'error handling'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2722
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2723
appropriateDebugger:aSelector
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2724
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2725
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2726
    "return an appropriate debugger to use.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2727
     If there is already a debugger active on the stack, and it is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2728
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2729
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2730
    |context|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2731
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2732
    "DebugView cannot run without system processes"
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2733
1685
5f867e93af8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  2734
    (Processor isNil 
1684
98ce4d199c9b scheisse
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2735
    or:[Processor activeProcessIsSystemProcess]) ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2736
	^ MiniDebugger
3063
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2737
    ].
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2738
    Smalltalk isInitialized ifFalse:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2739
	^ MiniDebugger
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2740
    ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2741
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2742
    context := thisContext.
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2851
diff changeset
  2743
    context := context findNextContextWithSelector:aSelector or:nil or:nil.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2744
    [context notNil] whileTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2745
	((context receiver class == Debugger) 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2746
	 and:[context selector == aSelector]) ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2747
	    "we are already in some Debugger"
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2748
	    (Debugger == MiniDebugger) ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2749
		"we are already in the MiniDebugger"
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2750
		ErrorRecursion ifFalse:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2751
		    Smalltalk fatalAbort:'recursive error ...'
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2752
		]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2753
	    ].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2754
	    MiniDebugger isNil ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2755
		Smalltalk fatalAbort:'no debugger'
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2756
	    ].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2757
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2758
	    "ok, an error occured while in the graphical debugger;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2759
	     lets try MiniDebugger"
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2760
	    ^ MiniDebugger
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2761
	].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2762
	context := context findNextContextWithSelector:aSelector or:nil or:nil.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2763
    ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2764
    "not within Debugger - no problem"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2765
    ^ Debugger
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2766
3063
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2767
    "Modified: / 23.9.1996 / 12:14:52 / stefan"
d4bc0c596b98 dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents: 3044
diff changeset
  2768
    "Modified: / 27.10.1997 / 19:22:10 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2769
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2770
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2771
cannotSendMessage:aMessage to:someReceiver
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2772
    "this message is sent by the runtime system (VM),
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2773
     when a message is sent to some object, whose class is not
2231
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2774
     a valid behavior (see documentation in Behavior)."
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2775
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2776
    ^ InternalErrorSignal
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2777
	  raiseRequestWith:someReceiver
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2778
	  errorString:('bad class in send of #' , aMessage selector)
2231
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2779
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2780
    "Modified: 23.1.1997 / 00:05:39 / cg"
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2781
!
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2782
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2783
doesNotUnderstand:aMessage
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2784
    "this message is sent by the runtime system (VM) when
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2785
     a message is not understood by some object (i.e. there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2786
     is no method for that selector). The original message has
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2787
     been packed into aMessage (i.e. the receiver, selector and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2788
     any arguments) and the original receiver is then sent the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2789
     #doesNotUnderstand: message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2790
     Here, we raise another signal which usually enters the debugger.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2791
     You can of course redefine #doesNotUnderstand: in your classes
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2792
     to implement message delegation, 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2793
     or handle the MessageNotUnderstoodSignal gracefully."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2794
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2795
    |sel errorString cls sender|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2796
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2797
    sel := aMessage selector printString.
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2798
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2799
    "/ Although sel should always be a symbol,
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2800
    "/ always use printStrings in the code below.
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2801
    "/ Non-symbol selector may happen when things go mad in a primitive, 
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2802
    "/ or a method has been called by valueWithReceiver: with a wrong arg.
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2803
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2804
    "/ handle the case of an error during early startup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2805
    "/ (output streams not yet initialized)
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2806
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2807
    Stdout isNil ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2808
	Smalltalk fatalAbort:'error during init: ' , sel , ' not understood'.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2809
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2810
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2811
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2812
    "/ extract the class that should have implemented the message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2813
    "/ (in case of a super-send, this is not the receivers class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2814
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2815
    sender := thisContext sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2816
    cls := sender searchClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2817
    cls isNil ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2818
	"it was NOT a super or directed send ..."
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2819
	cls := self class
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2820
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2821
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2822
    cls notNil ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2823
	"/
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2824
	"/ displayString is better than 'cls name',
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2825
	"/ since it appends (obsolete) for outdated classes.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2826
	"/ (this happens if you send messages to old instances
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2827
	"/  after changing a classes definition)
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2828
	"/
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2829
	errorString := cls displayString.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2830
    ] ifFalse:[    
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2831
	errorString := '(** nil-class **)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2832
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2833
    errorString := errorString , ' does not understand: ' , sel.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2834
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2835
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2836
    "/ this only happens, when YOU play around with my classvars ...
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2837
    "/ (or an error occurs during very early startup, when signals are not yet set)
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2838
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2839
    MessageNotUnderstoodSignal isNil ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2840
	^ self 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2841
	    enterDebuggerWithMessage:'oops - MessageNotUnderstoodSignal is gone'
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2842
	    on:thisContext.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2843
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2844
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2845
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2846
    "/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2847
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2848
    ^ MessageNotUnderstoodSignal
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2849
		raiseRequestWith:aMessage
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2850
		     errorString:errorString
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2851
			      in:sender
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2852
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2853
    "Modified: 31.7.1997 / 17:04:49 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2854
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2855
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2856
elementBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2857
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2858
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2859
    "report an error that badElement is out of bounds 
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2860
     (i.e. cannot be put into that collection).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2861
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2862
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2863
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2864
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2865
    "Modified: 8.5.1996 / 09:12:45 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2866
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2867
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2868
elementNotCharacter
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2869
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2870
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2871
    "report an error that object to be stored is no Character.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2872
     (usually when storing into Strings).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2873
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2874
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2875
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2876
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2877
    "Modified: 8.5.1996 / 09:12:49 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2878
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2879
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2880
elementNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2881
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2882
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2883
    "report an error that object to be stored is not Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2884
     (in collections that store integers only).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2885
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2886
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2887
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2888
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2889
    "Modified: 8.5.1996 / 09:12:51 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2890
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2891
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2892
enterDebuggerWith:anException message:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2893
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2894
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2895
    "enter the debugger with error-message aString"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2896
1674
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2897
    ^ self 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2898
	enterDebuggerWithMessage:aString 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2899
	on:anException suspendedContext
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2900
!
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2901
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2902
enterDebuggerWithMessage:aString on:aContext 
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2903
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2904
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2905
    "enter the debugger with error-message aString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2906
     The first visible context shown there is aContext 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2907
     (this allows intermediate helpers to hide themselfes from what is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2908
     presented to the user)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2909
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2910
    |debugger msg|
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2911
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2912
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2913
     if there is no debugger, exit smalltalk
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2914
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2915
    Debugger isNil ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2916
	msg := 'error: ' , aString.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2917
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2918
	Smalltalk isStandAloneApp ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2919
	    Dialog notNil ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2920
		(Dialog 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2921
		    confirm:msg title:(Smalltalk commandName)
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2922
		    yesLabel:'ignore' noLabel:'exit'
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2923
		) ifTrue:[
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2924
		    ^ AbortSignal raise
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2925
		]
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2926
	    ].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2927
	    msg errorPrintCR.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2928
	    OperatingSystem exit:1
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2929
	].
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2930
	msg errorPrintCR.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2931
	Smalltalk fatalAbort:'no Debugger defined'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2932
    ].
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  2933
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2934
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2935
     find an appropriate debugger to use
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2936
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2937
    debugger := self appropriateDebugger:#'enter:withMessage:'.
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2938
    debugger isNil ifTrue:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  2939
	^ AbortSignal raise
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2940
    ].    
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2941
    ^ debugger enter:aContext withMessage:aString.
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2942
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2943
    "Modified: 24.7.1997 / 10:09:20 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2944
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2945
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2946
error
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2947
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2948
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2949
    "report error that an error occured.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2950
     The error is reported by raising the ErrorSignal exception."
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2951
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2952
    ^ ErrorSignal raiseIn:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2953
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2954
    "Modified: 8.5.1996 / 09:13:01 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2955
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2956
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2957
error:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2958
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2959
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2960
    "enter debugger with error-message aString.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2961
     The error is reported by raising the ErrorSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2962
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2963
    ^ ErrorSignal raiseRequestWith:#error: 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2964
		       errorString:aString
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2965
				in:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2966
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2967
    "Modified: 8.5.1996 / 09:13:04 / cg"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2968
!
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2969
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2970
error:aString in:aContext
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2971
    "{ Pragma: +optSpace }"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2972
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2973
    "enter debugger with error-message aString.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2974
     The error is reported by raising the ErrorSignal exception."
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2975
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2976
    ^ ErrorSignal raiseRequestWith:#error: 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2977
		       errorString:aString
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2978
				in:aContext
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2979
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2980
    "Created: 8.5.1996 / 09:07:59 / cg"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2981
    "Modified: 8.5.1996 / 09:13:06 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2982
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2983
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2984
errorKeyNotFound:aKey
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2985
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2986
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2987
    "report an error that a key was not found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2988
     The error is reported by raising the KeyNotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2989
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2990
    ^ KeyNotFoundSignal raiseRequestWith:aKey in:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2991
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2992
    "Modified: 8.5.1996 / 09:13:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2993
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2994
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2995
errorNotFound
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2996
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2997
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2998
    "report an error that no element was found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2999
     The error is reported by raising the NotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3000
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3001
    ^ NotFoundSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3002
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3003
    "Modified: 8.5.1996 / 09:13:11 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3004
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3005
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3006
halt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3007
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3008
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3009
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3010
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3011
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3012
    ^ HaltSignal raiseIn:thisContext sender.
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3013
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3014
    "Modified: 8.5.1996 / 09:12:38 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3015
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3016
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3017
halt:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3018
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3019
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3020
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3021
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3022
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3023
    ^ HaltSignal raiseRequestWith:#halt: 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3024
		      errorString:aString
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3025
			       in:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3026
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3027
    "Modified: 8.5.1996 / 09:13:23 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3028
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3029
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3030
implementedBySubclass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3031
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3032
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3033
    "this is sent by ST/V code - its the same as #subclassResponsibility"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3034
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3035
    ^ self subclassResponsibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3036
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3037
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3038
indexNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3039
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3040
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3041
    "report an error that index is not an Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3042
     (when accessing collections indexed by an integer key).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3043
     The error is reported by raising the NonIntegerIndexSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3044
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3045
    ^ NonIntegerIndexSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3046
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3047
    "Modified: 8.5.1996 / 09:13:37 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3048
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3049
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3050
integerCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3051
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3052
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3053
    "generated when a variable declared with an integer type gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3054
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3055
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3056
    ^ self error:'bad assign of ' , self printString , 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3057
		  ' (' , self class name , ') to integer-typed variable'
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3058
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3059
2829
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3060
invalidCodeObject
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3061
    "{ Pragma: +optSpace }"
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3062
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3063
    self error:'not an executable code object'
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3064
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3065
    "Created: 1.8.1997 / 00:16:44 / cg"
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3066
!
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  3067
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3068
invalidMessage 
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3069
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3070
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3071
    "this is sent by ST/V code - its the same as #shouldNotImplement"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3072
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3073
    ^ self shouldNotImplement
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3074
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3075
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3076
mustBeRectangle
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3077
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3078
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3079
    "report an argument-not-rectangle-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3080
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3081
    ^ self error:'argument must be a Rectangle'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3082
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3083
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3084
mustBeString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3085
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3086
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3087
    "report an argument-not-string-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3088
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3089
    ^ self error:'argument must be a String'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3090
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3091
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3092
notIndexed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3093
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3094
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3095
    "report an error that receiver has no indexed instance variables.
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3096
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3097
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3098
    ^ SubscriptOutOfBoundsSignal 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3099
	raiseErrorString:'receiver has no indexed variables'
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3100
	in:thisContext sender
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3101
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3102
    "Modified: 26.7.1996 / 16:43:13 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3103
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3104
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3105
primitiveFailed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3106
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3107
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3108
    "report an error that some primitive code failed.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3109
     The error is reported by raising the PrimitiveFailureSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3110
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3111
    ^ PrimitiveFailureSignal raiseIn:(thisContext sender)
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3112
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3113
    "Modified: 8.5.1996 / 09:14:07 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3114
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3115
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3116
shouldNotImplement
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3117
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3118
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3119
    "report an error that this message should not be implemented"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3120
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3121
    ^ self error:'method not appropriate for this class'
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3122
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3123
    "Modified: 8.5.1996 / 09:09:44 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3124
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3125
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3126
subclassResponsibility
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3127
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3128
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3129
    "report an error that this message should have been reimplemented in a
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3130
     subclass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3131
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3132
    ^ self error:'method must be reimplemented in subclass' in:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3133
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3134
    "Modified: 8.5.1996 / 09:09:26 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3135
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3136
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3137
subscriptBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3138
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3139
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3140
    "report an error that some index is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3141
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3142
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3143
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3144
    ^ SubscriptOutOfBoundsSignal 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3145
	raiseIn:thisContext sender
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3146
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  3147
    "Modified: 26.7.1996 / 16:45:42 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3148
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3149
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3150
subscriptBoundsError:anIndex
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3151
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3152
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3153
    "report an error that anIndex is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3154
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3155
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3156
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  3157
    ^ SubscriptOutOfBoundsSignal 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3158
	raiseRequestWith:anIndex 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3159
	errorString:('subscript (' , anIndex printString , ') out of bounds')
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3160
	in:thisContext sender
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  3161
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  3162
    "Modified: 8.5.1996 / 09:14:34 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3163
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3164
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3165
typeCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3166
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3167
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3168
    "generated when a variable declared with a type hint gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3169
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3170
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3171
    ^ self error:'bad assign of ' , self printString ,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3172
		  ' (' , self class name , ') to typed variable'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3173
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3174
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3175
!Object methodsFor:'evaluation'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3176
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3177
value
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3178
    "return the receiver itself.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3179
     This allows every object to be used where blocks or valueHolders
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3180
     are typically used, and allows for valueHolders and blocks to be
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3181
     used interchangably in some situations.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3182
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3183
     Time will show, if this is a good idea or leads to sloppy programming
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3184
     style ... (the idea was borrowed from the Self language).
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3185
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3186
     WARNING: dont 'optimize' away ifXXX: blocks 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3187
	      (i.e. do NOT replace 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3188
			foo ifTrue:[var1] ifFalse:[var2]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3189
	       by:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3190
			foo ifTrue:var1 ifFalse:var2
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3191
	      )
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3192
	      - the compilers will only generate inline code for the if, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3193
		iff the argument(s) are blocks - otherwise, a true send is
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3194
		generated.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3195
	      This 'oprimization' will work semantically correct,
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3196
	      but execute SLOWER instead."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3197
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3198
    ^ self
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3199
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3200
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3201
     #(1 2 3 4) indexOf:5 ifAbsent:0     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3202
     #(1 2 3 4) indexOf:5 ifAbsent:[0]     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3203
     1 > 2 ifTrue:['yes'] ifFalse:['no']  
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3204
     1 > 2 ifTrue:'yes' ifFalse:'no'       
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3205
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3206
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3207
    "DO NOT DO THIS (its slower)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3208
     (1 > 4) ifTrue:'oops' ifFalse:'ok'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3209
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3210
     USE (the compiler optimizes blocks in if/while):
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3211
     (1 > 4) ifTrue:['oops'] ifFalse:['ok']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3212
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3213
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  3214
    "Modified: 3.5.1996 / 11:57:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3215
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3216
3330
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3217
!Object methodsFor:'finalization'!
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3218
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3219
finalize
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3220
    "subclasses may redefine this method"
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3221
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3222
    ^ self
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3223
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3224
    "Created: / 4.3.1998 / 10:40:30 / stefan"
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3225
! !
5e0af0183446 Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents: 3317
diff changeset
  3226
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3227
!Object methodsFor:'initialization'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3228
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3229
initialize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3230
    "just to ignore initialize to objects which do not need it"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3231
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3232
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3233
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3234
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3235
!Object methodsFor:'interest'!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3236
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3237
addInterest:anInterest
1762
e7267ff590ff Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1751
diff changeset
  3238
    "install an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3239
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3240
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3241
    self addNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3242
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3243
    "Created: 14.10.1996 / 22:27:34 / stefan"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3244
!
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3245
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3246
expressInterestIn:aspect for:anObject sendBack:aSelector
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3247
    "arrange for aSelector to be sent to anObject whenever the receiver
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3248
     changes aspect."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3249
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3250
    "/ for now, use an interestConverter, which is somewhat less efficient.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3251
    "/ In the future, a more intelligent DependencyCollection class is planned for
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3252
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3253
    self addInterest:(InterestConverter 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3254
			    destination:anObject 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3255
			    selector:aSelector 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3256
			    aspect:aspect)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3257
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3258
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3259
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3260
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3261
     b := [Transcript showCR:' -> the point changed'].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3262
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3263
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3264
     Transcript showCR:'interest in #foo:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3265
     p expressInterestIn:#foo for:b sendBack:#value.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3266
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3267
     Transcript showCR:'now changing #bar ... (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3268
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3269
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3270
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3271
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3272
     Transcript showCR:'now changing #foo ... (expect notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3273
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3274
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3275
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3276
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3277
     Transcript showCR:'no more interest in #foo:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3278
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3279
     Transcript showCR:'now changing #foo ... (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3280
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3281
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3282
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3283
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3284
     Transcript showCR:'interest in #bar now:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3285
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3286
     Transcript showCR:'now changing #foo ... (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3287
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3288
     Transcript showCR:'now changing #bar ... (expect notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3289
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3290
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3291
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3292
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3293
     Transcript showCR:'interest in #foo now:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3294
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3295
     Transcript showCR:'now changing #foo ... (expect notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3296
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3297
     Transcript showCR:'now changing #bar ... (expect notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3298
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3299
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3300
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3301
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3302
     Transcript showCR:'no more interests:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3303
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3304
     Transcript showCR:'now changing #foo ... (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3305
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3306
     Transcript showCR:'now changing #bar...  (expect no notification)'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3307
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3308
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3309
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3310
     p release.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3311
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3312
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3313
    "Created: 19.4.1996 / 10:26:22 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3314
    "Modified: 19.4.1996 / 12:34:08 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3315
    "Modified: 14.10.1996 / 22:28:20 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3316
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3317
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3318
interests
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3319
    "return a Collection of interests - empty if there is none.
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3320
     Here, we use the nonWeakDependents for interests."
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3321
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3322
    ^ self nonWeakDependents
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3323
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3324
    "Created: / 14.10.1996 / 22:20:51 / stefan"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3325
    "Modified: / 30.1.1998 / 14:07:35 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3326
!
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3327
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3328
interestsFor:someOne
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3329
    "return a collection of interests of someOne - empty if there is none."
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3330
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3331
    |coll deps|
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3332
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3333
    deps := self interests.
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3334
    deps size == 0 ifTrue:[^ #()].
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3335
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3336
    coll := IdentitySet new.
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3337
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3338
    deps do:[:dep |
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3339
	(dep isMemberOf:InterestConverter) ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3340
	    dep destination == someOne ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3341
		coll add:dep.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3342
	    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3343
	]
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3344
    ].
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3345
    ^ coll
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3346
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3347
    "Created: / 30.1.1998 / 14:02:26 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3348
    "Modified: / 30.1.1998 / 14:08:24 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3349
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3350
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3351
onChangeSend:aSelector to:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3352
    "arrange for aSelector to be sent to anObject whenever the receiver
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3353
     changes."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3354
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3355
    "/ for now, use an interestConverter, which is somewhat less efficient.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3356
    "/ In the future, a more intelligent DependencyCollection class is planned for
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3357
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3358
    self addInterest:(InterestConverter 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3359
			  destination:anObject 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3360
			  selector:aSelector)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3361
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3362
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3363
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3364
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3365
     b := [Transcript showCR:'the point changed'].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3366
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3367
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3368
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3369
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3370
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3371
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3372
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3373
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3374
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3375
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3376
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3377
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3378
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3379
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3380
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3381
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3382
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3383
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3384
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3385
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3386
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3387
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3388
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3389
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3390
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3391
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3392
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3393
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3394
    "Created: 19.4.1996 / 10:26:38 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3395
    "Modified: 19.4.1996 / 12:34:26 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3396
    "Modified: 14.10.1996 / 22:28:27 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3397
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3398
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3399
removeInterest:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3400
    "remove an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3401
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3402
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3403
    self removeNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3404
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3405
    "Created: 14.10.1996 / 22:21:59 / stefan"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3406
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3407
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3408
retractInterestIn:aspect for:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3409
    "remove the interest of someOne in the receiver changing aspect
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3410
     (as installed with #expressInterestIn:for:sendBack:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3411
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3412
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3413
    "/ In the future, a more intelligent DependencyCollection class is planned for
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3414
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3415
    "/ cannot removeDependent within the loop - the collection rehashes
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3416
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3417
    |deps coll|
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3418
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3419
    deps := self interests.
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3420
    deps size ~~ 0 ifTrue:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3421
	coll := IdentitySet new.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3422
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3423
	deps do:[:dep |
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3424
	    (dep isMemberOf:InterestConverter) ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3425
		dep destination == someOne ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3426
		    dep aspect == aspect ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3427
			self removeInterest:dep.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3428
			^ self
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3429
		    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3430
		]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3431
	    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3432
	].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3433
	coll do:[:dep |
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3434
	    self removeInterest:dep.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3435
	].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3436
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3437
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3438
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3439
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3440
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3441
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3442
     b := [Transcript showCR:'the point changed'].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3443
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3444
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3445
     Transcript showCR:'interest in #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3446
     p expressInterestIn:#foo for:b sendBack:#value.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3447
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3448
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3449
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3450
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3451
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3452
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3453
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3454
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3455
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3456
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3457
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3458
     Transcript showCR:'no more interest in #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3459
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3460
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3461
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3462
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3463
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3464
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3465
     Transcript showCR:'interest in #bar now'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3466
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3467
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3468
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3469
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3470
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3471
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3472
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3473
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3474
     Transcript showCR:'interest in #foo now'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3475
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3476
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3477
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3478
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3479
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3480
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3481
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3482
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3483
     Transcript showCR:'no more interests'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3484
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3485
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3486
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3487
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3488
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3489
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3490
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3491
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3492
    "Created: / 19.4.1996 / 10:27:11 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3493
    "Modified: / 14.10.1996 / 22:21:19 / stefan"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3494
    "Modified: / 30.1.1998 / 14:05:34 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3495
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3496
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3497
retractInterestsFor:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3498
    "remove the interest of someOne in the receiver 
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3499
     (as installed with #onChangeSend:to:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3500
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3501
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3502
    "/ In the future, a more intelligent DependencyCollection class is planned for
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3503
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3504
    |coll deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3505
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3506
    "/ cannot removeDependent within the loop - the collection rehashes
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3507
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3508
    deps := self interests.
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3509
    deps size ~~ 0 ifTrue:[
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3510
	coll := IdentitySet new.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3511
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3512
	deps do:[:dep |
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3513
	    (dep isMemberOf:InterestConverter) ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3514
		dep destination == someOne ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3515
		    coll add:dep.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3516
		]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3517
	    ]
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3518
	].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3519
	coll do:[:dep |
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3520
	    self removeInterest:dep.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3521
	].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3522
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3523
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3524
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3525
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3526
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3527
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3528
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3529
     b := [Transcript showCR:'the point changed'].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3530
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3531
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3532
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3533
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3534
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3535
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3536
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3537
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3538
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3539
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3540
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3541
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3542
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3543
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3544
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3545
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3546
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3547
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3548
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3549
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3550
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3551
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3552
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3553
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3554
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3555
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3556
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3557
3254
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3558
    "Created: / 19.4.1996 / 10:23:46 / cg"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3559
    "Modified: / 14.10.1996 / 22:21:25 / stefan"
40b21297d9ab #interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents: 3228
diff changeset
  3560
    "Modified: / 30.1.1998 / 14:04:52 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3561
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3562
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3563
!Object methodsFor:'interrupt handling'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3564
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3565
childSignalInterrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3566
    "death of a child process (unix process) - do nothing"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3567
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3568
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3569
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3570
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3571
customInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3572
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3573
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3574
    "a custom interrupt"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3575
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3576
    ^ self error:'custom interrupt'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3577
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3578
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3579
errorInterrupt:errorID with:aParameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3580
    "subsystem error. The arguments errorID and aParameter are the values passed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3581
     to the 'errorInterruptWithIDAndParameter(id, param)' function, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3582
     which can be called from C subsystems to raise an (asynchronous)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3583
     error exception.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3584
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3585
     Currently, this is used to map XErrors to smalltalk errors, but can be
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3586
     used from other C subsystems too, to upcast errors.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3587
     Especially, for subsystems which call errorHandler functions asynchronously.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3588
     IDs (currently) used:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3589
	#DisplayError ..... x-error interrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3590
	#XtError      ..... xt-error interrupt (Xt interface is not yet published)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3591
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3592
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3593
    |handler|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3594
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3595
    handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3596
    handler notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3597
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3598
	"/ handler found; let it do whatever it wants ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3599
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3600
	handler errorInterrupt:errorID with:aParameter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3601
	^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3602
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3603
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3604
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3605
    "/ no handler - raise errorSignal passing the errorId as parameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3606
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3607
    ^ ErrorSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3608
	raiseRequestWith:errorID 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3609
	errorString:('Subsystem error. ErrorID = ' , errorID printString)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3610
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3611
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3612
exceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3613
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3614
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3615
    "exception interrupt - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3616
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3617
    self error:'exception Interrupt'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3618
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3619
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3620
fpExceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3621
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3622
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3623
    "a floating point exception occured - this one
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3624
     has to be handled differently since it comes asynchronous
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3625
     on some machines (for example, on machines with a separate FPU
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3626
     or superscalar architectures. Also, errors from within primitive code
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3627
     (or library functions such as GL) are sent via the Unix-signal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3628
     mechanism this way."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3629
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3630
    |where rec|
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3631
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3632
    where := thisContext sender.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3633
    rec := where receiver.
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3634
    rec isNumber ifTrue:[
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3635
	^ rec class
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3636
	    raise:#domainErrorSignal
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3637
	    receiver:rec
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3638
	    selector:where selector
3398
c2107987b232 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3396
diff changeset
  3639
	    arguments:(where args asArray)
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3640
	    errorString:'floating point exception'
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3641
    ].
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3642
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3643
    "/ could be in some C-library ...
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3644
    ^ Float domainErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3645
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3646
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3647
internalError:msg
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3648
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3649
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3650
    "this is triggered, when VM hits some bad error,
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3651
     such as corrupted class, corrupted method/selector array
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3652
     etc. The argument string gives some more information on what happened.
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3653
     (for example, if you set an objects class to a non-behavior, nil etc.).
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3654
     Its not guaranteed, that the system is in a working condition once
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3655
     this error occurred ...."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3656
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3657
    ^ InternalErrorSignal
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3658
	  raiseRequestWith:self
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3659
	  errorString:msg
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3660
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3661
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3662
ioInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3663
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3664
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3665
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3666
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3667
     or it does not understand the ioInterrupt message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3668
     In any case, this is a sign of some big trouble. Enter debugger."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3669
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3670
    self error:'I/O Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3671
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3672
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3673
memoryInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3674
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3675
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3676
    "out-of-memory interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3677
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3678
    ^ self error:'almost out of memory'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3679
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3680
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3681
recursionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3682
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3683
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3684
    "recursion limit (actually: stack overflow) interrupt.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3685
     This interrupt is triggered, when a process stack grows above
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3686
     its stackLimit - usually, this leads into the debugger, but
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  3687
     could be caught and the stackLimit increased in the handler.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3688
     At the time we arrive here, the system has still some stack 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3689
     as a reserve so we can continue to do some useful work or cleanup or
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3690
     debugging for a while.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3691
     If the signal is ignored, and the stack continues to grow, there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3692
     will be a few more chances (and more interrupts) before the VM
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3693
     hard-terminates the process."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3694
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3695
    thisContext isRecursive ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3696
	^ RecursionInterruptSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3697
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3698
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3699
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3700
schedulerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3701
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3702
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3703
    "scheduler interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3704
     If we arrive here, either the Processor does not understand it,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3705
     or it has been set to nil. In any case, this is a sign of some
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3706
     big trouble. Enter debugger."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3707
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3708
    self error:'schedulerInterrupt - but no Processor'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3709
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3710
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3711
signalInterrupt:signalNumber
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3712
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3713
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3714
    "unix signal occured - some signals are handled as Smalltalk Exceptions 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3715
     (SIGPIPE), others (SIGBUS) are rather fatal ...
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3716
     In any case, IF a smalltalk-signal has been connected to the OS signal,
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3717
     that one is raised.
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3718
     Otherwise, a dialog is shown, asking the user on how to handle the
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3719
     signal.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3720
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3721
     exact cause etc.). This helps if segvs occur in primitive code.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3722
     Currently (temporary kludge), these are passed as global variables."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3723
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3724
    |box name here sig ignorable titles actions badContext msg pc addr
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3725
     action title|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3726
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3727
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3728
     special case - since SIGPIPE has an ST-signal associated
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3729
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3730
    (signalNumber == 13) ifTrue:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3731
        "SIGPIPE - write on a pipe with no one to read"
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3732
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3733
        ^ PipeStream brokenPipeSignal raise.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3734
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3735
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3736
    "if there has been an ST-signal installed, use it ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3737
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3738
    sig := OperatingSystem operatingSystemSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3739
    sig notNil ifTrue:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3740
        ^ sig raise
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3741
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3742
3423
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  3743
    "/ if handled, raise OSSignalInterruptSignal
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  3744
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  3745
    OSSignalInterruptSignal isHandled ifTrue:[
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  3746
        ^ OSSignalInterruptSignal raiseWith:signalNumber
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  3747
    ].
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  3748
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3749
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3750
     ... otherwise , bring up a box asking for what to do ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3751
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3752
    name := OperatingSystem nameForSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3753
    here := thisContext.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3754
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3755
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3756
     the context, in which the signal occurred:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3757
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3758
    badContext := here sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3759
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3760
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3761
     ungrab - in case it happened in a box/popupview
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3762
     otherwise display stays locked
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3763
    "
2851
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3764
"/    Display notNil ifTrue:[
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3765
"/        Display ungrabPointer.
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3766
"/        Display ungrabKeyboard.
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3767
"/    ].
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3768
    Screen notNil ifTrue:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3769
        Screen allScreens do:[:aScreen |
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3770
            aScreen ungrabPointer.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3771
            aScreen ungrabKeyboard.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3772
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3773
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3774
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3775
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3776
     SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3777
     since the system will retry the faulty instruction, which leads to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3778
     another signal - to avoid frustration, better not offer this option.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3779
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3780
    ignorable := (signalNumber ~~ OperatingSystem sigBUS)
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3781
                  and:[signalNumber ~~ OperatingSystem sigILL
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3782
                  and:[signalNumber ~~ OperatingSystem sigSEGV]].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3784
    ignorable ifFalse:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3785
        here isRecursive ifTrue:[
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3786
            'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3787
            MiniDebugger enterWithMessage:'recursive signal'.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3788
            ^ self
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3789
        ].
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3790
        "
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3791
         a hard signal - go into debugger immediately
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3792
        "
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3793
        msg := 'OS-signal: ', name.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3794
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3795
        "/ the IRQ-PC is passed as low-hi, to avoid the need
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3796
        "/ to allocate a LargeInteger in the VM during signal
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3797
        "/ time. I know, this is ugly.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3798
        
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3799
        InterruptPcLow notNil ifTrue:[
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3800
            pc := InterruptPcLow + (InterruptPcHi bitShift:(SmallInteger maxBits + 1 // 2)).
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3801
            pc ~~ 0 ifTrue:[
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3802
                msg := msg , ' PC=' , (pc printStringRadix:16)
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3803
            ].
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3804
        ].
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3805
        InterruptAddrLow notNil ifTrue:[
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3806
            addr := InterruptAddrLow + (InterruptAddrHi bitShift:(SmallInteger maxBits + 1 // 2)).
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3807
            addr ~~ 0 ifTrue:[
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3808
                msg := msg , ' ADDR=' , (addr printStringRadix:16)
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3809
            ].
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3810
        ].
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3811
        Debugger enter:here withMessage:msg. 
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3812
        badContext return.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3813
        ^ nil.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3814
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3815
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3816
    OptionBox isNil ifTrue:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3817
        "
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3818
         a system without GUI ...
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3819
         go into minidebugger (if there is one)
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3820
        "
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3821
        MiniDebugger isNil ifTrue:[
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3822
            "
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3823
             a system without debugging facilities
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3824
             (i.e. a standalone system)
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3825
             output a message and exit.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3826
            "
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3827
            ('Object [error]: exit due to Signal ' , name , ' - and no debugger.') errorPrintCR.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3828
            Smalltalk exit.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3829
        ].
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3830
        MiniDebugger enterWithMessage:'Signal caught (' , name, ')'.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3831
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3832
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3833
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3834
    titles := #('dump core' 'exit ST/X').
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3835
    actions := Array 
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3836
                 with:[Smalltalk fatalAbort]
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3837
                 with:[Smalltalk exit].
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3838
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3839
    action := nil.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3840
    title := 'OS Signal caught (' , name, ')'.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3841
    title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3842
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3843
    "/ if cought while in the scheduler or event dispatcher,
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3844
    "/ a modal dialog is not possible ...
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3845
    "/ (therefore, debug & return make no sense)
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3846
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3847
    Processor activeProcess isSystemProcess ifFalse:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3848
        titles := #('abort' 'debug') , titles.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3849
        actions := (Array
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3850
                        with:[action := #abort]
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3851
                        with:[action := #debug]) , actions.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3852
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3853
        badContext canReturn ifTrue:[
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3854
            titles := #('return') , titles.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3855
            actions := (Array with:[action := #return]) , actions.
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3856
        ].
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3857
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3858
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3859
    ignorable ifTrue:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3860
        titles := titles, #('ignore').
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3861
        actions := actions , (Array with:[action := #ignore]).
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3862
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3863
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3864
    box := OptionBox 
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3865
                title:title
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3866
                numberOfOptions:actions size.
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3867
    ignorable ifTrue:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3868
        box defaultButtonIndex:(actions size)
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3869
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3870
    box buttonTitles:titles.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3871
    box actions:actions.
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3872
    box showAtPointer.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3873
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3874
    action == #return ifTrue:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3875
        badContext return
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3876
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3877
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3878
    action == #abort ifTrue:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3879
        AbortSignal raise.
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3880
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3881
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3882
    action == #debug ifTrue:[
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3883
        Debugger enter:here withMessage:('Signal ', name). 
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3884
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3885
3418
8aafd5280caf construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents: 3398
diff changeset
  3886
    "Modified: / 4.5.1998 / 20:39:16 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3887
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3888
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3889
spyInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3890
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3891
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3892
    "spy interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3893
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3894
    self error:'spy Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3895
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3896
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3897
timerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3898
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3899
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3900
    "timer interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3901
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3902
    self error:'timer Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3903
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3904
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3905
userInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3906
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3907
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3908
    "user (^c) interrupt.
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3909
     This is typically sent by the VM, when a ctrl-C is typed at the
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3910
     controlling tty (i.e. in the xterm)."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3911
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3912
    UserInterruptSignal raise
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3913
!
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3914
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3915
userInterruptIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3916
    "{ Pragma: +optSpace }"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3917
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3918
    "user (^c) interrupt - enter debugger, but show aContext
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3919
     as top-context. 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3920
     This is used to hide any intermediate scheduler contexts, 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3921
     in case of an interrupted process. Typically, this is sent by
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3922
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3923
     processed."
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3924
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3925
    UserInterruptSignal raiseIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3926
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3927
    "Created: 18.10.1996 / 20:46:04 / cg"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3928
    "Modified: 20.10.1996 / 13:06:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3929
! !
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3930
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3931
!Object methodsFor:'message sending'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3932
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3933
perform:aSelector
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3934
    "send the message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3935
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3936
%{
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  3937
    REGISTER OBJ sel = aSelector;
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3938
    struct inlineCache *pIlc;
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  3939
    static struct inlineCache ilc_0 = __ILCPERF0(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  3940
    static struct inlineCache ilc_1 = __ILCPERF0(@line);
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  3941
    static struct inlineCache ilc_2 = __ILCPERF0(@line);
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  3942
    static struct inlineCache ilc_3 = __ILCPERF0(@line);
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  3943
    static struct inlineCache ilc_4 = __ILCPERF0(@line);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3944
    static OBJ last_0 = nil;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3945
    static OBJ last_1 = nil;
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  3946
    static OBJ last_2 = nil;
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  3947
    static OBJ last_3 = nil;
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  3948
    static OBJ last_4 = nil;
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3949
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3950
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  3951
    if (InterruptPending == nil) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3952
	if (sel == last_0) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3953
	    RETURN ( (*(ilc_0.ilc_func))(self, sel, nil, &ilc_0) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3954
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3955
	if (sel == last_1) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3956
	    RETURN ( (*(ilc_1.ilc_func))(self, sel, nil, &ilc_1) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3957
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3958
	if (sel == last_2) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3959
	    RETURN ( (*(ilc_2.ilc_func))(self, sel, nil, &ilc_2) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3960
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3961
	if (sel == last_3) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3962
	    RETURN ( (*(ilc_3.ilc_func))(self, sel, nil, &ilc_3) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3963
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3964
	if (sel == last_4) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3965
	    RETURN ( (*(ilc_4.ilc_func))(self, sel, nil, &ilc_4) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3966
	}
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  3967
        
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3968
	if (flip == 0) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3969
	    pIlc = &ilc_0;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3970
	    flip = 1;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3971
	    last_0 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3972
	} else if (flip == 1) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3973
	    pIlc = &ilc_1;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3974
	    flip = 2;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3975
	    last_1 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3976
	} else if (flip == 2) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3977
	    pIlc = &ilc_2;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3978
	    flip = 3;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3979
	    last_2 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3980
	} else if (flip == 3) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3981
	    pIlc = &ilc_3;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3982
	    flip = 4;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3983
	    last_3 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3984
	} else {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3985
	    pIlc = &ilc_4;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3986
	    flip = 0;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3987
	    last_4 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3988
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3989
	pIlc->ilc_func = __SEND0ADDR__;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3990
	if (pIlc->ilc_poly) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3991
	    __flushPolyCache(pIlc->ilc_poly);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3992
	    pIlc->ilc_poly = 0;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3993
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3994
	RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3995
    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3996
	static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  3997
	RETURN (_SEND0(self, aSelector, nil, &ilc0));
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3998
    }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3999
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4000
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4001
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4002
perform:aSelector inClass:aClass withArguments:argArray
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4003
    "send the message aSelector with all args taken from argArray 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4004
     to the receiver as a super-send message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4005
     This is actually more flexible than the normal super-send, since it allows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4006
     to execute a method in ANY superclass of the receiver (not just the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4007
     immediate superclass).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4008
     Thus, it is (theoretically) possible to do 
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4009
	 '5 perform:#< inClass:Magnitude withArguments:#(6)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4010
     and evaluate Magnitudes compare method even if there was one in Number.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4011
     This method is used by the interpreter to evaluate super sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4012
     and could be used for very special behavior (language extension ?).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4013
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4014
     WARNING: this is an ST/X feature - probably not found in other smalltalks."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4015
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4016
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4017
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4018
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4019
     check, if aClass is really a superclass of the receiver
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4020
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4021
    (self class isSubclassOf:aClass) ifFalse:[
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4022
	self error:'class argument is not a superclass of the receiver'.
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4023
	^ nil
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4024
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4025
%{
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4026
    REGISTER OBJ *argP;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4027
    int nargs, i;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4028
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4029
    if (__isArray(argArray)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4030
	nargs = __arraySize(argArray);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4031
	argP = __ArrayInstPtr(argArray)->a_element;
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4032
    } else {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4033
	if (__isNonNilObject(argArray)) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4034
	    static struct inlineCache ilcSize = __ILC0(@line+1);
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4035
	    numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4036
	    if (!__isSmallInteger(numberOfArgs)) 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4037
		goto bad;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4038
	    nargs = __intVal(numberOfArgs);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4039
	    argP = (OBJ *)(&a1);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4040
	    for (i=1; i <= nargs; i++) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4041
		*argP++ = __AT_(argArray, __MKSMALLINT(i));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4042
	    }
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4043
	    argP = (OBJ *)(&a1);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4044
	} else {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4045
	    nargs = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4046
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4047
    }
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4048
    switch (nargs) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4049
	case 0:
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4050
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4051
		static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4052
		RETURN ( _SEND0(self, aSelector, aClass, &ilc0));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4053
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4054
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4055
	case 1: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4056
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4057
		static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4058
		RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4059
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4060
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4061
	case 2: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4062
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4063
		static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4064
		RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4065
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4066
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4067
	case 3: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4068
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4069
		static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4070
		RETURN ( _SEND3(self, aSelector, aClass, &ilc3, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4071
				argP[0], argP[1], argP[2]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4072
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4073
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4074
	case 4: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4075
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4076
		static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4077
		RETURN ( _SEND4(self, aSelector, aClass, &ilc4,
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4078
				argP[0], argP[1], argP[2], argP[3]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4079
	    }
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4080
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4081
	case 5: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4082
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4083
		static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4084
		RETURN ( _SEND5(self, aSelector, aClass, &ilc5, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4085
				argP[0], argP[1], argP[2], argP[3], argP[4]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4086
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4087
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4088
	case 6: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4089
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4090
		static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4091
		RETURN ( _SEND6(self, aSelector, aClass, &ilc6, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4092
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4093
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4094
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4095
	case 7: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4096
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4097
		static struct inlineCache ilc7 = __DUMMYILCSELF7(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4098
		RETURN ( _SEND7(self, aSelector, aClass, &ilc7, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4099
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4100
				argP[6]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4101
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4102
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4103
	case 8: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4104
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4105
		static struct inlineCache ilc8 = __DUMMYILCSELF8(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4106
		RETURN ( _SEND8(self, aSelector, aClass, &ilc8, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4107
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4108
				argP[6], argP[7]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4109
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4110
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4111
	case 9: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4112
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4113
		static struct inlineCache ilc9 = __DUMMYILCSELF9(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4114
		RETURN ( _SEND9(self, aSelector, aClass, &ilc9, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4115
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4116
				argP[6], argP[7], argP[8]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4117
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4118
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4119
	case 10: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4120
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4121
		static struct inlineCache ilc10 = __DUMMYILCSELF10(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4122
		RETURN ( _SEND10(self, aSelector, aClass, &ilc10, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4123
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4124
				 argP[6], argP[7], argP[8], argP[9]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4125
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4126
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4127
	case 11: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4128
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4129
		static struct inlineCache ilc11 = __DUMMYILCSELF11(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4130
		RETURN ( _SEND11(self, aSelector, aClass, &ilc11, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4131
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4132
				 argP[6], argP[7], argP[8], argP[9], argP[10]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4133
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4134
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4135
	case 12: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4136
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4137
		static struct inlineCache ilc12 = __DUMMYILCSELF12(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4138
		RETURN ( _SEND12(self, aSelector, aClass, &ilc12, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4139
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4140
				 argP[6], argP[7], argP[8], argP[9], argP[10], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4141
				 argP[11]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4142
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4143
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4144
	case 13: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4145
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4146
		static struct inlineCache ilc13 = __DUMMYILCSELF13(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4147
		RETURN ( _SEND13(self, aSelector, aClass, &ilc13, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4148
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4149
				 argP[6], argP[7], argP[8], argP[9], argP[10], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4150
				 argP[11], argP[12]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4151
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4152
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4153
	case 14: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4154
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4155
		static struct inlineCache ilc14 = __DUMMYILCSELF14(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4156
		RETURN ( _SEND14(self, aSelector, aClass, &ilc14, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4157
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4158
				 argP[6], argP[7], argP[8], argP[9], argP[10], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4159
				 argP[11], argP[12], argP[13]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4160
	    }
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4161
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4162
	case 15: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4163
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4164
		static struct inlineCache ilc15 = __DUMMYILCSELF15(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4165
		RETURN ( _SEND15(self, aSelector, aClass, &ilc15, 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4166
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4167
				 argP[6], argP[7], argP[8], argP[9], argP[10], 
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4168
				 argP[11], argP[12], argP[13], argP[14]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4169
	    }
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4170
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4171
#ifdef _SEND16
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4172
	case 16:
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4173
	    {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4174
		static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4175
		RETURN ( _SEND15(self, aSelector, aClass, &ilc15,
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4176
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4177
				 argP[6], argP[7], argP[8], argP[9], argP[10],
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4178
				 argP[11], argP[12], argP[13], argP[14], argP[15]));
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4179
	    }
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4180
#endif
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4181
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4182
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4183
    }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4184
bad:;
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4185
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4186
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4187
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4188
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4189
    ^ self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4190
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4191
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4192
perform:aSelector with:arg
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4193
    "send the one-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4194
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4195
%{
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4196
    REGISTER OBJ sel = aSelector;
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4197
    struct inlineCache *pIlc;
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4198
    static struct inlineCache ilc_0 = __ILCPERF1(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4199
    static struct inlineCache ilc_1 = __ILCPERF1(@line);
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4200
    static struct inlineCache ilc_2 = __ILCPERF1(@line);
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4201
    static struct inlineCache ilc_3 = __ILCPERF1(@line);
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4202
    static struct inlineCache ilc_4 = __ILCPERF1(@line);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4203
    static OBJ last_0 = nil;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4204
    static OBJ last_1 = nil;
3317
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4205
    static OBJ last_2 = nil;
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4206
    static OBJ last_3 = nil;
8c0d47236f4b now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents: 3309
diff changeset
  4207
    static OBJ last_4 = nil;
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4208
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4209
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4210
    if (InterruptPending == nil) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4211
	if (sel == last_0) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4212
	    RETURN ( (*(ilc_0.ilc_func))(self, sel, nil, &ilc_0, arg) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4213
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4214
	if (sel == last_1) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4215
	    RETURN ( (*(ilc_1.ilc_func))(self, sel, nil, &ilc_1, arg) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4216
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4217
	if (sel == last_2) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4218
	    RETURN ( (*(ilc_2.ilc_func))(self, sel, nil, &ilc_2, arg) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4219
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4220
	if (sel == last_3) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4221
	    RETURN ( (*(ilc_3.ilc_func))(self, sel, nil, &ilc_3, arg) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4222
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4223
	if (sel == last_4) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4224
	    RETURN ( (*(ilc_4.ilc_func))(self, sel, nil, &ilc_4, arg) );
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4225
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4226
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4227
	if (flip == 0) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4228
	    pIlc = &ilc_0;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4229
	    flip = 1;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4230
	    last_0 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4231
	} else if (flip == 1) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4232
	    pIlc = &ilc_1;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4233
	    flip = 2;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4234
	    last_1 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4235
	} else if (flip == 2) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4236
	    pIlc = &ilc_2;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4237
	    flip = 3;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4238
	    last_2 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4239
	} else if (flip == 3) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4240
	    pIlc = &ilc_3;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4241
	    flip = 4;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4242
	    last_3 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4243
	} else {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4244
	    pIlc = &ilc_4;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4245
	    flip = 0;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4246
	    last_4 = sel;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4247
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4248
	pIlc->ilc_func = __SEND1ADDR__;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4249
	if (pIlc->ilc_poly) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4250
	    __flushPolyCache(pIlc->ilc_poly);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4251
	    pIlc->ilc_poly = 0;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4252
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4253
	RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4254
    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4255
	static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4256
	RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4257
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4258
%}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4259
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4260
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4261
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4262
perform:aSelector with:arg1 with:arg2
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4263
    "send the two-arg-message aSelector to the receiver"
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4264
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4265
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4266
    struct inlineCache *pIlc;
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4267
    static struct inlineCache ilc_0 = __ILCPERF2(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4268
    static struct inlineCache ilc_1 = __ILCPERF2(@line);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4269
    static OBJ last_0 = nil;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4270
    static OBJ last_1 = nil;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4271
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4272
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4273
    if (InterruptPending == nil) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4274
	if (aSelector != last_0) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4275
	    if (aSelector != last_1) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4276
		if (flip) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4277
		    pIlc = &ilc_0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4278
		    flip = 0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4279
		    last_0 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4280
		} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4281
		    pIlc = &ilc_1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4282
		    flip = 1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4283
		    last_1 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4284
		}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4285
		pIlc->ilc_func = __SEND2ADDR__;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4286
		if (pIlc->ilc_poly) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4287
		    __flushPolyCache(pIlc->ilc_poly);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4288
		    pIlc->ilc_poly = 0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4289
		}
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4290
	    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4291
		pIlc = &ilc_1;
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4292
	    }
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4293
	} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4294
	    pIlc = &ilc_0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4295
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4296
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2) );
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4297
    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4298
	static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4299
	RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2));
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4300
    }
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4301
%}
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4302
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4303
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4304
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4305
perform:aSelector with:arg1 with:arg2 with:arg3
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4306
    "send the three-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4307
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4308
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4309
    struct inlineCache *pIlc;
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4310
    static struct inlineCache ilc_0 = __ILCPERF3(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4311
    static struct inlineCache ilc_1 = __ILCPERF3(@line);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4312
    static OBJ last_0 = nil;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4313
    static OBJ last_1 = nil;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4314
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4315
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4316
    if (InterruptPending == nil) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4317
	if (aSelector != last_0) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4318
	    if (aSelector != last_1) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4319
		if (flip) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4320
		    pIlc = &ilc_0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4321
		    flip = 0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4322
		    last_0 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4323
		} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4324
		    pIlc = &ilc_1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4325
		    flip = 1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4326
		    last_1 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4327
		}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4328
		pIlc->ilc_func = __SEND3ADDR__;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4329
		if (pIlc->ilc_poly) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4330
		    __flushPolyCache(pIlc->ilc_poly);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4331
		    pIlc->ilc_poly = 0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4332
		}
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4333
	    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4334
		pIlc = &ilc_1;
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4335
	    }
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4336
	} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4337
	    pIlc = &ilc_0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4338
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4339
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4340
				     arg1, arg2, arg3) );
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  4341
    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4342
	static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4343
	RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3));
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4344
    }
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4345
%}
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4346
!
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4347
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4348
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4349
    "send the four-arg-message aSelector to the receiver"
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4350
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4351
%{
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4352
    struct inlineCache *pIlc;
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4353
    static struct inlineCache ilc_0 = __ILCPERF4(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4354
    static struct inlineCache ilc_1 = __ILCPERF4(@line);
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4355
    static OBJ last_0 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4356
    static OBJ last_1 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4357
    static flip = 0;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4358
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4359
    if (InterruptPending == nil) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4360
	if (aSelector != last_0) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4361
	    if (aSelector != last_1) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4362
		if (flip) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4363
		    pIlc = &ilc_0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4364
		    flip = 0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4365
		    last_0 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4366
		} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4367
		    pIlc = &ilc_1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4368
		    flip = 1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4369
		    last_1 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4370
		}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4371
		pIlc->ilc_func = __SEND4ADDR__;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4372
		if (pIlc->ilc_poly) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4373
		    __flushPolyCache(pIlc->ilc_poly);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4374
		    pIlc->ilc_poly = 0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4375
		}
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4376
	    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4377
		pIlc = &ilc_1;
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4378
	    }
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4379
	} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4380
	    pIlc = &ilc_0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4381
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4382
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4383
				     arg1, arg2, arg3, arg4) );
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4384
    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4385
	static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4386
	RETURN (_SEND4(self, aSelector, nil, &ilc4,
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4387
		       arg1, arg2, arg3, arg4));
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4388
    }
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  4389
%}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4390
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4391
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4392
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4393
    "send the five-arg-message aSelector to the receiver"
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4394
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4395
%{
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4396
    struct inlineCache *pIlc;
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4397
    static struct inlineCache ilc_0 = __ILCPERF5(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4398
    static struct inlineCache ilc_1 = __ILCPERF5(@line);
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4399
    static OBJ last_0 = nil;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4400
    static OBJ last_1 = nil;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4401
    static flip = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4402
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4403
    if (InterruptPending == nil) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4404
	if (aSelector != last_0) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4405
	    if (aSelector != last_1) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4406
		if (flip) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4407
		    pIlc = &ilc_0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4408
		    flip = 0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4409
		    last_0 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4410
		} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4411
		    pIlc = &ilc_1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4412
		    flip = 1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4413
		    last_1 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4414
		}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4415
		pIlc->ilc_func = __SEND5ADDR__;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4416
		if (pIlc->ilc_poly) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4417
		    __flushPolyCache(pIlc->ilc_poly);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4418
		    pIlc->ilc_poly = 0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4419
		}
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4420
	    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4421
		pIlc = &ilc_1;
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4422
	    }
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4423
	} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4424
	    pIlc = &ilc_0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4425
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4426
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4427
				     arg1, arg2, arg3, arg4, arg5) );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4428
    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4429
	static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4430
	RETURN (_SEND5(self, aSelector, nil, &ilc5,
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4431
		       arg1, arg2, arg3, arg4, arg5));
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4432
    }
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4433
%}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4434
!
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4435
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4436
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 with:arg6
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4437
    "send the six-arg-message aSelector to the receiver"
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4438
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4439
%{
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4440
    struct inlineCache *pIlc;
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4441
    static struct inlineCache ilc_0 = __ILCPERF6(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4442
    static struct inlineCache ilc_1 = __ILCPERF6(@line);
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4443
    static OBJ last_0 = nil;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4444
    static OBJ last_1 = nil;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4445
    static flip = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4446
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4447
    if (InterruptPending == nil) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4448
	if (aSelector != last_0) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4449
	    if (aSelector != last_1) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4450
		if (flip) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4451
		    pIlc = &ilc_0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4452
		    flip = 0;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4453
		    last_0 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4454
		} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4455
		    pIlc = &ilc_1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4456
		    flip = 1;
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4457
		    last_1 = aSelector;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4458
		}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4459
		pIlc->ilc_func = __SEND6ADDR__;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4460
		if (pIlc->ilc_poly) {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4461
		    __flushPolyCache(pIlc->ilc_poly);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4462
		    pIlc->ilc_poly = 0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4463
		}
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4464
	    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4465
		pIlc = &ilc_1;
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4466
	    }
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4467
	} else {
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4468
	    pIlc = &ilc_0;
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4469
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4470
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4471
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4472
				     arg1, arg2, arg3, arg4, arg5, arg6) );
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4473
    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  4474
	static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4475
	RETURN (_SEND6(self, aSelector, nil, &ilc6,
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4476
		       arg1, arg2, arg3, arg4, arg5, arg6));
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4477
    }
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4478
%}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4479
!
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4480
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4481
perform:aSelector withArguments:argArray
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4482
    "send the message aSelector with all args taken from argArray 
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  4483
     to the receiver."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4484
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  4485
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4486
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4487
%{
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4488
    REGISTER OBJ *argP;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4489
    int nargs, i;
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4490
    static struct inlineCache ilcSize = __ILC0(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4491
    static OBJ last0 = nil; static struct inlineCache ilc0 = __ILCPERF0(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4492
    static OBJ last1 = nil; static struct inlineCache ilc1 = __ILCPERF1(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4493
    static OBJ last2 = nil; static struct inlineCache ilc2 = __ILCPERF2(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4494
    static OBJ last3 = nil; static struct inlineCache ilc3 = __ILCPERF3(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4495
    static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4496
    static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4497
    static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4498
    static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4499
    static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4500
    static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4501
    static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4502
    static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4503
    static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4504
    static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4505
    static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line);
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4506
    static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line);
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4507
    OBJ l;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4508
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4509
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4510
    /*
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  4511
     * must set lineno in sender by hand here ... (because of NOCONTEXT)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4512
     */
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4513
    if ((l = __ILC_LNO_AS_OBJ(__pilc)) != __MKSMALLINT(0)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4514
	_ContextInstPtr(__thisContext)->c_lineno = l;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4515
    }
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4516
#endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4517
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4518
    if (__isArray(argArray)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4519
	nargs = __arraySize(argArray);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4520
	argP = __ArrayInstPtr(argArray)->a_element;
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4521
    } else {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4522
	if (__isNonNilObject(argArray)) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4523
	    numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4524
	    if (!__isSmallInteger(numberOfArgs)) 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4525
		goto bad;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4526
	    nargs = __intVal(numberOfArgs);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4527
	    argP = (OBJ *)(&a1);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4528
	    for (i=1; i <= nargs; i++) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4529
		*argP++ = __AT_(argArray, __MKSMALLINT(i));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4530
	    }
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4531
	    argP = (OBJ *)(&a1);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4532
	} else {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4533
	    nargs = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4534
	}
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4535
    }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4536
    switch (nargs) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4537
	case 0:
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4538
	    if ((InterruptPending != nil) || (aSelector != last0)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4539
		ilc0.ilc_func = __SEND0ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4540
		if (ilc0.ilc_poly) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4541
		    __flushPolyCache(ilc0.ilc_poly);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4542
		    ilc0.ilc_poly = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4543
		}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4544
		last0 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4545
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4546
#ifdef xxTHIS_CONTEXT  /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4547
	    ilc0.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  4548
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4549
	    RETURN ((*ilc0.ilc_func)(self, aSelector, nil, &ilc0));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4550
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4551
	case 1: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4552
	    if ((InterruptPending != nil) || (aSelector != last1)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4553
		ilc1.ilc_func = __SEND1ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4554
		if (ilc1.ilc_poly) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4555
		    __flushPolyCache(ilc1.ilc_poly);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4556
		    ilc1.ilc_poly = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4557
		}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4558
		last1 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4559
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4560
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4561
	    ilc1.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  4562
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4563
	    RETURN ( (*ilc1.ilc_func)(self, aSelector, nil, &ilc1, argP[0]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4564
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4565
	case 2: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4566
	    if ((InterruptPending != nil) || (aSelector != last2)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4567
		ilc2.ilc_func = __SEND2ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4568
		if (ilc2.ilc_poly) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4569
		    __flushPolyCache(ilc2.ilc_poly);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4570
		    ilc2.ilc_poly = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4571
		}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4572
		last2 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4573
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4574
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4575
	    ilc2.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4576
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4577
	    RETURN ( (*ilc2.ilc_func)(self, aSelector, nil, &ilc2, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4578
					    argP[0], argP[1]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4579
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4580
	case 3: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4581
	    if ((InterruptPending != nil) || (aSelector != last3)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4582
		ilc3.ilc_func = __SEND3ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4583
		if (ilc3.ilc_poly) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4584
		    __flushPolyCache(ilc3.ilc_poly);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4585
		    ilc3.ilc_poly = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4586
		}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4587
		last3 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4588
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4589
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4590
	    ilc3.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4591
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4592
	    RETURN ( (*ilc3.ilc_func)(self, aSelector, nil, &ilc3, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4593
					    argP[0], argP[1], argP[2]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4594
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4595
	case 4: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4596
	    if ((InterruptPending != nil) || (aSelector != last4)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4597
		ilc4.ilc_func = __SEND4ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4598
		if (ilc4.ilc_poly) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4599
		    __flushPolyCache(ilc4.ilc_poly);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4600
		    ilc4.ilc_poly = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4601
		}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4602
		last4 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4603
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4604
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4605
	    ilc4.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4606
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4607
	    RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4608
					    argP[0], argP[1], argP[2], argP[3]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4609
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4610
	case 5: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4611
	    if ((InterruptPending != nil) || (aSelector != last5)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4612
		ilc5.ilc_func = __SEND5ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4613
		if (ilc5.ilc_poly) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4614
		    __flushPolyCache(ilc5.ilc_poly);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4615
		    ilc5.ilc_poly = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4616
		}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4617
		last5 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4618
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4619
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4620
	    ilc5.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4621
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4622
	    RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4623
					    argP[0], argP[1], argP[2], argP[3], argP[4]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4624
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4625
	case 6: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4626
	    if ((InterruptPending != nil) || (aSelector != last6)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4627
		ilc6.ilc_func = __SEND6ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4628
		if (ilc6.ilc_poly) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4629
		    __flushPolyCache(ilc6.ilc_poly);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4630
		    ilc6.ilc_poly = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4631
		}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4632
		last6 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4633
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4634
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4635
	    ilc6.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4636
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4637
	    RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4638
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4639
					    argP[5]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4640
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4641
	case 7: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4642
	    if ((InterruptPending != nil) || (aSelector != last7)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4643
		ilc7.ilc_func = __SEND7ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4644
		if (ilc7.ilc_poly) {
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4645
		    __flushPolyCache(ilc7.ilc_poly);
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4646
		    ilc7.ilc_poly = 0;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4647
		}
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4648
		last7 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4649
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4650
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4651
	    ilc7.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4652
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4653
	    RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4654
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4655
					    argP[5], argP[6]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4656
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4657
	case 8:
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4658
	    if ((InterruptPending != nil) || (aSelector != last8)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4659
		ilc8.ilc_func = __SEND8ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4660
		last8 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4661
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4662
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4663
	    ilc8.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4664
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4665
	    RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4666
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4667
					    argP[5], argP[6], argP[7]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4668
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4669
	case 9: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4670
	    if ((InterruptPending != nil) || (aSelector != last9)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4671
		ilc9.ilc_func = __SEND9ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4672
		last9 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4673
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4674
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4675
	    ilc9.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4676
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4677
	    RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4678
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4679
					    argP[5], argP[6], argP[7], argP[8]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4680
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4681
	case 10: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4682
	    if ((InterruptPending != nil) || (aSelector != last10)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4683
		ilc10.ilc_func = __SEND10ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4684
		last10 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4685
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4686
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4687
	    ilc10.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4688
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4689
	    RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4690
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4691
					    argP[5], argP[6], argP[7], argP[8], argP[9]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4692
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4693
	case 11: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4694
	    if ((InterruptPending != nil) || (aSelector != last11)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4695
		ilc11.ilc_func = __SEND11ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4696
		last11 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4697
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4698
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4699
	    ilc11.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4700
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4701
	    RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4702
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4703
					    argP[5], argP[6], argP[7], argP[8], argP[9],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4704
					    argP[10]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4705
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4706
	case 12: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4707
	    if ((InterruptPending != nil) || (aSelector != last12)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4708
		ilc12.ilc_func = __SEND12ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4709
		last12 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4710
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4711
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4712
	    ilc12.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4713
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4714
	    RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4715
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4716
					    argP[5], argP[6], argP[7], argP[8], argP[9],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4717
					    argP[10], argP[11]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4718
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4719
	case 13: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4720
	    if ((InterruptPending != nil) || (aSelector != last13)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4721
		ilc13.ilc_func = __SEND13ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4722
		last13 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4723
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4724
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4725
	    ilc13.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4726
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4727
	    RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4728
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4729
					    argP[5], argP[6], argP[7], argP[8], argP[9],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4730
					    argP[10], argP[11], argP[12]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4731
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4732
	case 14: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4733
	    if ((InterruptPending != nil) || (aSelector != last14)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4734
		ilc14.ilc_func = __SEND14ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4735
		last14 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4736
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4737
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4738
	    ilc14.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4739
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4740
	    RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4741
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4742
					    argP[5], argP[6], argP[7], argP[8], argP[9],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4743
					    argP[10], argP[11], argP[12], argP[13]));
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4744
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4745
	case 15: 
3306
66c9ab533baa care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents: 3268
diff changeset
  4746
	    if ((InterruptPending != nil) || (aSelector != last15)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4747
		ilc15.ilc_func = __SEND15ADDR__;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4748
		last15 = aSelector;
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4749
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4750
#ifdef xxTHIS_CONTEXT /* not because this has a context */
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4751
	    ilc15.ilc_lineNo = __pilc->ilc_lineNo;
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  4752
#endif
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4753
	    RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, 
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4754
					    argP[0], argP[1], argP[2], argP[3], argP[4],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4755
					    argP[5], argP[6], argP[7], argP[8], argP[9],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4756
					    argP[10], argP[11], argP[12], argP[13],
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4757
					    argP[14]));
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4758
    }
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4759
bad:;
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4760
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4761
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4762
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4763
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4764
    ^ self primitiveFailed
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4765
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4766
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4767
performMethod:aMethod
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4768
    "invoke aMethod on the receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4769
     The method should be a zero-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4770
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4771
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4772
     Warning:
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4773
	 Take care for the method to be appropriate for the
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4774
	 receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4775
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4776
    ^ aMethod valueWithReceiver:self arguments:#()
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4777
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4778
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4779
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4780
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4781
     mthd := SmallInteger compiledMethodAt:#negated.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4782
     Transcript showCR:(1 performMethod:mthd)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4783
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4784
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4785
    "BAD USE example:
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4786
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4787
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4788
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4789
     mthd := Point compiledMethodAt:#x.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4790
     Transcript showCR:((1->2) performMethod:mthd)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4791
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4792
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4793
    "Modified: 31.7.1997 / 17:41:50 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4794
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4795
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4796
performMethod:aMethod arguments:argumentArray
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4797
    "invoke aMethod on the receiver, passing an argumentArray.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4798
     The size of the argumentArray should match the number of args
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4799
     expected by the method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4800
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4801
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4802
     Warning:
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4803
	 Take care for the method to be appropriate for the
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4804
	 receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4805
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4806
    ^ aMethod valueWithReceiver:self arguments:argumentArray
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4807
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4808
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4809
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4810
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4811
     mthd := SmallInteger compiledMethodAt:#+.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4812
     Transcript showCR:(1 performMethod:mthd arguments:#(2))
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4813
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4814
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4815
    "Created: 31.7.1997 / 17:46:31 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4816
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4817
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4818
performMethod:aMethod with:arg
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4819
    "invoke aMethod on the receiver, passing an argument.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4820
     The method should be a one-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4821
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4822
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4823
     Warning:
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4824
	 Take care for the method to be appropriate for the
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4825
	 receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4826
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4827
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4828
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4829
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4830
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4831
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4832
     mthd := SmallInteger compiledMethodAt:#+.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4833
     Transcript showCR:(1 performMethod:mthd with:2)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4834
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4835
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4836
    "Modified: 31.7.1997 / 17:42:32 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4837
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4838
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4839
performMethod:aMethod with:arg1 with:arg2
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4840
    "invoke aMethod on the receiver, passing two arguments.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4841
     The method should be a two-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4842
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4843
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4844
     Warning:
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4845
	 Take care for the method to be appropriate for the
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4846
	 receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4847
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4848
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4849
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4850
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4851
     |mthd arr|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4852
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4853
     arr := Array new:1.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4854
     mthd := Array compiledMethodAt:#basicAt:put:.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4855
     arr performMethod:mthd with:1 with:'foo'.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4856
     Transcript showCR:arr
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4857
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4858
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4859
    "Modified: 31.7.1997 / 17:44:54 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4860
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4861
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4862
performMethod:aMethod with:arg1 with:arg2 with:arg3
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4863
    "invoke aMethod on the receiver, passing three arguments.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4864
     The method should be a three-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4865
     This is a non-object-oriented entry, applying a method
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4866
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4867
     Warning:
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4868
	 Take care for the method to be appropriate for the
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  4869
	 receiver - no checking is done by the VM."
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4870
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4871
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2 with:arg3)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4872
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4873
    "Created: 31.7.1997 / 17:45:20 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4874
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4875
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4876
!Object methodsFor:'printing & storing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4877
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4878
className
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4879
    "return the classname of the receivers class"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4880
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4881
    ^ self class name
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4882
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4883
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4884
     1 className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4885
     1 class className   'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4886
     $a className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4887
     $a class className  'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4888
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4889
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4890
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4891
classNameWithArticle
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4892
    "return a string consisting of classname preceeded by an article.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4893
     (dont expect me to write national variants for this ... :-)
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4894
     If you have special preferences, redefine it ..."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4895
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4896
    |classname cls|
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4897
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4898
    (cls := self class) == self ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4899
	^ 'a funny object'
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4900
    ].
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4901
    classname := cls displayString.
85
claus
parents: 77
diff changeset
  4902
    ^ classname article , ' ' , classname
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4903
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4904
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4905
     1 classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4906
     (1->2) classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4907
     XWorkstation basicNew classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4908
    "
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4909
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4910
    "Modified: 13.5.1996 / 12:16:14 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4911
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4912
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4913
errorPrint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4914
    "print the receiver on the standard error stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4915
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4916
    Stream streamErrorSignal catch:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4917
	self printOn:Stderr
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4918
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4919
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4920
    "Modified: 7.3.1996 / 19:11:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4921
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4922
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4923
errorPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4924
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4925
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4926
    "print the receiver followed by a cr on the standard error stream."
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4927
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4928
    Stream streamErrorSignal catch:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4929
	self printOn:Stderr.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4930
	Stderr cr
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4931
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4932
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4933
    "Modified: 7.3.1996 / 19:13:01 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4934
    "Created: 20.5.1996 / 10:20:41 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4935
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4936
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4937
errorPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4938
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4939
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4940
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4941
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4942
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4943
    ^ self errorPrintCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4944
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4945
    "Modified: 20.5.1996 / 10:24:45 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4946
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4947
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4948
errorPrintNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4949
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4950
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4951
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4952
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4953
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4954
    self errorPrintCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4955
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4956
    "Modified: 20.5.1996 / 10:24:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4957
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4958
356
claus
parents: 348
diff changeset
  4959
infoPrint
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4960
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4961
356
claus
parents: 348
diff changeset
  4962
    "print the receiver on the standard error stream.
claus
parents: 348
diff changeset
  4963
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  4964
     or fatal messages.
claus
parents: 348
diff changeset
  4965
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  4966
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4967
    InfoPrinting == true ifTrue:[
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4968
	self errorPrint
356
claus
parents: 348
diff changeset
  4969
    ]
claus
parents: 348
diff changeset
  4970
!
claus
parents: 348
diff changeset
  4971
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4972
infoPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4973
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4974
356
claus
parents: 348
diff changeset
  4975
    "print the receiver followed by a cr on the standard error stream.
claus
parents: 348
diff changeset
  4976
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  4977
     or fatal messages.
claus
parents: 348
diff changeset
  4978
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  4979
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4980
    InfoPrinting == true ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4981
	self errorPrintCR
356
claus
parents: 348
diff changeset
  4982
    ]
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4983
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4984
    "Created: 20.5.1996 / 10:21:28 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4985
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4986
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4987
infoPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4988
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4989
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4990
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4991
     This is meant for information messages which are not warnings
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4992
     or fatal messages.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4993
     These messages can be turned on/off by 'Object infoPrinting:true/false'.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4994
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4995
     Please use #infoPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4996
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4997
    ^ self infoPrintCR
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4998
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4999
    "Modified: 20.5.1996 / 10:25:07 / cg"
356
claus
parents: 348
diff changeset
  5000
!
claus
parents: 348
diff changeset
  5001
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5002
print
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5003
    "print the receiver on the standard output stream (which is not the Transcript)"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5004
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5005
    self printOn:Stdout
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5006
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5007
    "Modified: 4.11.1996 / 23:36:58 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5008
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5009
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5010
printCR
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5011
    "print the receiver followed by a cr on the standard output stream (which is not the Transcript)"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5012
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5013
    self printOn:Stdout.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5014
    Stdout cr
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5015
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5016
    "Created: 20.5.1996 / 10:21:37 / cg"
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5017
    "Modified: 4.11.1996 / 23:37:06 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5018
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5019
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5020
printNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5021
    "print the receiver followed by a cr on the standard output stream
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5022
     This exists for GNU Smalltalk compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5023
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5024
    ^ self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5025
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5026
    "Modified: 20.5.1996 / 10:25:31 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5027
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5028
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5029
printNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5030
    "print the receiver followed by a cr on the standard output stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5031
     This exists for backward compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5032
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5033
    self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5034
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5035
    "Modified: 20.5.1996 / 10:25:46 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5036
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5037
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5038
printOn:aStream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5039
    "print the receiver on the argument-stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5040
     The default here is to output the receivers class name.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5041
     BUT: this method is heavily redefined for objects which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5042
     can print prettier."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5043
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5044
    aStream nextPutAll:self classNameWithArticle
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5045
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5046
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5047
printOn:aStream leftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5048
    "print the receiver on aStream, padding with spaces up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5049
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5050
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5051
    self printOn:aStream leftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5052
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5053
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5054
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5055
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5056
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5057
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5058
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5059
printOn:aStream leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5060
    "print the receiver on aStream, padding with padCharacters up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5061
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5062
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5063
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5064
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5065
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5066
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5067
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5068
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5069
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5070
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5071
printOn:aStream paddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5072
    "print the receiver on aStream, padding with spaces up to size."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5073
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5074
    self printOn:aStream paddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5075
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5076
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5077
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5078
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5079
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5080
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5081
printOn:aStream paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5082
    "print the receiver on aStream, padding with padCharacter up to size"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5083
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5084
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5085
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5086
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5087
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5088
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5089
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5090
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5091
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5092
printOn:aStream zeroPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5093
    "print the receiver on aStream, padding with zeros up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5094
     Usually used with float numbers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5095
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5096
    self printOn:aStream paddedTo:size with:$0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5097
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5098
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5099
     123.0 printOn:Transcript zeroPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5100
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5101
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5102
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5103
printRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5104
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5105
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5106
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5107
    (self printStringLeftPaddedTo:size) printOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5108
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5109
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5110
printString
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5111
    "return a string for printing the receiver.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5112
     Since we now use printOn: as the basic print mechanism,
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5113
     we have to create a stream and print into it."
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5114
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5115
    |s|
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5116
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5117
    s := WriteStream on:(String new:30).
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5118
    self printOn:s.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5119
    ^ s contents
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5120
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5121
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5122
printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5123
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5124
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5125
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5126
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5127
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5128
    ^ self printStringLeftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5129
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5130
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5131
     10 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5132
     1 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5133
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5134
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5135
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5136
printStringLeftPaddedTo:size ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5137
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5138
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5139
     If the printString is larger than size,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5140
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5141
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5142
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5143
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5144
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5145
     12   printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5146
     123  printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5147
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5148
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5149
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5150
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5151
printStringLeftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5152
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5153
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5154
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5155
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5156
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5157
    ^ (self printString) leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5158
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5159
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5160
     123 printStringLeftPaddedTo:10 with:$.   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5161
     1 printStringLeftPaddedTo:10 with:$.      
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5162
     (Float pi) printStringLeftPaddedTo:20 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5163
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5164
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5165
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5166
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5167
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5168
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5169
     If the printString is larger than size,
369
claus
parents: 362
diff changeset
  5170
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  5171
claus
parents: 362
diff changeset
  5172
    |s|
claus
parents: 362
diff changeset
  5173
claus
parents: 362
diff changeset
  5174
    s := self printString.
claus
parents: 362
diff changeset
  5175
    s size > size ifTrue:[^ alternative value].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5176
    ^ s leftPaddedTo:size with:padCharacter
369
claus
parents: 362
diff changeset
  5177
claus
parents: 362
diff changeset
  5178
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5179
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5180
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5181
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5182
    "
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  5183
!
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  5184
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  5185
printStringPaddedTo:size
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5186
    "return a printed representation of the receiver,
369
claus
parents: 362
diff changeset
  5187
     padded with spaces (at the right) up to size.
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5188
     If the printString is longer than size, 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5189
     it is returned unchanged (i.e. not truncated)"
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  5190
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  5191
    ^ self printStringPaddedTo:size with:(Character space)
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  5192
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5193
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5194
     123 printStringPaddedTo:10    
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5195
     1234567890123456 printStringPaddedTo:10  
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5196
     'hello' printStringPaddedTo:10   
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5197
    "
2
claus
parents: 1
diff changeset
  5198
!
claus
parents: 1
diff changeset
  5199
369
claus
parents: 362
diff changeset
  5200
printStringPaddedTo:size ifLarger:alternative
claus
parents: 362
diff changeset
  5201
    "return a printed representation of the receiver,
claus
parents: 362
diff changeset
  5202
     padded with spaces (at the right) up to size.
claus
parents: 362
diff changeset
  5203
     If the resulting printString is too large, 
claus
parents: 362
diff changeset
  5204
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  5205
claus
parents: 362
diff changeset
  5206
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
claus
parents: 362
diff changeset
  5207
claus
parents: 362
diff changeset
  5208
    "
claus
parents: 362
diff changeset
  5209
     12   printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  5210
     123  printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  5211
     1234 printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  5212
    "
claus
parents: 362
diff changeset
  5213
!
claus
parents: 362
diff changeset
  5214
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5215
printStringPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5216
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5217
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5218
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5219
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5220
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5221
    ^ (self printString) paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5222
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5223
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5224
     123  printStringPaddedTo:10 with:$.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5225
     123  printStringPaddedTo:10 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5226
     123  printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5227
     1234 printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5228
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5229
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5230
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5231
printStringPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5232
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5233
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5234
     If the resulting printString is too large, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5235
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5236
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5237
    |s|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5238
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5239
    s := self printString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5240
    s size > size ifTrue:[^ alternative value].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5241
    ^ s paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5242
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5243
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5244
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5245
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5246
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5247
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5248
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5249
printStringRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5250
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5251
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5252
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5253
    ^ self printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5254
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5255
2
claus
parents: 1
diff changeset
  5256
printStringZeroPaddedTo:size
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5257
    "return a printed representation of the receiver, 
369
claus
parents: 362
diff changeset
  5258
     padded with zero (at the right) characters up to size.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  5259
     Usually used with float numbers."
2
claus
parents: 1
diff changeset
  5260
claus
parents: 1
diff changeset
  5261
    ^ self printStringPaddedTo:size with:$0
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  5262
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5263
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5264
     123.0 printStringZeroPaddedTo:10 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5265
    "
2
claus
parents: 1
diff changeset
  5266
!
claus
parents: 1
diff changeset
  5267
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5268
store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5269
    "store the receiver on standard output.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5270
     this method is useless, but included for compatibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5271
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5272
    self storeOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5273
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  5274
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5275
storeCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5276
    "store the receiver on standard output; append a carriage return."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5277
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5278
    self store.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5279
    Character cr print
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5280
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5281
    "Created: 20.5.1996 / 10:26:01 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5282
    "Modified: 20.5.1996 / 10:26:57 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5283
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5284
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5285
storeNl
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5286
    "store the receiver on standard output; append a newline.
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5287
     This method is included for backward compatibility-  use #storeCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5288
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5289
    self storeCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5290
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5291
    "Modified: 20.5.1996 / 10:26:49 / cg"
460
7e058858cc3b New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents: 446
diff changeset
  5292
!
7e058858cc3b New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents: 446
diff changeset
  5293
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5294
storeOn:aStream
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5295
    "store the receiver on aStream; i.e. print an expression which will
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5296
     reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5297
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5298
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5299
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5300
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5301
    |myClass hasSemi sz "{ Class: SmallInteger }" |
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5302
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  5303
    thisContext isRecursive ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5304
	('Object [error]: storeString of self referencing object.') errorPrintCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5305
	aStream nextPutAll:'#("recursive")'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5306
	^ self
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  5307
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5308
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5309
    myClass := self class.
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5310
    aStream nextPut:$(.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5311
    aStream nextPutAll:self class name.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5312
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5313
    hasSemi := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5314
    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5315
	aStream nextPutAll:' basicNew:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5316
	self basicSize printOn:aStream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5317
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5318
	aStream nextPutAll:' basicNew'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5319
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5320
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5321
    sz := myClass instSize.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5322
    1 to:sz do:[:i | 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5323
	aStream nextPutAll:' instVarAt:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5324
	i printOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5325
	aStream nextPutAll:' put:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5326
	(self instVarAt:i) storeOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5327
	aStream nextPut:$;.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5328
	hasSemi := true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5329
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5330
    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5331
	sz := self basicSize.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5332
	1 to:sz do:[:i | 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5333
	    aStream nextPutAll:' basicAt:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5334
	    i printOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5335
	    aStream nextPutAll:' put:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5336
	    (self basicAt:i) storeOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5337
	    aStream nextPut:$;.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5338
	    hasSemi := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5339
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5340
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5341
    hasSemi ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5342
	aStream nextPutAll:' yourself'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5343
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5344
    aStream nextPut:$).
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5345
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5346
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5347
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5348
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5349
     s := WriteStream on:(String new).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5350
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5351
     s := ReadStream on:(s contents).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5352
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5353
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5354
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5355
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5356
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5357
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5358
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5359
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5360
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5361
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5362
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5363
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5364
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5365
    "does not work example:"
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5366
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5367
     |s a|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5368
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5369
     a := Array new:2.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5370
     a at:1 put:a.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5371
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5372
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5373
     a storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5374
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5375
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5376
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5377
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5378
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5379
2287
3d5330d2b368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  5380
    "Modified: 28.1.1997 / 00:36:12 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5381
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5382
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5383
storeString
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5384
    "return a string representing an expression to reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5385
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5386
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  5387
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5388
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5389
    |s|
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5390
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5391
    s := WriteStream on:(String new:50).
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5392
    self storeOn:s.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  5393
    ^ s contents
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5394
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5395
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5396
!Object methodsFor:'queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5397
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5398
basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5399
    "return the number of the receivers indexed instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5400
     0 if it has none.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5401
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  5402
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5403
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5404
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5405
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5406
    REGISTER int nbytes;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5407
    REGISTER OBJ myClass;
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5408
#ifdef alpha64
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5409
#   define int32        int
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5410
#else
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5411
#   define int32        long
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5412
#endif
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5413
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5414
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5415
     * notice the missing test for self being a nonNilObject -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5416
     * this can be done since basicSize is defined both in UndefinedObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5417
     * and SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5418
     */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5419
    myClass = __qClass(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5420
    nbytes = __qSize(self) 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5421
	      - OHDR_SIZE 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5422
	      - __OBJS2BYTES__(__intVal(__ClassInstPtr(myClass)->c_ninstvars));
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5423
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5424
    switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5425
	case __MASKSMALLINT(POINTERARRAY):
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5426
	    RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5427
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5428
	case __MASKSMALLINT(BYTEARRAY):
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5429
	    RETURN ( __MKSMALLINT(nbytes / sizeof(char)) );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5430
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5431
	case __MASKSMALLINT(WKPOINTERARRAY):
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5432
	    RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5433
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5434
	case __MASKSMALLINT(FLOATARRAY):
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5435
	    RETURN ( __MKSMALLINT(nbytes / sizeof(float)) );
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5436
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5437
	case __MASKSMALLINT(DOUBLEARRAY):
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5438
#ifdef NEED_DOUBLE_ALIGN
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5439
	    /*
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5440
	     * care for filler
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5441
	     */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5442
	    nbytes -= sizeof(FILLTYPE);
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5443
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5444
	    RETURN ( __MKSMALLINT(nbytes / sizeof(double)) );
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5445
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5446
	case __MASKSMALLINT(WORDARRAY):
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5447
	case __MASKSMALLINT(SWORDARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5448
	    RETURN ( __MKSMALLINT(nbytes / sizeof(short)) );
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5449
3177
a94f43a8304c added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents: 3175
diff changeset
  5450
	case __MASKSMALLINT(LONGARRAY):
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5451
	case __MASKSMALLINT(SLONGARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5452
	    RETURN ( __MKSMALLINT(nbytes / sizeof(int32)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5453
    }
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5454
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5455
#   undef int32
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5456
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5457
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5458
    ^ 0
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5459
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5460
2575
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5461
byteSize
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5462
    "return the number of bytes in the receivers indexed instance variables,
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5463
     0 if it has none. This only returns non-zero for non-pointer indexed
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5464
     instvars i.e. byteArrays, wordArrays etc.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5465
     Notice: for Strings the returned size may look strange.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5466
     Only useful with binary storage."
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5467
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5468
%{  /* NOCONTEXT */
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5469
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5470
    REGISTER int indx;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5471
    int nIndex;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5472
    REGISTER OBJ slf;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5473
    REGISTER OBJ cls;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5474
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5475
    slf = self;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5476
    if (__isNonNilObject(slf)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5477
	cls = __qClass(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5478
3159
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5479
	switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5480
	    case __MASKSMALLINT(BYTEARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5481
	    case __MASKSMALLINT(WORDARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5482
	    case __MASKSMALLINT(LONGARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5483
	    case __MASKSMALLINT(SWORDARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5484
	    case __MASKSMALLINT(SLONGARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5485
	    case __MASKSMALLINT(FLOATARRAY):
6adde9718bdc more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
  5486
	    case __MASKSMALLINT(DOUBLEARRAY):
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5487
		    nIndex = __byteArraySize(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5488
		    nIndex -= __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5489
		    RETURN ( __MKSMALLINT(nIndex) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5490
	}
2575
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5491
    }
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5492
%}.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5493
    ^ 0
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5494
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5495
    "
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5496
     Point new byteSize   
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5497
     'hello' byteSize     
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5498
     (ByteArray with:1 with:2) byteSize 
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5499
     (FloatArray with:1.5) byteSize    
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5500
    "
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5501
!
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  5502
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5503
class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5504
    "return the receivers class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5505
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5506
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5507
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5508
    RETURN ( __Class(self) );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5509
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5510
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5511
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5512
respondsTo:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5513
    "return true, if the receiver implements a method with selector equal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5514
     to aSelector; i.e. if there is a method for aSelector in either the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5515
     receivers class or one of its superclasses.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5516
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5517
     Notice, that this does not imply, that such a message can be sent without
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5518
     an error being raised. For example, an implementation could send
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5519
     #shouldNotImplement or #subclassResponsibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5520
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5521
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5522
     should we go via the cache, or search (by class) ?
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5523
     The first is faster, most of the time; while the 2nd fills
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5524
     the cache with useless data if this is sent in a loop over all objects.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5525
     For now, use the cache ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5526
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5527
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5528
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
  5529
    if (__lookup(__Class(self), aSelector) == nil) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5530
	RETURN ( false );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5531
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5532
    RETURN ( true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5533
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5534
.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5535
"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5536
    ^ self class canUnderstand:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5537
"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5538
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5539
    "'aString' respondsTo:#+"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5540
    "'aString' respondsTo:#,"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5541
    "'aString' respondsTo:#collect:"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5542
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5543
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5544
respondsToArithmetic
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5545
    "return true, if the receiver responds to arithmetic messages.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5546
     false is returned here - the method is redefined in ArithmeticValue."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5547
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5548
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5549
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5550
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5551
size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5552
    "return the number of the receivers indexed instance variables;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5553
     this method may be redefined in subclasses"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5554
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5555
    ^ self basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5556
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5557
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5558
species
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5559
    "return a class which is similar to (or the same as) the receivers class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5560
     This is used to create an appropriate object when creating derived
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5561
     copies in the collection classes (sometimes redefined)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5562
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5563
    ^ self class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5564
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5565
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5566
yourself
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5567
    "return the receiver - used for cascades to return self at the end"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5568
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5569
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5570
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5571
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5572
!Object methodsFor:'secure message sending'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5573
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5574
askFor:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5575
    "try to send the receiver the message, aSelector.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5576
     If it does not understand it, return false. Otherwise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5577
     the real value returned.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5578
     Useful to send messages such as: 'isColor' to unknown
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5579
     receivers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5580
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5581
    ^ self perform:aSelector ifNotUnderstood:[false]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5582
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5583
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5584
     1 askFor:#isColor
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5585
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5586
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5587
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5588
perform:aSelector ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5589
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5590
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5591
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5592
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5593
    |val|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5594
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5595
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5596
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5597
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5598
	val := self perform:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5599
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5600
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5601
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5602
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5603
     1.2345 perform:#foo ifNotUnderstood:['sorry'] 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5604
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5605
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5606
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5607
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5608
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5609
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5610
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5611
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5612
    |val|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5613
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5614
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5615
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5616
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5617
	val := self perform:aSelector with:argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5618
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5619
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5620
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5621
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5622
     |unknown|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5623
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5624
     unknown := 1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5625
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5626
     unknown := 'high there'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5627
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5628
    "
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5629
!
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5630
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5631
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5632
    "try to send message aSelector to the receiver.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5633
     If its understood, return the methods returned value,
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5634
     otherwise return the value of the exceptionBlock"
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5635
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5636
    |val|
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5637
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5638
    MessageNotUnderstoodSignal handle:[:ex |
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5639
	^ exceptionBlock value
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5640
    ] do:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5641
	val := self perform:aSelector withArguments:argumentArray
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5642
    ].
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5643
    ^ val
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5644
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5645
    "
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5646
     |unknown|
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5647
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5648
     unknown := 1.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5649
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5650
     unknown := 'high there'.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5651
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5652
    "
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5653
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5654
    "Modified: 27.3.1997 / 14:13:16 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5655
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5656
2448
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5657
!Object methodsFor:'signal constants'!
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5658
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5659
messageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5660
    ^ MessageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5661
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5662
    "Created: 6.3.1997 / 15:46:52 / cg"
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5663
! !
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5664
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5665
!Object methodsFor:'special queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5666
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5667
allOwners
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5668
    "return a collection of all objects referencing the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5669
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5670
    ^ ObjectMemory whoReferences:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5671
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5672
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5673
references:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5674
    "return true, if the receiver refers to the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5675
     - for debugging only"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5676
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5677
%{  /* NOCONTEXT */
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5678
    OBJ cls, flags;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5679
    int nInsts, i;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5680
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5681
    if (! __isNonNilObject(self)) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5682
	RETURN (false);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5683
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5684
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5685
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5686
     * a little optimization: use the fact that all old objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5687
     * refering to a new object are on the remSet; if I am not,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5688
     * a trivial reject is possible, if anObject is a newbee
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5689
     */
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5690
    if (__isNonNilObject(anObject)) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5691
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5692
	    int spc;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5693
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5694
	    if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5695
		RETURN (false);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5696
	    }
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5697
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5698
    }
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5699
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5700
    cls = __qClass(self);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5701
    if (cls == anObject) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5702
	RETURN (true);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5703
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5704
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5705
    flags = __ClassInstPtr(cls)->c_flags;
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
  5706
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5707
	nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5708
    } else {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5709
	nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5710
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5711
    if (! nInsts) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5712
	RETURN (false);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5713
    }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5714
#if defined(memsrch4)
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5715
    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5716
	RETURN (true);
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5717
    }
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5718
#else
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5719
    for (i=0; i<nInsts; i++) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5720
	if (__InstPtr(self)->i_instvars[i] == anObject) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5721
	    RETURN (true);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5722
	}
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5723
    }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5724
#endif /* memsrch4 */
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5725
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5726
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5727
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5728
"/    |myClass 
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5729
"/     numInst "{ Class: SmallInteger }" |
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5730
"/
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5731
"/    myClass := self class.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5732
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5733
"/    "check the class"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5734
"/    (myClass == anObject) ifTrue:[^ true].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5735
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5736
"/    "check the instance variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5737
"/    numInst := myClass instSize.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5738
"/    1 to:numInst do:[:i | 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5739
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5740
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5741
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5742
"/    "check the indexed variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5743
"/    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5744
"/      myClass isPointers ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5745
"/          "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5746
"/          "/ we could argue about the following unconditional return:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5747
"/          "/ it says that a non pointer array never has a reference to the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5748
"/          "/ corresponding object - not mimicing a reference to a copy of the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5749
"/          "/ integer. However, it avoids useless searches in huge byteArray
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5750
"/          "/ like objects when searching for owners. If in doubt, remove it.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5751
"/          "/ A consequence of the return below is that #[1 2 3] will say that it
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5752
"/          "/ does not refer to the number 2 (think of keeping a copy instead)
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5753
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5754
"/          ^ false.
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5755
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5756
"/          "/ alternative:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5757
"/          "/  anObject isNumber ifFalse:[^ false].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5758
"/      ].
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5759
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5760
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5761
"/      "/ because arrays are so common, and those have a highly tuned
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5762
"/      "/ idenitytIndex method, use it
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5763
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5764
"/      myClass == Array ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5765
"/          ^ (self identityIndexOf:anObject) ~~ 0
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5766
"/      ].
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5767
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5768
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5769
"/      "/ otherwise, do it the slow way
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5770
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5771
"/      numInst := self basicSize.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5772
"/      1 to:numInst do:[:i | 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5773
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5774
"/      ]
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5775
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5776
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5777
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5778
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5779
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5780
     |v|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5781
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5782
     v := View new initialize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5783
     v references:Display. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5784
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5785
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5786
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5787
referencesAny:aCollection
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5788
    "return true, if the receiver refers to any object from 
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5789
     the argument, aCollection.
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5790
     - for debugging only"
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5791
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5792
%{  
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5793
    OBJ cls, flags;
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5794
    int nInsts, inst;
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5795
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5796
    if (! __isNonNilObject(self)) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5797
	RETURN (false);
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5798
    }
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5799
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5800
    if (__isArray(aCollection)) {
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5801
	int nObjs = __arraySize(aCollection);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5802
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5803
	if (nObjs == 0) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5804
	    RETURN (false);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5805
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5806
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5807
	/*
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5808
	 * a little optimization: use the fact that all old objects
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5809
	 * refering to a new object are on the remSet; if I am not,
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5810
	 * a trivial reject is possible, if all objects are newbees
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5811
	 */
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5812
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5813
	    int allNewBees = 1;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5814
	    int i;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5815
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5816
	    for (i=0; i<nObjs; i++) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5817
		OBJ anObject;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5818
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5819
		anObject = __ArrayInstPtr(aCollection)->a_element[i];
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5820
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5821
		if (__isNonNilObject(anObject)) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5822
		    int spc;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5823
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5824
		    if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5825
			allNewBees = 0;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5826
		    }
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5827
		}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5828
	    }
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5829
	    if (allNewBees) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5830
		RETURN (false);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5831
	    }
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5832
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5833
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5834
	cls = __qClass(self);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5835
	{
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5836
#if defined(memsrch4)
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5837
	    if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)cls, nObjs)) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5838
		RETURN (true);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5839
	    }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5840
#else
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5841
	    int i;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5842
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5843
	    for (i=0; i<nObjs; i++) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5844
		OBJ anObject;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5845
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5846
		anObject = __ArrayInstPtr(aCollection)->a_element[i];
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5847
		if (cls == anObject) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5848
		    RETURN (true);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5849
		}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5850
	    }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5851
#endif /* memsrch4 */
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5852
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5853
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5854
	flags = __ClassInstPtr(cls)->c_flags;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5855
	if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5856
	    nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5857
	} else {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5858
	    nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5859
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5860
	if (! nInsts) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5861
	    RETURN (false);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5862
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5863
	for (inst=0; inst<nInsts; inst++) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5864
	    OBJ instVar = __InstPtr(self)->i_instvars[inst];
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5865
	    int i;
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5866
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5867
#if defined(memsrch4)
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5868
	    if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)instVar, nObjs)) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5869
		RETURN (true);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5870
	    }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5871
#else
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5872
	    for (i=0; i<nObjs; i++) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5873
		OBJ anObject;
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5874
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5875
		anObject = __ArrayInstPtr(aCollection)->a_element[i];
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5876
		if (instVar == anObject) {
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5877
		    RETURN (true);
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5878
		}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5879
	    }
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5880
#endif /* memsrch4 */
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5881
	}
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5882
	RETURN (false);
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5883
    }
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5884
%}.
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5885
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5886
    aCollection do:[:el |
3396
78f572bb3677 pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents: 3385
diff changeset
  5887
	(self references:el) ifTrue:[^ true].
3259
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5888
    ].
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5889
    ^ false
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5890
!
ead60aee4cd3 tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents: 3254
diff changeset
  5891
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5892
referencesDerivedInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5893
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5894
     the argument, aClass or its subclass. This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5895
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5896
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5897
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5898
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5899
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5900
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5901
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5902
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5903
    (myClass isKindOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5904
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5905
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5906
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5907
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5908
	((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5909
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5910
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5911
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5912
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5913
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5914
	    "no need to search in non pointer fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5915
	    ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5916
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5917
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5918
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5919
	    ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5920
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5921
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5922
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5923
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5924
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5925
     (1 @ 3.4) referencesDerivedInstanceOf:Number  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5926
     (1 @ 3.4) referencesDerivedInstanceOf:Array   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5927
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5928
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5929
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5930
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5931
referencesInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5932
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5933
     the argument, aClass.This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5934
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5935
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5936
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5937
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5938
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5939
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5940
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5941
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5942
    (myClass isMemberOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5943
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5944
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5945
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5946
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5947
	((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5948
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5949
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5950
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5951
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5952
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5953
	    "no need to search in non-pointer indexed fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5954
	    myClass isLongs ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5955
		(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5956
	    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5957
		myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5958
		^ aClass == SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5959
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5960
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5961
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5962
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5963
	    ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5964
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5965
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5966
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5967
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5968
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5969
     (1 @ 3.4) referencesInstanceOf:Float     
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5970
     (1 @ 3.4) referencesInstanceOf:Fraction    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5971
     View new initialize referencesInstanceOf:(Display class)  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5972
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5973
! !
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5974
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5975
!Object methodsFor:'synchronized evaluation'!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5976
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5977
freeSynchronizationSemaphore    
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5978
    "free synchronizationSemaphore. May be used, to save memory when
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5979
     an object is no longer used synchronized."
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5980
2342
4e72f4d7caf1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
  5981
    |sema|
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5982
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5983
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5984
    sema notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5985
	sema wait.              "/ get lock
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5986
	self synchronizationSemaphore:nil.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5987
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5988
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5989
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5990
     self synchronized:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5991
     self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5992
     self freeSynchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5993
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5994
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5995
    "Created: 28.1.1997 / 19:31:20 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5996
    "Modified: 28.1.1997 / 19:47:55 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5997
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5998
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5999
synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6000
    "return the synchronization semaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6001
     subclasses may redefine"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6002
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6003
    ^ SynchronizationSemaphores at:self ifAbsent:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6004
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6005
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6006
      self synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6007
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6008
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6009
    "Modified: 28.1.1997 / 19:47:09 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6010
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6011
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6012
synchronizationSemaphore:aSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6013
    "set the synchronisationSemaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6014
     subclasses may redefine this method"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6015
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6016
    aSemaphore isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6017
	"/ remove Semaphore
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6018
	SynchronizationSemaphores removeKey:self ifAbsent:[].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6019
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6020
	SynchronizationSemaphores at:self put:aSemaphore.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6021
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6022
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6023
    "Modified: 28.1.1997 / 19:37:48 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6024
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6025
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6026
synchronized:aBlock
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6027
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6028
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  6029
    |sema blocked gotSema|
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6030
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6031
    blocked := OperatingSystem blockInterrupts.
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6032
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6033
    "/ the following avoids creation of an additional
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6034
    "/ block in the common case
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6035
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6036
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6037
    sema isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6038
	"get a locked semaphore (with count = 0)"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6039
	sema := Semaphore new.  
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6040
	self synchronizationSemaphore:sema.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6041
	blocked ifFalse:[OperatingSystem unblockInterrupts].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6042
	^ aBlock valueNowOrOnUnwindDo:[sema signal].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6043
    ].
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6044
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  6045
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  6046
     Poll sema (never waits).
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  6047
     Assuming that this is the common operation, this saves the creation
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  6048
     of some blocks.
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  6049
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  6050
    (sema waitWithTimeout:0) notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6051
	blocked ifFalse:[OperatingSystem unblockInterrupts].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6052
	^ aBlock valueNowOrOnUnwindDo:[sema signal].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6053
    ].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6054
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6055
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6056
	gotSema := sema wait.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6057
	blocked ifFalse:[OperatingSystem unblockInterrupts].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6058
	^ aBlock value.
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6059
    ] valueNowOrOnUnwindDo:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6060
	gotSema notNil ifTrue:[gotSema signal]
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6061
    ].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6062
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6063
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6064
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6065
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6066
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6067
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6068
    "Created: 28.1.1997 / 17:52:56 / stefan"
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  6069
    "Modified: 30.1.1997 / 13:38:54 / cg"
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  6070
    "Modified: 20.2.1997 / 09:43:35 / stefan"
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6071
! !
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  6072
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6073
!Object methodsFor:'system primitives'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6074
1957
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6075
asOop
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6076
    "ST-80 compatibility:
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6077
     ST-80 returns an OOP-identity based number here (I guess: its address
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6078
     or index); since ST/X has no such thing, and the objects address cannot
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6079
     be used (since its changing over time), we return the objects identityHash 
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6080
     key, which provides (at least) some identity indication.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6081
     However, notice that (in contrast to ST-80's #asOop), the identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6082
     key of two non-identical objects may be the same.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6083
     You'd better not use it - especially do not misuse it."
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6084
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6085
    ^ self identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6086
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6087
    "Created: 9.11.1996 / 19:09:56 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6088
    "Modified: 9.11.1996 / 19:16:04 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6089
!
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  6090
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6091
become:anotherObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6092
    "make all references to the receiver become references to anotherObject
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6093
     and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6094
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6095
     In general, using #become: should be avoided if possible, since it may 
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6096
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6097
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6098
     This may also be an expensive (i.e. slow) operation, 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6099
     since in the worst case, the whole memory has to be searched for 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6100
     references to the two objects (although the primitive tries hard to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6101
     limit the search, for acceptable performance in most cases). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6102
     This method fails, if the receiver or the argument is a SmallInteger 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6103
     or nil, or is a context of a living method (i.e. one that has not already 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6104
     returned).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6105
     (notice that #become: is not used heavily by the system 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6106
      - the Collection-classes have been rewritten to not use it.)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6107
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  6108
    if (__primBecome(self, anotherObject)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6109
	RETURN ( self );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6110
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6111
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6112
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6113
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6114
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6115
becomeNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6116
    "make all references to the receiver become nil - effectively getting
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6117
     rid of the receiver. 
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6118
     This can be a very dangerous operation - be warned.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6119
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6120
     This may be an expensive (i.e. slow) operation.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6121
     The receiver may not be a SmallInteger or a context of a living method."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6122
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6123
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  6124
    if (__primBecomeNil(self)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6125
	RETURN ( nil );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6126
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6127
%}.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6128
    self primitiveFailed
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6129
!
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6130
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6131
becomeSameAs:anotherObject
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6132
    "make all references to the receiver become references to anotherObject
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6133
     but NOT vice versa (as done in #become:).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6134
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6135
     In general, using #become: should be avoided if possible, since it may 
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6136
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6137
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6138
     This may also be an expensive (i.e. slow) operation,
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6139
     since in the worst case, the whole memory has to be searched for
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6140
     references to the two objects (although the primitive tries hard to
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6141
     limit the search, for acceptable performance in most cases).
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6142
     This method fails, if the receiver or the argument is a SmallInteger
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6143
     or nil, or is a context of a living method (i.e. one that has not already returned)."
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6144
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  6145
    if (__primBecomeSameAs(self, anotherObject)) {
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6146
	RETURN ( self );
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6147
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  6148
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6149
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6150
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6151
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6152
changeClassTo:otherClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6153
    "changes the class of the receiver to the argument, otherClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6154
     This is only allowed (possible), if the receivers class and the argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6155
     have the same structure (i.e. number of named instance variables and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6156
     type of indexed instance variables). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6157
     If the structures do not match, or any of the original class or new class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6158
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6159
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6160
    |myClass ok|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6161
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6162
    "check for UndefinedObject/SmallInteger receiver or newClass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6163
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  6164
    {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6165
	OBJ other = otherClass;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6166
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6167
	if (__isNonNilObject(self) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6168
	 && __isNonNilObject(other)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6169
	 && (other != UndefinedObject)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6170
	 && (other != SmallInteger)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6171
	    ok = true;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6172
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6173
	    ok = false;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6174
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6175
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6176
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6177
    ok ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6178
	ok := false.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6179
	myClass := self class.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6180
	myClass flags == otherClass flags ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6181
	    myClass instSize == otherClass instSize ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6182
		"same instance layout and types: its ok to do it"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6183
		ok := true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6184
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6185
		myClass isPointers ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6186
		    myClass isVariable ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6187
			ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6188
		    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6189
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6190
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6191
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6192
	    myClass isPointers ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6193
		"if newClass is a variable class, with instSize <= my instsize,
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6194
		 we can do it (effectively mapping additional instvars into the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6195
		 variable part) - usefulness is questionable, though"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6196
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6197
		otherClass isPointers ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6198
		    otherClass isVariable ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6199
			otherClass instSize <= (myClass instSize + self basicSize) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6200
			ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6201
			    ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6202
			]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6203
		    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6204
			otherClass instSize == (myClass instSize + self basicSize) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6205
			ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6206
			    ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6207
			]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6208
		    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6209
		] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6210
		    "it does not make sense to convert pointers to bytes ..."
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6211
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6212
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6213
		"does it make sense, to convert bits ?"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6214
		"could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6215
		(myClass isBits and:[otherClass isBits]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6216
		    ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6217
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6218
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6219
	]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6220
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6221
    ok ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6222
	"now, change the receivers class ..."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6223
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  6224
	{
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  6225
	    OBJ me = self;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  6226
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6227
	    __qClass(me) = otherClass;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6228
	    __STORE(me, otherClass);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6229
	    RETURN (me);
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  6230
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6231
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6232
    ].
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  6233
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  6234
    "
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  6235
     the receiver cannot be represented as a instance of
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  6236
     the desired class.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  6237
     For example, you cannot change a bitInstance (byteArray etc.) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  6238
     into a pointer object and vice versa.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  6239
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6240
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6241
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6242
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6243
changeClassToThatOf:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6244
    "changes the class of the receiver to that of the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6245
     This is only allowed (possible), if the receivers class and the arguments
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6246
     class have the same structure (i.e. number of named instance variables and 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6247
     type of indexed instance variables). If the structures do not match, or any
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6248
     of the objects is nil or a Smallinteger, a primitive error is triggered."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6249
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6250
    self changeClassTo:(anObject class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6251
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6252
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6253
!Object methodsFor:'testing'!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6254
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6255
? defaultValue
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6256
     "if the receiver is nil, return the defaultValue;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6257
      otherwise, return the receiver.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6258
      This method is only redefined in UndefinedObject - therefore,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6259
      the recevier is retuned here.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6260
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  6261
      Thus, if foo and bar are simple variables or constants,
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6262
	  foo ? bar
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  6263
      is the same as:
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6264
	  (foo isNil ifTrue:[bar] ifFalse:[foo])
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  6265
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  6266
      if they are message sends, the equivalent code is:
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6267
	  [
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6268
	      |t1 t2|
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6269
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6270
	      t1 := foo.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6271
	      t2 := bar.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6272
	      t1 isNil ifTrue:[t2] ifFalse:[t1]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6273
	  ] value
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  6274
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6275
      Can be used to provide defaultValues to variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6276
      as in:
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6277
	  foo := arg ? #defaultValue
2147
3579ce76c8c8 comment
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  6278
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  6279
      Note: this method should never be redefined in classes other than UndefinedObject.
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6280
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6281
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6282
    ^ self
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6283
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6284
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6285
     1 ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6286
     nil ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6287
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6288
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6289
    "Created: 4.11.1996 / 20:36:19 / cg"
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  6290
    "Modified: 11.1.1997 / 14:56:47 / cg"
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6291
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6292
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6293
isArray
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6294
    "return true, if the receiver is some kind of array (or weakArray etc);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6295
     false is returned here - the method is only redefined in Array."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6296
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6297
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6298
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6299
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6300
isAssociation
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6301
    "return true, if the receiver is some kind of association;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6302
     false is returned here - the method is only redefined in Association."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6303
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6304
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6305
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6306
    "Created: 14.5.1996 / 17:03:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6307
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6308
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6309
isBehavior
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6310
    "return true, if the receiver is some kind of class (i.e. behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6311
     false is returned here - the method is only redefined in Behavior."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6312
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6313
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6314
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6315
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6316
isBlock
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6317
    "return true, if the receiver is some kind of block;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6318
     false returned here - the method is only redefined in Block."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6319
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6320
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6321
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6322
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6323
isCharacter
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6324
    "return true, if the receiver is some kind of character;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6325
     false is returned here - the method is only redefined in Character."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6326
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6327
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6328
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6329
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6330
isClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6331
    "return true, if the receiver is some kind of class (real class, 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6332
     not just behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6333
     false is returned here - the method is only redefined in Class."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6334
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6335
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6336
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6337
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6338
isCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6339
    "return true, if the receiver is some kind of collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6340
     false is returned here - the method is only redefined in Collection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6341
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6342
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6343
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6344
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6345
isColor
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6346
    "return true, if the receiver is some kind of color;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6347
     false is returned here - the method is only redefined in Color."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6348
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6349
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6350
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6351
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6352
isContext
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6353
    "return true, if the receiver is some kind of context;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6354
     false returned here - the method is only redefined in Context."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6355
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6356
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6357
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6358
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6359
isExternalStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6360
    "return true, if the receiver is some kind of externalStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6361
     false is returned here - the method is only redefined in ExternalStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6362
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6363
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6364
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6365
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6366
isFileStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6367
    "return true, if the receiver is some kind of fileStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6368
     false is returned here - the method is only redefined in FileStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6369
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6370
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6371
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6372
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  6373
isFixedPoint
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  6374
    "return true, if the receiver is some kind of fixedPoint number;
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  6375
     false is returned here - the method is only redefined in FixedPoint."
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  6376
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  6377
    ^ false
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  6378
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  6379
    "Created: 5.11.1996 / 19:23:04 / cg"
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  6380
!
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  6381
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6382
isFixedSize
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6383
    "return true if the receiver cannot grow easily 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6384
     (i.e. a grow may be expensive, since it involves a become:)"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6385
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6386
    ^ true
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6387
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6388
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6389
isForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6390
    "return true, if the receiver is some kind of form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6391
     false is returned here - the method is only redefined in Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6392
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6393
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6394
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6395
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6396
isFraction
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6397
    "return true, if the receiver is some kind of fraction;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6398
     false is returned here - the method is only redefined in Fraction."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6399
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6400
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6401
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6402
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6403
isImage
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6404
    "return true, if the receiver is some kind of image;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6405
     false is returned here - the method is only redefined in Image."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6406
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6407
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6408
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6409
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6410
isImageOrForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6411
    "return true, if the receiver is some kind of image or form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6412
     false is returned here - the method is only redefined in Image and Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6413
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6414
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6415
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6416
2673
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  6417
isImmediate
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  6418
    "return true if this object has immediate representation"
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  6419
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  6420
    ^ self class hasImmediateInstances
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  6421
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  6422
    "Created: 3.6.1997 / 12:00:18 / cg"
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  6423
!
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  6424
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6425
isInteger
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6426
    "return true, if the receiver is some kind of integer number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6427
     false is returned here - the method is only redefined in Integer."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6428
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6429
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6430
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6431
2502
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6432
isJavaClass
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6433
    ^ false
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6434
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6435
    "Created: 26.3.1997 / 13:34:54 / cg"
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6436
!
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6437
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6438
isJavaObject
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6439
    ^ false
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6440
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6441
    "Created: 26.3.1997 / 13:34:48 / cg"
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6442
!
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  6443
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6444
isKindOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6445
    "return true, if the receiver is an instance of aClass or one of its
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6446
     subclasses, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6447
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6448
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6449
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6450
	to instances of certain classes and fences you into a specific inheritance 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6451
	hierarchy.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6452
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6453
	(such as #isXXXX, #respondsTo: or #isNumber).
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6454
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6455
	Using #isKindOf: is considered BAD STYLE.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6456
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6457
     Advice2:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6458
	Be aware, that using an #isXXX method is usually much faster than 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6459
	using #isKindOf:; because isKindOf: has to walk up all the superclass 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6460
	hierarchy, comparing every class on the way. 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6461
	Due to caching in the VM, a call to #isXXX is normally reached via
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6462
	a single function call.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6463
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6464
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6465
%{  /* NOCONTEXT */
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6466
    register OBJ thisClass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6467
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6468
    thisClass = __Class(self);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6469
    while (thisClass != nil) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6470
	if (thisClass == aClass) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6471
	    RETURN ( true );
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6472
	}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6473
	thisClass = __ClassInstPtr(thisClass)->c_superclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6474
    }
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6475
%}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6476
.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6477
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6478
"/  the above code is equivalent to:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6479
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6480
"/  thisClass := self class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6481
"/  [thisClass notNil] whileTrue:[
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6482
"/      thisClass == aClass ifTrue:[^ true].
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6483
"/      thisClass := thisClass superclass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6484
"/  ]
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6485
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6486
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6487
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6488
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6489
isLayout
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6490
    "return true, if the receiver is some kind of layout;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6491
     false is returned here - the method is only redefined in Layout."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6492
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6493
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6494
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6495
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6496
isLiteral
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6497
    "return true, if the receiver can be represented as a constant in ST syntax;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6498
     false is returned here - the method is redefined in some classes."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6499
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6500
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6501
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6502
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6503
isMemberOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6504
    "return true, if the receiver is an instance of aClass, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6505
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6506
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6507
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6508
	to instances of a certain class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6509
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6510
	(such as #isXXX, #respondsTo: or #isNumber);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6511
3044
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  6512
	Using #isMemberOf: is considered BAD STYLE.
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  6513
     Notice:
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  6514
	This method is open coded (inlined) by the compiler(s)
a0bbac91639b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3023
diff changeset
  6515
	- redefining it may not work as expected."
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6516
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6517
    ^ (self class) == aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6518
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6519
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6520
isMeta
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6521
    "return true, if the receiver is some kind of metaclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6522
     false is returned here - the method is only redefined in Metaclass."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6523
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6524
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6525
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6526
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6527
isMethod
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6528
    "return true, if the receiver is some kind of method;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6529
     false returned here - the method is only redefined in Method."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6530
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6531
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6532
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6533
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6534
isNamespace
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6535
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6536
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6537
    "Created: 11.10.1996 / 18:08:56 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6538
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6539
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6540
isNumber
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6541
    "return true, if the receiver is some kind of number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6542
     false is returned here - the method is only redefined in Number."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6543
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6544
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6545
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6546
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6547
isPoint
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6548
    "return true, if the receiver is some kind of point;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6549
     false is returned here - the method is only redefined in Point."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6550
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6551
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6552
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6553
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6554
isReal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6555
    "return true, if the receiver is some kind of real number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6556
     false is returned here - the method is only redefined in LimitedPrecisionReal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6557
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6558
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6559
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6560
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6561
isRectangle
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6562
    "return true, if the receiver is some kind of rectangle;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6563
     false is returned here - the method is only redefined in Rectangle."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6564
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6565
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6566
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6567
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6568
isRemoteObject
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6569
    "return true, if the receiver is some kind of remoteObject,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6570
     false if its local - the method is only redefined in RemoteObject."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6571
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6572
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6573
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6574
    "Created: 28.10.1996 / 15:18:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6575
    "Modified: 28.10.1996 / 15:20:57 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6576
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6577
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6578
isSequenceable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6579
    "return true, if the receiver is some kind of sequenceable collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6580
     false is returned here - the method is only redefined in SequenceableCollection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6581
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6582
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6583
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6584
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6585
isSequenceableCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6586
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6587
     This method is a historic leftover and will be removed soon ..."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6588
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6589
    self obsoleteMethodWarning:'use #isSequenceable'.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6590
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6591
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6592
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6593
isSignal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6594
    "return true, if the receiver is some kind of signal;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6595
     false returned here - the method is only redefined in Signal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6596
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6597
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6598
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6599
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6600
isStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6601
    "return true, if the receiver is some kind of stream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6602
     false is returned here - the method is only redefined in Stream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6603
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6604
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6605
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6606
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6607
isString
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6608
    "return true, if the receiver is some kind of string;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6609
     false is returned here - the method is only redefined in String."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6610
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6611
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6612
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6613
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6614
isSymbol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6615
    "return true, if the receiver is some kind of symbol;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6616
     false is returned here - the method is only redefined in Symbol."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6617
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6618
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6619
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6620
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6621
isText
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6622
    "return true, if the receiver is some kind of text object;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6623
     false is returned here - the method is only redefined in Text."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6624
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6625
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6626
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6627
    "Created: 12.5.1996 / 10:56:50 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6628
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6629
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6630
isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6631
    "return true if the receiver has indexed instance variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6632
     false otherwise."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6633
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6634
    ^ self class isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6635
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6636
2704
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  6637
isVariableBinding
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  6638
    ^ false
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  6639
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  6640
    "Created: 19.6.1997 / 17:38:44 / cg"
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  6641
!
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  6642
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6643
isView
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6644
    "return true, if the receiver is some kind of view;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6645
     false is returned here - the method is only redefined in View."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6646
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6647
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6648
! !
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  6649
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6650
!Object methodsFor:'user interaction & notifications'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6651
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6652
activityNotification:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6653
    "this can be sent from deeply nested methods, which are going to perform
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6654
     some long-time activity.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6655
     If there is a handler for the ActivityNotificationSignal signal, that one is raised,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6656
     passing the argument. The handler should show this message whereever it likes,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6657
     and proceed. If there is no handler, this is simply ignored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6658
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6659
     This is very useful to pass busy messages up to some higher level (typically a view)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6660
     which likes to display that message in its label or a busy-box.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6661
     It could also be put into some logfile or printed on the standard output/error."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6662
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6663
    ActivityNotificationSignal isHandled ifTrue:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6664
	^ ActivityNotificationSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6665
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6666
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6667
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6668
     nil activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6669
     self activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6670
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6671
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6672
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6673
     ActivityNotificationSignal handle:[:ex |
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6674
	ex errorString printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6675
	ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6676
     ] do:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6677
	'hello' printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6678
	self activityNotification:'doing some long time computation'.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  6679
	'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6680
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6681
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6682
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6683
    "Modified: 16.12.1995 / 18:23:42 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6684
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6685
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6686
confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6687
    "launch a confirmer, which allows user to enter yes or no.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6688
     return true for yes, false for no"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6689
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  6690
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  6691
     on systems without GUI, or during startup, output a message
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  6692
     and return true (as if yes was answered)
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  6693
     Q: should we ask user by reading Stdin ?
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  6694
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  6695
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6696
	'*** confirmation requested during initialization:' printCR. 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6697
	aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6698
	'*** I''ll continue, assuming <yes> ...' printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6699
	^ true
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  6700
    ].
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  6701
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6702
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6703
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6704
	Transcript showCR:'continue, assuming <yes>'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6705
	^ true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6706
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6707
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6708
    ^ Dialog confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6709
        
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6710
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6711
     nil confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6712
     self confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6713
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  6714
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6715
    "Modified: 20.5.1996 / 10:28:40 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6716
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6717
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6718
errorNotify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6719
    "launch a Notifier, showing top stack, telling user something
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6720
     and give user a chance to enter debugger."
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6721
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6722
    ^ self
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6723
	errorNotify:aString 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6724
	from:thisContext sender
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6725
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6726
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6727
     nil errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6728
     self errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6729
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6730
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6731
    "Modified: 11.1.1997 / 18:39:20 / cg"
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6732
!
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6733
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6734
errorNotify:aString from:aContext
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6735
    "launch a Notifier, showing top stack (above aContext), 
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6736
     telling user something and give user a chance to enter debugger."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6737
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6738
    |info con sender action|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6739
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6740
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6741
	'errorNotification: ' print. aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6742
	^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6743
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6744
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6745
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6746
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6747
	 on systems without GUI, simply show
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6748
	 the message on the Transcript and abort.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6749
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6750
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6751
	AbortSignal raise.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6752
	^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6753
    ].
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6754
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6755
    Processor activeProcessIsSystemProcess ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6756
	action := #debug.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6757
	sender := aContext.
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6758
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6759
	Dialog autoload.        "in case its autoloaded"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6760
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6761
	ErrorSignal handle:[:ex |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6762
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6763
	    "/ a recursive error - quickly enter debugger
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6764
	    "/ this happened, when I corrupted the Dialog class ...
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6765
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  6766
	    ('Object [error]: ' , ex errorString , ' caught in errorNotification') errorPrintCR.
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6767
	    action := #debug.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6768
	    ex return.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6769
	] do:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6770
	    sender := aContext.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6771
	    sender isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6772
		sender := thisContext sender.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6773
		"/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6774
		"/ for your convenience: skip the emergencyHandler block
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6775
"/                sender isBlockContext ifTrue:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6776
"/                    sender := sender sender
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6777
"/                ].
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6778
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6779
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6780
	    "/ skip intermediate (signal & exception) contexts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6781
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6782
	    DebugView notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6783
		sender := DebugView interestingContextFrom:sender
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6784
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6785
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6786
	    "/ show the first 5 contexts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6787
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6788
	    con := sender.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6789
	    info := aString , Character cr asString , Character cr asString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6790
	    1 to:5 do:[:n |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6791
		con notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6792
		    info := info , con printString , Character cr asString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6793
		    con := con sender
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6794
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6795
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6796
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6797
	    action := Dialog 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6798
			choose:info 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6799
			label:('Exception [' , Processor activeProcess nameOrId , ']')
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6800
			labels:#('proceed' 'abort' 'debug')
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6801
			values:#(#proceed #abort #debug)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6802
			default:#debug.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6803
	].
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6804
    ].
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6805
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6806
    action == #debug ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6807
	Debugger enter:sender withMessage:aString
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6808
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6809
	action == #abort ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6810
	    AbortSignal raise
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6811
	]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6812
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6813
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6814
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6815
     nil errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6816
     self errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6817
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  6818
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6819
    "Created: 11.1.1997 / 17:53:09 / cg"
2359
fdc5d828bb5e add process name to exception notifyer boxes window-title
Claus Gittinger <cg@exept.de>
parents: 2342
diff changeset
  6820
    "Modified: 8.2.1997 / 12:47:41 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6821
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6822
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6823
information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6824
    "launch an InfoBox, telling user something. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6825
     These info-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6826
     UserNotification- or InformationSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6827
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6828
    InformationSignal isHandled ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6829
	^ InformationSignal raiseRequestWith:self errorString:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6830
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6831
    self notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6832
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6833
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6834
     nil information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6835
     self information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6836
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6837
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6838
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6839
     InformationSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6840
	'no box popped' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6841
	ex proceed.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6842
     ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6843
	'hello' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6844
	self information:'some info'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6845
	'world' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6846
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6847
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6848
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6849
    "Modified: 24.11.1995 / 22:29:49 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6850
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6851
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6852
notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6853
    "launch a Notifier, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6854
     Use #information: for ignorable messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6855
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6856
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6857
	'information: ' print. aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6858
	^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6859
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6860
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6861
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6862
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6863
	 on systems without GUI, simply show
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6864
	 the message on the Transcript.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6865
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6866
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6867
	^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6868
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6869
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6870
    Dialog information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6871
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6872
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6873
     nil notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6874
     self notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6875
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  6876
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6877
    "Modified: 20.5.1996 / 10:28:48 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6878
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6879
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6880
warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6881
    "launch a WarningBox, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6882
     These warn-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6883
     UserNotification- or WarningSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6884
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6885
    WarningSignal isHandled ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6886
	^ WarningSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6887
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6888
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6889
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6890
	'warning: ' print. aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6891
	^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6892
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6893
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6894
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6895
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6896
	 on systems without GUI, simply show
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6897
	 the message on the Transcript.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6898
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6899
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6900
	^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6901
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6902
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6903
    Dialog warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6904
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6905
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6906
     nil warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6907
     self warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6908
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6909
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6910
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6911
     WarningSignal handle:[:ex |
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6912
	ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6913
     ] do:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6914
	'hello' printNL.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6915
	self warn:'some info'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6916
	'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6917
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6918
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  6919
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6920
    "Modified: 20.5.1996 / 10:28:53 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6921
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6922
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  6923
!Object class methodsFor:'documentation'!
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6924
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6925
version
3423
b4a43b4f098b new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents: 3418
diff changeset
  6926
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.234 1998-05-07 22:26:37 cg Exp $'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6927
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6928
Object initialize!