Object.st
author Claus Gittinger <cg@exept.de>
Sat, 04 Oct 1997 19:01:30 +0200
changeset 2998 930360fb3f12
parent 2895 41fbba8eb543
child 3005 8fe533ca0764
permissions -rw-r--r--
#size is not really obsolete
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    18
		NonIntegerIndexSignal NotFoundSignal KeyNotFoundSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    19
		ElementOutOfBoundsSignal UserNotificationSignal InformationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    20
		WarningSignal PrimitiveFailureSignal DeepCopyErrorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    21
		AbortSignal ErrorRecursion Dependencies InfoPrinting
2231
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
    22
		ActivityNotificationSignal InternalErrorSignal
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
    23
		NonWeakDependencies SynchronizationSemaphores'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    24
	poolDictionaries:''
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
    25
	category:'Kernel-Objects'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    26
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    27
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
    28
!Object class methodsFor:'documentation'!
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    29
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    30
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    31
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    32
 COPYRIGHT (c) 1988 by Claus Gittinger
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
    33
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    34
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    35
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    37
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    38
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    39
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    40
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    41
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    42
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    43
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    44
dependencies
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    45
"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    46
   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
    47
   (we think they are better ;-).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    48
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    49
   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
    50
   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
    51
   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
    52
   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
    53
   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
    54
   to dependent or the dependee.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    55
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    56
   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
    57
   prevent memory leaks.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    58
   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
    59
   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
    60
   need to care about dependencies.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    61
   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
    62
   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
    63
   (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
    64
    that behavior)
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    65
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    66
   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
    67
   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
    68
   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
    69
   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
    70
   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
    71
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
   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
    74
   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
    75
   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
    76
   references exist to the dependent.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    77
   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
    78
   (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
    79
   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
    80
   (see #addNonWeakDependent / #removeNonWeakDependent).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    81
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
   Caveat:
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
    84
      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
    85
      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
    86
      automatically).
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
    87
      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
    88
      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
    89
      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
    90
      (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
    91
      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
    92
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
   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
    95
"
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
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    98
documentation
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
    99
"
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   100
   Object is the superclass of most other classes. 
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   101
   (except for nil-subclasses, which inherit nothing,
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   102
    to catch any message into their #doesNotUnderstand: method)
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   103
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   104
   Protocol which is common to every object is defined here.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   105
   Also some utility stuff (like notify) and error handling is implemented here.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   106
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   107
   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
   108
   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
   109
   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
   110
   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
   111
   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
   112
   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
   113
   (and also rewritten in some places).
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   114
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   115
   [Class variables:]
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   116
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   117
	ErrorSignal     <Signal>        Signal raised for error/error: messages
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   118
					also, parent of all other signals.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   119
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   120
	HaltSignal      <Signal>        Signal raised for halt/halt: messages
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   121
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   122
	MessageNotUnderstoodSignal      Signals raised for various error conditions
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   123
	UserInterruptSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   124
	RecursionInterruptSignal 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   125
	ExceptionInterruptSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   126
	SubscriptOutOfBoundsSignal 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   127
	NonIntegerIndexSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   128
	NotFoundSignal 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   129
	KeyNotFoundSignal 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   130
	ElementOutOfBoundsSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   131
	InformationSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   132
	WarningSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   133
	DeepCopyErrorSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   134
	InternalErrorSignal
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   135
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   136
	AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   137
					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
   138
					By handling the abortSignal, you can control where the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   139
					debuggers abort-function resumes execution in case of
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   140
					an error.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   141
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   142
	ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e. 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   143
					an error while handling an error).
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   144
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   145
	Dependencies     <WeakDependencyDictionary>  
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   146
					keeps track of object dependencies.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   147
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   148
	InfoPrinting     <Boolean>      controls weather informational messages 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   149
					are printed.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   150
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   151
	ActivityNotificationSignal <QuerySignal> 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   152
					 raised on #activityNotification:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   153
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   154
	NonWeakDependencies <Dictionary> keeps track of object dependencies.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   155
					 Dependents stay alive.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   156
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   157
	SynchronizationSemaphores <WeakIdentityDictionary>
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   158
					 Semaphores for per-object-monitor.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   159
                                        
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   160
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   161
    [author:]
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   162
	Claus Gittinger
1294
e26bbb61f6b2 documentation
Claus Gittinger <cg@exept.de>
parents: 1266
diff changeset
   163
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   164
"
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
   165
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   166
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   167
!Object class methodsFor:'initialization'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   168
a27a279701f8 Initial revision
claus
parents:
diff changeset
   169
initialize
a27a279701f8 Initial revision
claus
parents:
diff changeset
   170
    "called only once - initialize signals"
a27a279701f8 Initial revision
claus
parents:
diff changeset
   171
a27a279701f8 Initial revision
claus
parents:
diff changeset
   172
    ErrorSignal isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   173
	ErrorSignal := (Signal new) mayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   174
	ErrorSignal nameClass:self message:#errorSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   175
	ErrorSignal notifierString:'error encountered'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   176
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   177
	HaltSignal := ErrorSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   178
	HaltSignal nameClass:self message:#haltSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   179
	HaltSignal notifierString:'halt encountered'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   180
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   181
	MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   182
	MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   183
	MessageNotUnderstoodSignal notifierString:'message not understood'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   184
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   185
	PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   186
	PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   187
	PrimitiveFailureSignal notifierString:'primitive failed'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   188
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   189
	InternalErrorSignal := ErrorSignal newSignalMayProceed:false.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   190
	InternalErrorSignal nameClass:self message:#internalError.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   191
	InternalErrorSignal notifierString:'VM internal error: '.
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   192
362
claus
parents: 359
diff changeset
   193
"/        UserInterruptSignal := ErrorSignal newSignalMayProceed:true.
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   194
	UserInterruptSignal := (Signal new) mayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   195
	UserInterruptSignal nameClass:self message:#userInterruptSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   196
	UserInterruptSignal notifierString:'user Interrupt'.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   197
362
claus
parents: 359
diff changeset
   198
"/        RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false.
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   199
	RecursionInterruptSignal := (Signal new) mayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   200
	RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   201
	RecursionInterruptSignal notifierString:'recursion limit reached'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   202
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   203
	ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   204
	ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   205
	ExceptionInterruptSignal notifierString:'exception Interrupt'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   206
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   207
	SubscriptOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   208
	SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   209
	SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   210
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   211
	ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   212
	ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   213
	ElementOutOfBoundsSignal notifierString:'element not appropriate or out of bounds'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   214
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   215
	NotFoundSignal := ErrorSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   216
	NotFoundSignal nameClass:self message:#notFoundSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   217
	NotFoundSignal notifierString:'no such element'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   218
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   219
	KeyNotFoundSignal := ErrorSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   220
	KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   221
	KeyNotFoundSignal notifierString:'no such key: '.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   222
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   223
	NonIntegerIndexSignal := ErrorSignal newSignalMayProceed:false.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   224
	NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   225
	NonIntegerIndexSignal notifierString:'index must be integer'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   226
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   227
	UserNotificationSignal := QuerySignal new.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   228
	UserNotificationSignal nameClass:self message:#userNotificationSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   229
	UserNotificationSignal notifierString:'user notifiaction wanted'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   230
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   231
	InformationSignal := UserNotificationSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   232
	InformationSignal nameClass:self message:#informationSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   233
	InformationSignal notifierString:'information'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   234
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   235
	WarningSignal := UserNotificationSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   236
	WarningSignal nameClass:self message:#warnungSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   237
	WarningSignal notifierString:'warning'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   238
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   239
	ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   240
	ActivityNotificationSignal nameClass:self message:#activityNotificationSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   241
	ActivityNotificationSignal notifierString:'activity'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   242
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   243
	DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   244
	DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   245
	DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   246
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   247
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   248
	 AbortSignal is not a child of ErrorSignal -
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   249
	 this would complicate abort from within a signal handler
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   250
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   251
	AbortSignal := Signal new mayProceed:true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   252
	AbortSignal nameClass:self message:#abortSignal.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   253
	AbortSignal notifierString:'unhandled abort signal'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   254
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   255
	Dependencies isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   256
	    Dependencies := WeakDependencyDictionary new.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   257
	].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   258
	NonWeakDependencies isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   259
	    NonWeakDependencies := IdentityDictionary new.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   260
	].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   261
	SynchronizationSemaphores isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   262
	    SynchronizationSemaphores := WeakIdentityDictionary new.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   263
	].
356
claus
parents: 348
diff changeset
   264
    ].
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   265
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
   266
    "/ 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
   267
    "/ (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
   268
    InfoPrinting := ObjectMemory infoPrinting.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   269
a27a279701f8 Initial revision
claus
parents:
diff changeset
   270
    "Object initialize"
812
00db9c0646fe notificationsignals are no longer children of ErrorSignal
Claus Gittinger <cg@exept.de>
parents: 783
diff changeset
   271
2096
bc7296b593ee use new WeakDependencyDictionary
Claus Gittinger <cg@exept.de>
parents: 2082
diff changeset
   272
    "Modified: 9.1.1997 / 00:28:38 / cg"
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
   273
    "Modified: 28.1.1997 / 19:38:58 / stefan"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   274
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   275
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   276
!Object class methodsFor:'Signal constants'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   277
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   278
abortSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   279
    "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
   280
     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
   281
     currently active doIt/printIt or inspectIt. (also some others use
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   282
     this for a save abort)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   283
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   284
    ^ AbortSignal
579
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   285
!
2d26193415b5 allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents: 530
diff changeset
   286
782
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   287
activityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   288
    "return the signal used for activity notifications.
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   289
     A handler for this signal gets all #activityNotification: sends"
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   290
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   291
    ^ ActivityNotificationSignal
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   292
!
86f091b2635e activityNotification added
Claus Gittinger <cg@exept.de>
parents: 781
diff changeset
   293
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   294
deepCopyErrorSignal 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   295
    "return the signal raised when a deepcopy is asked for
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   296
     an object which cannot do this (for example, BlockClosures
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   297
     or Contexts)."
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   298
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   299
    ^ DeepCopyErrorSignal
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   300
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   301
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   302
elementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   303
    "return the signal used for element error reporting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   304
     (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
   305
      be put into a bytearray)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   306
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   307
    ^ ElementOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   308
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   309
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   310
errorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   311
    "return the signal used for error/error: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   312
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   313
    ^ ErrorSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   314
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   315
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   316
exceptionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   317
    "return the signal used for exception (display errors) error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   318
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   319
    ^ ExceptionInterruptSignal
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   322
haltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   323
    "return the signal used for halt/halt: - handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   324
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   325
    ^ HaltSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   326
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   327
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   328
informationSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   329
    "return the signal used for informations. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   330
     A handler for this signal gets all #information: sends"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   331
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   332
    ^ InformationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   333
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   334
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   335
internalErrorSignal
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   336
    "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
   337
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   338
    ^ InternalErrorSignal
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   339
!
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
   340
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   341
keyNotFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   342
    "return the signal used for no such key error reporting"
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
    ^ KeyNotFoundSignal
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
messageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   348
    "return the signal used for doesNotUnderstand: - 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
    ^ MessageNotUnderstoodSignal
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
nonIntegerIndexSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   354
    "return the signal used for bad subscript error reporting"
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
    ^ NonIntegerIndexSignal
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
notFoundSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   360
    "return the signal used for no element found error reporting"
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
    ^ NotFoundSignal
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   365
primitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   366
    "return the signal used for primitiveFailed - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   367
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   368
    ^ PrimitiveFailureSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   369
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   370
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   371
privateMethodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   372
    "return the signal used for privateMethod - error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   373
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   374
    ^ MessageNotUnderstoodSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   375
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   376
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   377
recursionInterruptSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   378
    "return the signal used for recursion overflow error handling"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   379
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   380
    ^ RecursionInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   381
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   382
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   383
subscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   384
    "return the signal used for subscript error reporting.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   385
     (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
   386
      index less than 1 or greater than the array size)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   387
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   388
    ^ SubscriptOutOfBoundsSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   389
!
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
userInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   392
    "return the signal used for ^C interrupts handling"
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
    ^ UserInterruptSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   395
!
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
userNotificationSignal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   398
    "the parent signal used with information and warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   399
     Handling this allows handling of both information- and warning notifications."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   400
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   401
    ^ UserNotificationSignal
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   404
warningSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   405
    "return the signal used for warnings.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   406
     A handler for this signal gets all #warn: sends"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   407
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   408
    ^ WarningSignal
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   409
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   410
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   411
!Object class methodsFor:'info messages'!
356
claus
parents: 348
diff changeset
   412
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   413
infoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   414
    "return the flag which controls information messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   415
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   416
    ^ InfoPrinting
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   417
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   418
356
claus
parents: 348
diff changeset
   419
infoPrinting:aBoolean
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   420
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
   421
356
claus
parents: 348
diff changeset
   422
    "turn on/off printing of information messages.
claus
parents: 348
diff changeset
   423
     If the argument, aBoolean is false, infoPrint will not output
claus
parents: 348
diff changeset
   424
     messages. The default is true."
claus
parents: 348
diff changeset
   425
claus
parents: 348
diff changeset
   426
    InfoPrinting := aBoolean
claus
parents: 348
diff changeset
   427
! !
claus
parents: 348
diff changeset
   428
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
   429
!Object class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   430
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   431
isBuiltInClass
49
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   432
    "return true, if this class is known by the run-time-system,
f1c2d75f2eb6 *** empty log message ***
claus
parents: 44
diff changeset
   433
     i.e. you cannot add/remove instance variables without recompiling
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   434
     the VM.
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   435
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   436
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   437
    ^ self == Object
1266
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   438
cef9b3cd49df commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   439
    "Modified: 23.4.1996 / 16:00:07 / cg"
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   440
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   441
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   442
!Object methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   443
a27a279701f8 Initial revision
claus
parents:
diff changeset
   444
at:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   445
    "return the indexed instance variable with index, anInteger;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   446
     this method can be redefined in subclasses."
a27a279701f8 Initial revision
claus
parents:
diff changeset
   447
a27a279701f8 Initial revision
claus
parents:
diff changeset
   448
    ^ self basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   449
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   450
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   451
at:index put:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   452
    "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
   453
     this method can be redefined in subclasses. Returns anObject (sigh)"
783
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
    ^ self basicAt:index put:anObject
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   456
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   457
    "Modified: 19.4.1996 / 11:13:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   458
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   459
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   460
basicAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   461
    "return the indexed instance variable with index, anInteger.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   462
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   463
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   464
a27a279701f8 Initial revision
claus
parents:
diff changeset
   465
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   466
329
claus
parents: 325
diff changeset
   467
    REGISTER int nbytes, indx;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   468
    OBJ myClass;
329
claus
parents: 325
diff changeset
   469
    REGISTER char *pFirst;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   470
    unsigned char *cp;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   471
    unsigned short *sp;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   472
    short *ssp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   473
    unsigned long *lp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   474
    long *slp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   475
    unsigned long ul;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   476
    long l;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   477
    OBJ *op;
329
claus
parents: 325
diff changeset
   478
/*    int nInstBytes, nInstVars, flags; */
claus
parents: 325
diff changeset
   479
    REGISTER int n;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   480
a27a279701f8 Initial revision
claus
parents:
diff changeset
   481
a27a279701f8 Initial revision
claus
parents:
diff changeset
   482
    /*
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   483
     * notice the missing test for self being a nonNilObject -
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   484
     * this can be done since basicAt: is defined both in UndefinedObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   485
     * and SmallInteger
a27a279701f8 Initial revision
claus
parents:
diff changeset
   486
     */
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   487
    if (__isSmallInteger(index)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   488
	myClass = __qClass(self);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   489
	indx = __intVal(index) - 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   490
	n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   491
	n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   492
	nbytes = __qSize(self) - n /* nInstBytes */;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   493
	pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   494
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   495
	/* 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   496
	 * replaced switch by open-coded if; this is slightly faster 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   497
	 * since it avoids the range check and also handles the most common case first
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   498
	 */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   499
	n = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   500
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   501
	if ((n == __MASKSMALLINT(POINTERARRAY))
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   502
	 || (n == __MASKSMALLINT(WKPOINTERARRAY))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   503
	    if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   504
		op = (OBJ *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   505
		RETURN ( *op );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   506
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   507
	} else if (n == __MASKSMALLINT(BYTEARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   508
	    if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   509
		cp = (unsigned char *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   510
		RETURN ( __MKSMALLINT(*cp & 0xFF) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   511
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   512
	} else if (n == __MASKSMALLINT(FLOATARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   513
	    if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   514
		float *fp;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   515
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   516
		fp = (float *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   517
		RETURN ( __MKFLOAT((double)(*fp)));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   518
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   519
	} else if (n == __MASKSMALLINT(DOUBLEARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   520
	    if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   521
		double *dp;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   522
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   523
#ifdef NEED_DOUBLE_ALIGN
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   524
		/*
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   525
		 * care for filler
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   526
		 */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   527
		pFirst += sizeof(FILLTYPE);
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   528
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   529
		dp = (double *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   530
		RETURN ( __MKFLOAT(*dp));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   531
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   532
	} else if (n == __MASKSMALLINT(WORDARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   533
	    if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   534
		sp = (unsigned short *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   535
		RETURN ( __MKSMALLINT(*sp & 0xFFFF) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   536
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   537
	} else if (n == __MASKSMALLINT(SWORDARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   538
	    if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   539
		ssp = (short *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   540
		RETURN ( __MKSMALLINT(*ssp) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   541
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   542
	} else if (n == __MASKSMALLINT(LONGARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   543
	    if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   544
		lp = (unsigned long *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   545
		ul = *lp;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   546
		if (ul <= _MAX_INT)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   547
		    RETURN ( __MKSMALLINT(ul) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   548
		RETURN ( __MKULARGEINT(ul) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   549
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   550
	} else if (n == __MASKSMALLINT(SLONGARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   551
	    if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   552
		slp = (long *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   553
		l = *slp;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   554
		if ((l >= _MIN_INT) && (l <= _MAX_INT))
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   555
		    RETURN ( __MKSMALLINT(l) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   556
		RETURN ( __MKLARGEINT(l) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   557
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   558
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   559
    }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   560
%}.
10
claus
parents: 5
diff changeset
   561
    index isInteger ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   562
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   563
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   564
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   565
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   566
a27a279701f8 Initial revision
claus
parents:
diff changeset
   567
basicAt:index put:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
   568
    "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
   569
     Returns anObject (sigh).
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   570
     Trigger an error if the receiver has no indexed instance variables.
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   571
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
   572
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   573
a27a279701f8 Initial revision
claus
parents:
diff changeset
   574
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   575
a27a279701f8 Initial revision
claus
parents:
diff changeset
   576
    register int nbytes, indx;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   577
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   578
    register char *pFirst;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   579
    char *cp;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   580
    unsigned short *sp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   581
    short *ssp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   582
    unsigned long *lp;
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   583
    long *slp;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   584
    OBJ *op;
329
claus
parents: 325
diff changeset
   585
/*    int nInstBytes, ninstvars, flags; */
claus
parents: 325
diff changeset
   586
    REGISTER int n;
1515
49a8587fcc8f added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents: 1445
diff changeset
   587
    unsigned int u;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   588
    int val;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   589
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   590
    /* notice the missing test for self being a nonNilObject -
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
   591
       this can be done since basicAt: is defined both in UndefinedObject
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   592
       and SmallInteger */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   593
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   594
    if (__isSmallInteger(index)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   595
	indx = __intVal(index) - 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   596
	myClass = __qClass(self);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   597
	n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   598
	n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   599
	nbytes = __qSize(self) - n /* nInstBytes */;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   600
	pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   601
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   602
	n = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   603
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   604
	/* 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   605
	 * replaced switch by open-coded if; this is slightly faster 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   606
	 * since it avoids the range check and also handles the most common case first
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   607
	 */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   608
	if ((n == __MASKSMALLINT(POINTERARRAY))
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   609
	 || (n == __MASKSMALLINT(WKPOINTERARRAY))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   610
	    if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   611
		op = (OBJ *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   612
		*op = anObject;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   613
		__STORE(self, anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   614
		RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   615
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   616
	} else if (n == __MASKSMALLINT(BYTEARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   617
	    if (__isSmallInteger(anObject)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   618
		val = __intVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   619
		if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   620
		    if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   621
			cp = pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   622
			*cp = val;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   623
			RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   624
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   625
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   626
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   627
	} else if (n == __MASKSMALLINT(FLOATARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   628
	    if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   629
		float *fp;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   630
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   631
		fp = (float *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   632
		if (__isFloatLike(anObject)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   633
		    *fp = _floatVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   634
		    RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   635
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   636
		if (__isSmallInteger(anObject)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   637
		    *fp = (float) __intVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   638
		    RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   639
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   640
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   641
	} else if (n == __MASKSMALLINT(DOUBLEARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   642
	    if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   643
		double *dp;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   644
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   645
#ifdef NEED_DOUBLE_ALIGN
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   646
		/*
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   647
		 * care for filler
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   648
		 */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   649
		pFirst += sizeof(FILLTYPE);
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
   650
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   651
		dp = (double *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   652
		if (__isFloatLike(anObject)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   653
		    *dp = _floatVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   654
		    RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   655
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   656
		if (__isSmallInteger(anObject)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   657
		    *dp = (double) __intVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   658
		    RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   659
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   660
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   661
	} else if (n == __MASKSMALLINT(WORDARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   662
	    if (__isSmallInteger(anObject)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   663
		val = __intVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   664
		if ((val >= 0) && (val <= 0xFFFF)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   665
		    if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   666
			sp = (unsigned short *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   667
			*sp = val;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   668
			RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   669
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   670
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   671
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   672
	} else if (n == __MASKSMALLINT(SWORDARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   673
	    if (__isSmallInteger(anObject)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   674
		val = __intVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   675
		if ((val >= -32768) && (val < 32768)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   676
		    if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   677
			ssp = (short *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   678
			*ssp = val;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   679
			RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   680
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   681
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   682
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   683
	} else if (n == __MASKSMALLINT(SLONGARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   684
	    if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   685
		slp = (long *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   686
		if (__isSmallInteger(anObject)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   687
		    *slp = __intVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   688
		    RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   689
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   690
		n = __signedLongIntVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   691
		/* zero means failure for an int larger than 4 bytes  ... (would be a smallInteger) */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   692
		if (n) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   693
		    *slp = n;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   694
		    RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   695
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   696
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   697
	} else if (n == __MASKSMALLINT(LONGARRAY)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   698
	    if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   699
		lp = (unsigned long *)pFirst + indx;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   700
		if (anObject == __MKSMALLINT(0)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   701
		    *lp = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   702
		    RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   703
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   704
		u = __longIntVal(anObject);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   705
		/* zero means failure for an int larger than 4 bytes  ... (would be a smallInteger) */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   706
		if (u) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   707
		    *lp = u;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   708
		    RETURN ( anObject );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   709
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   710
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   711
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   712
    }
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   713
%}.
10
claus
parents: 5
diff changeset
   714
    index isInteger ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   715
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   716
	 the index should be an integer number
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   717
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   718
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   719
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
   720
    (index between:1 and:self size) ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   721
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   722
	 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
   723
	 receiver collection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   724
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   725
	^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   726
    ].
643
04b2025af0e3 use new isFLoatsOrDoubles
Claus Gittinger <cg@exept.de>
parents: 594
diff changeset
   727
    (self class isFloatsOrDoubles) ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   728
	anObject isNumber ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   729
	    ^ self basicAt:index put:(anObject asFloat)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   730
	]
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   731
    ].
10
claus
parents: 5
diff changeset
   732
    anObject isInteger ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   733
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   734
	 the object to put into the receiver collection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   735
	 should be an integer number
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   736
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   737
	^ self elementNotInteger
2
claus
parents: 1
diff changeset
   738
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   739
    "
213
3b56a17534fd *** empty log message ***
claus
parents: 202
diff changeset
   740
     the object to put into the receiver collection
362
claus
parents: 359
diff changeset
   741
     is not an instance of the expected element class,
claus
parents: 359
diff changeset
   742
     or the value is  not within the elements valid range.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   743
    "
2
claus
parents: 1
diff changeset
   744
    ^ self elementBoundsError
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   745
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   746
    "Modified: 19.4.1996 / 11:14:10 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   747
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   748
2574
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   749
byteAt:index
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   750
    "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
   751
     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
   752
     (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
   753
     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
   754
     collection of bytes.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   755
     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
   756
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   757
%{  /* NOCONTEXT */
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   758
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   759
    REGISTER int indx;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   760
    int nIndex;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   761
    REGISTER OBJ slf;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   762
    REGISTER OBJ cls;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   763
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   764
    if (__isSmallInteger(index)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   765
	slf = self;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   766
	if (__isNonNilObject(slf)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   767
	    cls = __qClass(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   768
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   769
	    switch (__intVal(__ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   770
		case BYTEARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   771
		case WORDARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   772
		case LONGARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   773
		case SWORDARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   774
		case SLONGARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   775
		case FLOATARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   776
		case DOUBLEARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   777
		    indx = __intVal(index) - 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   778
		    indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   779
		    nIndex = __byteArraySize(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   780
		    if ((unsigned)indx < (unsigned)nIndex) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   781
			RETURN ( __MKSMALLINT(__ByteArrayInstPtr(slf)->ba_element[indx]) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   782
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   783
		    break;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   784
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   785
	}
2574
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   786
    }
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   787
%}.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   788
    "/ 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
   789
    "/ 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
   790
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   791
    ^ self primitiveFailed
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   792
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   793
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   794
     Point new byteAt:1
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   795
     (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
   796
     (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
   797
     (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
   798
     'hello' byteAt:1               
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   799
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   800
!
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   801
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   802
byteAt:index put:byteValue
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   803
    "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
   804
     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
   805
     (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
   806
     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
   807
     collection of bytes.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   808
     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
   809
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   810
%{  /* NOCONTEXT */
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   811
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   812
    REGISTER int indx;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   813
    int val, nIndex;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   814
    REGISTER OBJ slf;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   815
    REGISTER OBJ cls;
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   816
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   817
    if (__bothSmallInteger(index, byteValue)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   818
	val = __intVal(byteValue);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   819
	if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   820
	    slf = self;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   821
	    if (__isNonNilObject(slf)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   822
		cls = __qClass(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   823
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   824
		switch (__intVal(__ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   825
		    case BYTEARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   826
		    case WORDARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   827
		    case LONGARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   828
		    case SWORDARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   829
		    case SLONGARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   830
		    case FLOATARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   831
		    case DOUBLEARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   832
			indx = __intVal(index) - 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   833
			indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   834
			nIndex = __byteArraySize(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   835
			if ((unsigned)indx < (unsigned)nIndex) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   836
			    __ByteArrayInstPtr(slf)->ba_element[indx] = val;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   837
			    RETURN ( byteValue );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   838
			}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   839
			break;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   840
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   841
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
   842
	}
2574
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   843
    }
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   844
%}.
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   845
    "/ 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
   846
    "/ 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
   847
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   848
    ^ self primitiveFailed
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   849
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   850
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   851
     (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
   852
     '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
   853
    "
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   854
!
3df87ac8838c added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents: 2511
diff changeset
   855
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   856
instVarAt:index
a27a279701f8 Initial revision
claus
parents:
diff changeset
   857
    "return a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   858
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   859
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   860
a27a279701f8 Initial revision
claus
parents:
diff changeset
   861
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   862
a27a279701f8 Initial revision
claus
parents:
diff changeset
   863
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   864
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   865
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   866
    if (__isSmallInteger(index)) {
329
claus
parents: 325
diff changeset
   867
	myClass = __Class(self);
755
eaab1d1dacbd _-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents: 751
diff changeset
   868
	idx = __intVal(index) - 1;
357
claus
parents: 356
diff changeset
   869
	/*
claus
parents: 356
diff changeset
   870
	 * do not allow return of non-object fields.
claus
parents: 356
diff changeset
   871
	 * if subclass did not make privisions for that,
claus
parents: 356
diff changeset
   872
	 * we wont do so here ...
claus
parents: 356
diff changeset
   873
	 */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   874
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
357
claus
parents: 356
diff changeset
   875
	    if (idx == 0) {
claus
parents: 356
diff changeset
   876
		RETURN ( nil )
claus
parents: 356
diff changeset
   877
	    }
claus
parents: 356
diff changeset
   878
	}
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   879
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   880
	if ((idx >= 0) && (idx < ninstvars)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   881
	    RETURN ( __InstPtr(self)->i_instvars[idx] );
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   882
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   883
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
   884
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
   885
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   886
    index isInteger ifFalse:[
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   887
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   888
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   889
    ^ self subscriptBoundsError:index
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   890
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   891
a27a279701f8 Initial revision
claus
parents:
diff changeset
   892
instVarAt:index put:value
a27a279701f8 Initial revision
claus
parents:
diff changeset
   893
    "change a non-indexed instance variable;
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   894
     peeking into an object this way is not very object oriented 
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
   895
     - use with care (needed for copy, inspector etc.)"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   896
a27a279701f8 Initial revision
claus
parents:
diff changeset
   897
%{  /* NOCONTEXT */
a27a279701f8 Initial revision
claus
parents:
diff changeset
   898
a27a279701f8 Initial revision
claus
parents:
diff changeset
   899
    OBJ myClass;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   900
    int idx, ninstvars;
a27a279701f8 Initial revision
claus
parents:
diff changeset
   901
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
   902
    if (__isSmallInteger(index)) {
329
claus
parents: 325
diff changeset
   903
	myClass = __Class(self);
755
eaab1d1dacbd _-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents: 751
diff changeset
   904
	idx = __intVal(index) - 1;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   905
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
357
claus
parents: 356
diff changeset
   906
	/*
claus
parents: 356
diff changeset
   907
	 * do not allow setting of non-object fields.
claus
parents: 356
diff changeset
   908
	 * if subclass did not make privisions for that,
claus
parents: 356
diff changeset
   909
	 * we wont do so here ...
claus
parents: 356
diff changeset
   910
	 */
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
   911
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
357
claus
parents: 356
diff changeset
   912
	    if (idx == 0) {
claus
parents: 356
diff changeset
   913
		RETURN ( nil )
claus
parents: 356
diff changeset
   914
	    }
claus
parents: 356
diff changeset
   915
	}
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   916
	if ((idx >= 0) && (idx < ninstvars)) {
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   917
	    __InstPtr(self)->i_instvars[idx] = value;
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   918
	    __STORE(self, value);
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   919
	    RETURN ( value );
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   920
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   921
    }
a27a279701f8 Initial revision
claus
parents:
diff changeset
   922
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
   923
.
a27a279701f8 Initial revision
claus
parents:
diff changeset
   924
    index isInteger ifFalse:[
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   925
	^ self indexNotInteger
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   926
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
   927
    ^ self subscriptBoundsError:index
359
claus
parents: 357
diff changeset
   928
!
claus
parents: 357
diff changeset
   929
claus
parents: 357
diff changeset
   930
instVarNamed:name 
claus
parents: 357
diff changeset
   931
    "return a non-indexed instance variables value by name;
claus
parents: 357
diff changeset
   932
     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
   933
     - 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
   934
     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
   935
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
   936
claus
parents: 357
diff changeset
   937
    ^ 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
   938
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   939
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   940
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   941
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   942
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   943
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   944
     p instVarNamed:'x'  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   945
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   946
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   947
    "Modified: 19.4.1996 / 11:12:39 / cg"
359
claus
parents: 357
diff changeset
   948
!
claus
parents: 357
diff changeset
   949
1528
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   950
instVarNamed:name ifAbsent:exceptionBlock
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   951
    "return a non-indexed instance variables value by name,
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   952
     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
   953
     peeking into an object this way is not very object oriented 
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   954
     - 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
   955
     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
   956
     parsed ad runtime)"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   957
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   958
    |idx|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   959
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   960
    idx := self class instVarOffsetOf:name.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   961
    idx isNil ifTrue:[^ exceptionBlock value].
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   962
    ^ self instVarAt:idx
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   963
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   964
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   965
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   966
     |p|
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   967
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   968
     p := Point x:10 y:20.
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   969
     p instVarNamed:'x'  
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   970
    "
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   971
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   972
    "Created: 6.7.1996 / 23:02:49 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   973
    "Modified: 6.7.1996 / 23:03:41 / cg"
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   974
!
af168e6dadc9 added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents: 1515
diff changeset
   975
359
claus
parents: 357
diff changeset
   976
instVarNamed:name put:value
claus
parents: 357
diff changeset
   977
    "set a non-indexed instance variable by name;
claus
parents: 357
diff changeset
   978
     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
   979
     - 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
   980
     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
   981
     parsed ad runtime)"
359
claus
parents: 357
diff changeset
   982
claus
parents: 357
diff changeset
   983
    ^ 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
   984
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   985
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   986
     |p|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   987
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   988
     p := Point x:10 y:20.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   989
     p instVarNamed:'x' put:30.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   990
     p  
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   991
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   992
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
   993
    "Modified: 19.4.1996 / 11:12:49 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   994
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   995
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   996
!Object methodsFor:'binary storage'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   997
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   998
hasSpecialBinaryRepresentation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
   999
    "return true, if the receiver has a special binary representation;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1000
     default here is false, but can be redefined in class which provide
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1001
     their own storeBinary/readBinary methods.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1002
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1003
     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
  1004
     special classes such as True, False, UndefinedObject or SmallInteger.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1005
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1006
     If your instances should be stored in a special way, see
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1007
     #representBinaryOn: and #readBinaryContentsFromdata:manager:."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1008
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1009
    ^ false
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1010
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1011
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1012
readBinaryContentsFrom:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1013
    "reconstruct the receivers instance variables by reading a binary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1014
     binary representation from stream. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1015
     This is a general implementation, walking over instances 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1016
     and loading each recursively using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1017
     Redefined by some classes to read a more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1018
     (see String, SmallInteger etc).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1019
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1020
     Notice, that the object is already recreated as an empty corps
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1021
     with instance variables all nil and bit-instances (bytes, words etc.) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1022
     already read and restored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1023
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1024
     Also notice: this method is not called for if a private representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1025
     has been stored (see representBinaryOn:). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1026
     In that case, #readBinaryContentsFromData:manager: is called, which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1027
     has to be reimplemented in the objects class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1028
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1029
    |size "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1030
     instvarArray|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1031
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1032
    stream next == 1 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1033
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1034
	"/ special representation ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1035
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1036
	instvarArray := Array new:(size := stream nextNumber:3).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1037
	1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1038
	    instvarArray basicAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1039
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1040
	self readBinaryContentsFromData:instvarArray manager:manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1041
	^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1042
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1043
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1044
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1045
    "/ standard representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1046
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1047
    size := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1048
    size ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1049
	self class isPointers ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1050
	    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1051
		self basicAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1052
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1053
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1054
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1055
    size := self class instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1056
    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1057
	self instVarAt:i put:(manager nextObject)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1058
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1059
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1060
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1061
readBinaryContentsFromData:instvarArray manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1062
    "reconstruct the receivers instance variables by filling instance
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1063
     variables with values from instvarArray. This array contains the instvars
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1064
     as specified in #representBinaryOn: when the object was stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1065
     It is the receivers responsibility to set its instance variables in the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1066
     same order from that array."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1067
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1068
    ^ self subclassResponsibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1069
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1070
    "typical implementation (see also comment in #representBinaryOn:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1071
     (for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1072
      which did not store baz and wants baz to be reinitialized to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1073
      some constant string)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1074
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1075
	foo := instvarArray at:1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1076
	bar := instvarArray at:2.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1077
	baz := 'aConstant'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1078
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1079
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1080
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1081
representBinaryOn:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1082
    "this method is called by the storage manager to ask objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1083
     if they wish to provide their own binary representation.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1084
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1085
     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
  1086
     instance variables (named & indexed pointer) to be stored. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1087
     If not redefined, this method returns nil which means that all 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1088
     instance variables are to be stored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1089
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1090
     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
  1091
     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
  1092
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1093
     If this is redefined returning non-nil, the corresponding class needs
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1094
     a redefined instance method named #readBinaryContentsFromData:manager:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1095
     which has to fill the receivers named (and optionally indexed pointer)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1096
     instance variables with corresponding values from a data array."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1097
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1098
    ^ nil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1099
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1100
    "typical implementation:  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1101
     (see also comment in #readBinaryContentsFromData:manager:)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1102
     for an object with foo, bar and baz as instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1103
     which does not want to store baz:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1104
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1105
     representBinaryOn:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1106
	|data|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1107
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1108
	data := Array new:2.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1109
	data at:1 put:foo.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1110
	data at:2 put:bar.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1111
	^ data
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1112
    "
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1113
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1114
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1115
storeBinaryContentsFromData:instvarArray on:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1116
    "store the instvars (both named & indexed pointer)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1117
     as returned by #representBinaryOn:."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1118
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1119
    |size "{ Class: SmallInteger }"|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1120
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1121
    size := instvarArray size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1122
    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1123
	manager putIdOf:(instvarArray at:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1124
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1125
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1126
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1127
storeBinaryContentsOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1128
    "store the receivers instance variables in a binary representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1129
     on a stream using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1130
     This is a general implementation, walking over instances 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1131
     and storing each recursively using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1132
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1133
     Notice, that the objects definition and bit-instances (bytes, words etc.) 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1134
     are already stored. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1135
     Here, we only have to deal with indexed-pointer and named instance variables.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1136
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1137
     Also notice: this method is not called for if a private representation
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1138
     has been stored (see representBinaryOn:). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1139
     In that case, #storeBinaryContentsFromData:manager: is called."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1140
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1141
    |size "{ Class: SmallInteger }"|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1142
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1143
    size := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1144
    size ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1145
	self class isPointers ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1146
	    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1147
		manager putIdOf:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1148
	    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1149
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1150
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1151
    size := self class instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1152
    1 to:size do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1153
	manager putIdOf:(self instVarAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1154
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1155
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1156
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1157
storeBinaryDefinitionBodyOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1158
    "append a binary representation of the receivers body onto stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1159
     This is a general implementation walking over instances storing
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1160
     each recursively as an ID using manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1161
     Can be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1162
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1163
    |basicSize "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1164
     instSize  "{ Class: SmallInteger }"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1165
     myClass specialRep pointers|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1166
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1167
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1168
    instSize := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1169
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1170
    (pointers := myClass isPointers) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1171
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1172
	"/ inst size not needed - if you uncomment the line below,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1173
	"/ also uncomment the corresponding line in
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1174
	"/ Object>>binaryDefinitionFrom:manager:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1175
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1176
	"/ stream nextPut:instSize. "mhmh this limits us to 255 named instvars"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1177
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1178
	myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1179
	    stream nextNumber:3 put:(basicSize := self basicSize)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1180
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1181
	    basicSize := 0
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1182
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1183
    ] ifFalse: [
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1184
	stream nextNumber:4 put:(basicSize := self basicSize).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1185
	myClass isBytes ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1186
	    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1187
		stream nextPut:(self basicAt:i)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1188
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1189
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1190
	    myClass isWords ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1191
		1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1192
		    stream nextNumber:2 put:(self basicAt: i)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1193
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1194
	    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1195
		myClass isLongs ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1196
		    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1197
			stream nextNumber:4 put:(self basicAt: i)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1198
		    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1199
		] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1200
		    myClass isFloats ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1201
			"could do it in one big write on machines which use IEEE floats ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1202
			1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1203
			    Float storeBinaryIEEESingle:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1204
			]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1205
		    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1206
			myClass isDoubles ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1207
			    "could do it in one big write on machines which use IEEE doubles ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1208
			    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1209
				Float storeBinaryIEEEDouble:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1210
			    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1211
			] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1212
			    "/ should never be reached ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1213
			    1 to:basicSize do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1214
				manager putIdOf:(self basicAt:i) on:stream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1215
			    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1216
			]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1217
		    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1218
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1219
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1220
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1221
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1222
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1223
    (pointers or:[instSize ~~ 0]) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1224
	specialRep := self representBinaryOn:manager.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1225
	specialRep notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1226
	    stream nextPut:1.     "/ means: private representation follows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1227
	    stream nextNumber:3 put:(specialRep basicSize).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1228
	    self storeBinaryContentsFromData:specialRep on:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1229
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1230
	    stream nextPut:0.     "/ means: full representation follows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1231
	    self storeBinaryContentsOn:stream manager:manager
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1232
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1233
    ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1234
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1235
    "Modified: 25.10.1995 / 14:00:51 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1236
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1237
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1238
storeBinaryDefinitionOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1239
    "append a binary representation of the receiver onto stream.
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1240
     This is an internal interface for binary storage mechanism.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1241
     This method first stores the class, then the body, which is done
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1242
     in a separate method to allow redefinition of the bodies format.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1243
     Can be redefined in subclasses to write more compact representations
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1244
     (see String, SmallInteger etc)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1245
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1246
    manager putIdOfClass:(self class) on:stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1247
    self storeBinaryDefinitionBodyOn:stream manager:manager
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1248
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1231
diff changeset
  1249
    "Modified: 23.4.1996 / 09:31:12 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1250
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1251
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1252
storeBinaryOn:aStream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1253
    "Writes a description of the receiver onto aStream, in a way that allows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1254
     the object's structure to be reconstructed from the stream's contents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1255
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1256
    BinaryOutputManager store:self on:aStream
899
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1257
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1258
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1259
     |a s1 s2|
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1260
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1261
     s1 := 'hello'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1262
     s2 := 'world'.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1263
     a := Array new:5.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1264
     a at:1 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1265
     a at:2 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1266
     a at:3 put:s1.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1267
     a at:4 put:s2.
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1268
     a storeBinaryOn:'test.boss'
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1269
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1270
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1271
    "
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1272
     (BinaryObjectStorage onOld:'test.boss' asFilename readStream)
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1273
	next
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1274
	    inspect
ddcdb74e52de commentary
Claus Gittinger <cg@exept.de>
parents: 891
diff changeset
  1275
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1276
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1277
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1278
storeBinaryOn:stream manager:manager
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1279
    "append a binary representation of the receiver onto stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1280
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1281
    manager putIdOf:self on:stream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1282
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1283
1826
aa574220fff4 category rename
Claus Gittinger <cg@exept.de>
parents: 1820
diff changeset
  1284
!Object methodsFor:'change & update'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1285
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1286
broadcast:aSelectorSymbol
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1287
    "send a message with selector aSelectorSymbol to all my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1288
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1289
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1290
	dependent perform:aSelectorSymbol
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1291
    ]
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1294
broadcast:aSelectorSymbol with:anArgument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1295
    "send a message with selector aSelectorSymbol with an additional
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1296
     argument anArgument to all my dependents."
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
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1299
	dependent perform:aSelectorSymbol with:anArgument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1300
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1301
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1302
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1303
changeRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1304
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1305
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1306
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1307
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1308
	dependent updateRequest ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1309
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1310
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1311
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1312
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1313
changeRequest:aParameter
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1314
    "the receiver wants to change - check if all dependents
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1315
     grant the request, and return true if so"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1316
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1317
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1318
	(dependent updateRequest:aParameter) ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1319
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1320
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1321
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1322
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1323
changeRequest:aParameter from:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1324
    "the receiver wants to change - check if all dependents
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1325
     except anObject grant the request, and return true if so.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1326
     The argument anObject is typically going to be the one who is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1327
     about to send the change request."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1328
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1329
    self dependentsDo:[:dependent | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1330
	dependent == anObject ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1331
	    (dependent updateRequest:aParameter) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1332
	]
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
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1335
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1336
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1337
changeRequestFrom:anObject
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1338
    "the receiver wants to change - check if all dependents
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1339
     except anObject grant the request, and return true if so.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1340
     The argument anObject is typically going to be the one who is
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1341
     about to send the change request."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1342
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1343
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1344
	dependent == anObject ifFalse:[
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1345
	    (dependent updateRequest) ifFalse:[^ false].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1346
	]
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1347
    ].
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1348
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1349
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1350
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1351
changed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1352
    "notify all dependents that the receiver has changed.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1353
     Each dependent gets a '#update:'-message with the original
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1354
     receiver as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1355
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1356
    self changed:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1357
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1358
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1359
changed:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1360
    "notify all dependents that the receiver has changed somehow.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1361
     Each dependent gets a '#update:'-message with aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1362
     as argument."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1363
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1364
    self changed:aParameter with:nil
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1365
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1366
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1367
changed:aParameter with:anArgument
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1368
    "notify all dependents that the receiver has changed somehow.
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1369
     Each dependent gets a  '#update:with:from:'-message, with aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1370
     and anArgument as arguments."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1371
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1372
    self dependentsDo:[:dependent | 
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1373
	dependent update:aParameter with:anArgument from:self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1374
    ]
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1375
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1376
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1377
update:aParameter
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1378
    "the message is sent to a dependent, when one of the objects
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1379
     on whom the receiver depends, has changed. The argument aParameter
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1380
     is either the changed object or the argument to the #changed: message.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1381
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1382
     Default behavior here is to do nothing"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1383
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1384
    ^ self
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1385
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1386
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1387
update:aParameter with:anArgument
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1388
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1389
     Default is to try update:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1390
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1391
    ^ self update:aParameter
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1392
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1393
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1394
update:aParameter with:anArgument from:sender
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1395
    "dependent is notified of some change -
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1396
     Default is to try update:with:"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1397
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1398
    ^ self update:aParameter with:anArgument
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1399
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1400
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1401
updateRequest
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1402
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1403
     Default here is to grant updates - may be used
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1404
     to lock updates if someone is making other changes
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1405
     from within an update. Or if someone has locked its
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1406
     state and does not want others to change things.
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1407
     However, these dependents must all honor the
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1408
     changeRequest - ifTrue - change protocol. I.e. they
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1409
     must first ask all others via changeRequest, and only do the change
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1410
     it returns true. The others must decide in updateRequest and
40ca7cc6fb9c *** empty log message ***
claus
parents: 179
diff changeset
  1411
     return true if they think a change is ok."
159
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1412
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1413
    ^ true
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1414
!
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1415
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1416
updateRequest:aSymbol
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1417
    "return true, if an update request is granted.
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1418
     Default here a simple updateRequest"
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1419
514c749165c3 *** empty log message ***
claus
parents: 143
diff changeset
  1420
    ^ self updateRequest
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1421
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1422
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1423
!Object methodsFor:'cleanup'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1424
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1425
lowSpaceCleanup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1426
    "ignored here - redefined in some classes to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1427
     cleanup in low-memory situations"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1428
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1429
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1430
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1431
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1432
!Object methodsFor:'comparing'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1433
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1434
= anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1435
    "return true, if the receiver and the arg have the same structure"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1436
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1437
    ^ self == anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1438
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1439
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1440
== anObject
2505
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1441
    "return true, if the receiver and the arg are the same object.
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1442
     Never redefine this in any class.
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1443
     The compilers generates inline code for it - redefinition is useless."
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
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1446
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1447
    RETURN ( (self == anObject) ? true : false );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1448
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1449
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1450
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1451
hash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1452
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1453
     This hash should return same values for objects with same
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1454
     contents (i.e. use this to hash on structure)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1455
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1456
    ^ self identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1457
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1458
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1459
identityHash
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1460
    "return an Integer useful as a hash key for the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1461
     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
  1462
     this to hash on identity of objects).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1463
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1464
     We cannot use the Objects address (as other smalltalks do) since
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1465
     no object-table exists and the hashval must not change when objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1466
     are moved by the collector. Therefore we assign each object a unique
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1467
     Id in the object header itself as its hashed upon.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1468
     (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
  1469
     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
  1470
     object header will be needed, adding 4 bytes to every object. Alternatively,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1471
     hashed-upon objects could add an instvar containing the hash value."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1472
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1473
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1474
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1475
    REGISTER unsigned hash;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1476
    static unsigned nextHash = 0;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1477
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1478
    if (__isNonNilObject(self)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1479
	hash = __GET_HASH(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1480
	if (hash == 0) {
2462
5ba287e9f5bf slightly faster identityHash
Claus Gittinger <cg@exept.de>
parents: 2448
diff changeset
  1481
	    /* has no hash yet */
5ba287e9f5bf slightly faster identityHash
Claus Gittinger <cg@exept.de>
parents: 2448
diff changeset
  1482
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1483
	    if (++nextHash > __MAX_HASH__) {
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1484
		nextHash = 1;
2462
5ba287e9f5bf slightly faster identityHash
Claus Gittinger <cg@exept.de>
parents: 2448
diff changeset
  1485
	    }
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1486
	    hash = nextHash;
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1487
	    __SET_HASH(self, hash);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1488
	}
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
	/*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1491
	 * now, we got 11 bits for hashing;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1492
	 * make it as large as possible; since most hashers use the returned
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1493
	 * key and take it modulu some prime number, this will allow for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1494
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1495
	 */
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1496
	hash = __MAKE_HASH__(hash);
2462
5ba287e9f5bf slightly faster identityHash
Claus Gittinger <cg@exept.de>
parents: 2448
diff changeset
  1497
	RETURN ( __MKSMALLINT(hash) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1498
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1499
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1500
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1501
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1502
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1503
identityHashForBinaryStore
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1504
    "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
  1505
     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
  1506
     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
  1507
     object writing phase."
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1508
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1509
%{  /* NOCONTEXT */
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1510
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1511
    REGISTER unsigned hash, hash1, hash2, sz;
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1512
    OBJ o;
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1513
    static unsigned nextHash = 0;
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1514
    static unsigned nextClassHash = 0;
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1515
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1516
    if (__isNonNilObject(self)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1517
	/*
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1518
	 * my own identityHash
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1519
	 */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1520
	hash1 = __GET_HASH(self);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1521
	if (hash1 == 0) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1522
	    /* has no hash yet */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1523
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1524
	    if (++nextHash > __MAX_HASH__) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1525
		nextHash = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1526
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1527
	    hash1 = nextHash;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1528
	    __SET_HASH(self, hash1);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1529
	}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1530
	/*
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1531
	 * my classes identityHash
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1532
	 */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1533
	o = __qClass(self);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1534
	hash2 = __GET_HASH(o);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1535
	if (hash2 == 0) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1536
	    /* has no hash yet */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1537
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1538
	    if (++nextClassHash > __MAX_HASH__) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1539
		nextClassHash = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1540
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1541
	    hash2 = nextClassHash;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1542
	    __SET_HASH(o, hash2);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1543
	}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1544
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1545
	/*
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1546
	 * some bits of my size
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1547
	 */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1548
	sz = __qSize(self);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1549
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1550
	/*
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1551
	 * now, we got 11 + 11 + 8 bits for hashing;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1552
	 * make it as large as possible; since most hashers use the returned
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1553
	 * key and take it modulu some prime number, this will allow for
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1554
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1555
	 */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1556
	hash = (hash1 << 11) | hash2;           /* 22 bits */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1557
	hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1558
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1559
	while ((hash & 0x20000000) == 0) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1560
	    hash <<= 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1561
	}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1562
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1563
	RETURN ( __MKSMALLINT(hash) );
2479
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1564
    }
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1565
%}.
2480
077b0a0f9248 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2479
diff changeset
  1566
    ^ 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
  1567
!
6d9c516e04d8 added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents: 2478
diff changeset
  1568
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1569
isNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1570
    "return true, if the receiver is nil"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1571
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1572
    ^ 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
notNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1576
    "return true, if the receiver is not nil"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1577
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1578
    ^ true
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1579
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1580
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1581
~= anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1582
    "return true, if the receiver and the arg do not have the same structure"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1583
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1584
    ^ (self = anObject) not
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1585
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1586
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1587
~~ anObject
2505
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1588
    "return true, if the receiver and the arg are not the same object.
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1589
     Never redefine this in any class.
3c9bf86f9e9a comment
Claus Gittinger <cg@exept.de>
parents: 2502
diff changeset
  1590
     The compilers generates inline code for it - redefinition is useless."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1591
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1592
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1593
    RETURN ( (self == anObject) ? false : true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1594
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1595
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1596
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1597
!Object methodsFor:'converting'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1598
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1599
asValue
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1600
    "return a valueHolder for for the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1601
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1602
    ^ ValueHolder with:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1603
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1604
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1605
!Object methodsFor:'copying'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1606
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1607
copy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1608
    "return a copy of the receiver - defaults to shallowcopy here.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1609
     Notice, that copy does not copy dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1610
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1611
    ^ self shallowCopy postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1612
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1613
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1614
deepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1615
    "return a copy of the object with all subobjects also copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1616
     This method DOES handle cycles/self-refs; however the receivers
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1617
     class is not copied (to avoid the 'total' copy).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1618
     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
  1619
     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
  1620
     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
  1621
     no cycles, you can use the old simpleDeepCopy, which avoids this overhead,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1622
     but may run into trouble.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1623
     Notice, that copy does not copy dependents."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1624
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1625
    ^ self deepCopyUsing:(IdentityDictionary new)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1626
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1627
    "an example which is not handled by the old deepCopy:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1628
    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1629
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1630
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1631
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1632
     a deepCopy inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1633
    "
1129
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  1634
2734bcd503fe Fix typo in comment.
Stefan Vogel <sv@exept.de>
parents: 1119
diff changeset
  1635
    "Modified: 27.3.1996 / 16:31:20 / stefan"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1636
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1637
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1638
deepCopyError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1639
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1640
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1641
    "raise a signal, that deepCopy is not allowed for this object"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1642
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1643
    ^ DeepCopyErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1644
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1645
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1646
deepCopyUsing:aDictionary
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1647
    "a helper for deepCopy; return a copy of the object with 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1648
     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
  1649
     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
  1650
     This method DOES handle cycles/self references."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1651
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1652
    |myClass aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1653
     sz "{ Class: SmallInteger }" 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1654
     iOrig iCopy|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1655
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1656
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1657
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1658
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1659
	aCopy := myClass basicNew:sz.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1660
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1661
	sz := 0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1662
	aCopy := myClass basicNew
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1663
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1664
    aCopy setHashFrom:self.
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
    aDictionary at:self put:aCopy.
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1667
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1668
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1669
     copy indexed instvars - if any
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1670
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1671
    sz ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1672
	myClass isBits ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1673
	    "block-copy indexed instvars"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1674
	    aCopy replaceFrom:1 to:sz with:self startingAt:1
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1675
	] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1676
	    "individual deep copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1677
	    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1678
		iOrig := self basicAt:i.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1679
		iOrig notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1680
		    (aDictionary includesKey:iOrig) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1681
			iCopy := aDictionary at:iOrig
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1682
		    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1683
			iCopy := iOrig deepCopyUsing:aDictionary.
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
		    aCopy basicAt:i put:iCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1686
		]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1687
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1688
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1689
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1690
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
     copy the instance variables
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
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1695
    sz ~~ 0 ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1696
	1 to:sz do:[:i |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1697
	    iOrig := self instVarAt:i.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1698
	    iOrig notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1699
		(aDictionary includesKey:iOrig) ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1700
		    iCopy := aDictionary at:iOrig
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1701
		] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1702
		    iCopy := iOrig deepCopyUsing:aDictionary.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1703
		].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1704
		aCopy instVarAt:i put:iCopy
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
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1707
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1708
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1709
    ^ aCopy
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1712
postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1713
    "this is for compatibility with ST-80 code, which uses postCopy for
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1714
     cleanup after copying, while ST/X passes the original in postCopyFrom:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1715
     (see there)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1716
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1717
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1718
!
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
postCopyFrom:original
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1721
    "sent to a freshly deep-copied object to give it a chance to adjust things.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1722
     (a font could flush its device-handle for example). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1723
     Notice, that for Sets/Dicts etc. a rehash is not needed, since the deepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1724
     will have the same hash key as the receiver (as long as ST/X provides the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1725
     setHash: functionality)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1726
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1727
    "for ST-80 compatibility, we try postCopy here ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1728
    ^ self postCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1729
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1730
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1731
setHashFrom:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1732
    "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
  1733
     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
  1734
     Smalltalks, and may not be available in future ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1735
     DO NEVER use this for normal application code."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1736
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1737
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1738
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1739
    REGISTER unsigned h;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1740
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1741
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1742
	h = __GET_HASH(anObject);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1743
	__SET_HASH(self, h);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1744
	RETURN (self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1745
    }
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1746
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1747
    self primitiveFailed    "neither receiver not arg may be nil or 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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1750
shallowCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1751
    "return a copy of the object with shared subobjects (a shallow copy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1752
     i.e. the copy shares referenced instvars with its original."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1753
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1754
%{  /* NOCONTEXT */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1755
    int ninsts, spc;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1756
    int sz;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1757
    OBJ slf, theCopy;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1758
    OBJ cls;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1759
    int flags;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1760
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1761
    cls = __qClass(self);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1762
    flags = __intVal(__ClassInstPtr(cls)->c_flags);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1763
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1764
    /*
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1765
     * bail out for special objects ..
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1766
     */
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1767
    if (((flags & ~ARRAYMASK) == 0)
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1768
     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
2652
63fe707c52da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2651
diff changeset
  1769
	sz = __qSize(self);
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1770
	__PROTECT2__(self, cls);
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2851
diff changeset
  1771
	__qNew(theCopy, sz);	/* OBJECT ALLOCATION */
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1772
	__UNPROTECT2__(cls, slf);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1773
	if (theCopy) {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1774
	    spc = __qSpace(theCopy);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1775
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1776
	    theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1777
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1778
	    sz = sz - OHDR_SIZE;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1779
	    if (sz) {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1780
		char *src, *dst;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1781
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1782
		src = (char *)(__InstPtr(slf)->i_instvars);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1783
		dst = (char *)(__InstPtr(theCopy)->i_instvars);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1784
#ifdef bcopy4
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1785
		{
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1786
		    /* care for odd-number of longs */
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1787
		    int nW = sz >> 2;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1788
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1789
		    if (sz & 3) {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1790
			nW++;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1791
		    }
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1792
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1793
		    bcopy4(src, dst, nW);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1794
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1795
#else
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1796
		bcopy(src, dst, sz);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1797
#endif
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1798
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1799
		flags &= ARRAYMASK;
2652
63fe707c52da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2651
diff changeset
  1800
		if (flags == POINTERARRAY) {
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1801
		    ninsts = __BYTES2OBJS__(sz);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1802
		} else {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1803
		    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1804
		}
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1805
		if (ninsts) {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1806
		    do {
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1807
			OBJ el;
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1808
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1809
			el = __InstPtr(theCopy)->i_instvars[ninsts-1];
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1810
			__STORE_SPC(theCopy, el, spc);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1811
		    } while (--ninsts);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1812
		}
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1813
	    }
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1814
	    RETURN (theCopy);
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1815
	}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1816
    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1817
%}.
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1818
    "/ fallBack for special objects & memoryAllocation failure case
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1819
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1820
    ^ self slowShallowCopy
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1823
shallowCopyForFinalization
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1824
    "this is used to aquire a copy to be used for finalization -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1825
     (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
  1826
     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
  1827
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1828
    ^ self shallowCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1829
!
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
simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1832
    "return a copy of the object with all subobjects also copied.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1833
     This method does NOT handle cycles - but is included to allow this 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1834
     slightly faster copy in situations where it is known that
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1835
     no recursive references occur (LargeIntegers for example).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1836
     NOTICE: you will run into trouble, when trying this with recursive
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1837
     objects (usually recursionInterrupt or memory-alert).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1838
     This method corresponds to the 'traditional' deepCopy found in
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1839
     the Blue book."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1840
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1841
    |myClass aCopy 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1842
     sz "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1843
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1844
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1845
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1846
	sz := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1847
	aCopy := myClass basicNew:sz.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1848
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1849
	"copy the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1850
	1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1851
	    aCopy basicAt:i put:((self basicAt:i) simpleDeepCopy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1852
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1853
    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1854
	aCopy := myClass basicNew 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1855
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1856
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1857
    "copy the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1858
    sz := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1859
    1 to:sz do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1860
	aCopy instVarAt:i put:((self instVarAt:i) simpleDeepCopy)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1861
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1862
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1863
    ^ aCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1864
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1865
    "a bad example (but ST/X should survive ...)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1866
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1867
     |a|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1868
     a := Array new:3.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1869
     a at:3 put:a.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1870
     a simpleDeepCopy
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1871
    "
2651
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1872
!
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1873
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1874
slowShallowCopy
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1875
    "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
  1876
     i.e. the copy shares referenced instvars with its original.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1877
     This method is only invoked as a fallback from #shallowCopy."
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1878
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1879
    |myClass aCopy 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1880
     sz "{ Class: SmallInteger }" |
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1881
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1882
    myClass := self class.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1883
    myClass isVariable ifTrue:[
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1884
	sz := self basicSize.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1885
	aCopy := myClass basicNew:sz.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1886
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1887
	"copy the indexed variables"
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1888
	1 to:sz do:[:i | 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1889
	    aCopy basicAt:i put:(self basicAt:i) 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1890
	]
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1891
    ] ifFalse:[
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1892
	aCopy := myClass basicNew
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1893
    ].
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1894
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1895
    "copy the instance variables"
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1896
    sz := myClass instSize.
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1897
    1 to:sz do:[:i | 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1898
	aCopy instVarAt:i put:(self instVarAt:i) 
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1899
    ].
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1900
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1901
    ^ aCopy
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1902
! !
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
!Object methodsFor:'debugging'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1905
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1906
basicInspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1907
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1908
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1909
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1910
     this method should NOT be redefined in subclasses."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1911
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1912
    Inspector isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1913
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1914
	 for systems without GUI
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1915
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1916
	Transcript showCR:'no Inspector'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1917
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  1918
	Inspector openOn:self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1919
    ]
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1920
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  1921
    "Modified: 18.5.1996 / 15:43:25 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1922
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1923
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1924
inspect
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1925
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1926
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1927
    "launch an inspector on the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1928
     this method (or better: inspectorClass) can be redefined in subclasses 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1929
     to start special inspectors."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1930
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1931
    |cls|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1932
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1933
    cls := self inspectorClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1934
    cls isNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1935
	^ self basicInspect
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
    cls openOn:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1938
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1939
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1940
     Object new inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1941
     (1 @ 2) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1942
     Smalltalk inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1943
     #(1 2 3) asOrderedCollection inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1944
     (Color red) inspect
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1945
     (Image fromFile:'bitmaps/garfield.gif') inspect
143
5ebe463ba109 got rid of globals;
claus
parents: 113
diff changeset
  1946
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1947
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  1948
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1949
inspectorClass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1950
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1951
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1952
    "return the class to use for inspect. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1953
     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
  1954
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1955
    ^ Inspector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1956
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1957
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1958
mustBeKindOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1959
    "for compatibility & debugging support: 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1960
     check if the receiver isKindOf:aClass and raise an error if not.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1961
     Notice:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1962
	it is VERY questionable, if it makes sense to add manual
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1963
	type checks to a dynamically typed language like smalltalk. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1964
	It will, at least, slow down performance,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1965
	make your code less reusable and clutter your code with stupid sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1966
	of this selector. Also, read the comment in isKindOf:, regarding the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1967
	use of isXXX check methods.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1968
     You see: The author does not like this at all ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1969
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1970
    (self isKindOf:aClass) ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1971
	self error:'argument is not of expected type'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1972
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1973
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1974
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1975
obsoleteMethodWarning
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1976
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1977
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1978
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1979
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1980
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1981
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1982
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1983
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1984
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1985
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1986
    self obsoleteMethodWarning:nil from:thisContext sender
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
obsoleteMethodWarning:message
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1990
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  1991
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1992
    "in methods which are going to be obsoleted, a self send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1993
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1994
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1995
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1996
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1997
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1998
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  1999
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2000
    self obsoleteMethodWarning:message from:thisContext sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2001
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2002
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2003
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
  2004
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2005
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2006
    "in methods which are going to be obsoleted, a self-send to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2007
     this method is used to tell programmers that a method is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2008
     used which is going to be removed in later ST/X versions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2009
     Find all methods which will be obsolete soon by looking at senders
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2010
     of this message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2011
     Hopefully, this warning message is annoying enough for you to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2012
     change the code ... ;-)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2013
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2014
    |spec|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2015
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2016
    spec := aContext methodPrintString.
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2017
    ('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2018
    ('         And may not be present in future ST/X versions.') errorPrintCR.
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2019
    ('         called from ' , aContext sender printString) errorPrintCR.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2020
    message notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2021
	'------>  ' errorPrint. message errorPrintCR
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2022
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2023
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2024
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2025
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2026
    "
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2027
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2028
    "Modified: 10.1.1997 / 19:08:42 / cg"
783
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2031
!Object methodsFor:'dependents access'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2032
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2033
addDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2034
    "make the argument, anObject be a dependent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2035
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2036
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2037
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2038
    "/ 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
  2039
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2040
    "/ 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
  2041
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2042
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2043
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2044
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2045
	|deps dep|
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2046
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2047
	deps := self dependents.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2048
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2049
	"/ to save a fair amount of memory in case of
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2050
	"/ many dependencies, we store a single dependent in
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2051
	"/ a WeakArray, and switch to a WeakSet if more dependents are
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2052
	"/ added.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2053
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2054
	deps isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2055
	    self dependents:(WeakArray with:anObject)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2056
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2057
	    deps class == WeakArray ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2058
		dep := deps at:1.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2059
		dep ~~ anObject ifTrue:[
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2060
		    (dep isNil or:[dep == 0]) ifTrue:[
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2061
			deps at:1 put:anObject
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2062
		    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2063
			self dependents:(WeakIdentitySet with:dep with:anObject)
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2064
		    ]
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2065
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2066
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2067
		deps add:anObject
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2068
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2069
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2070
    ] valueNowOrOnUnwindDo:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2071
	wasBlocked ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2072
	    OperatingSystem unblockInterrupts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2073
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2074
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2075
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2076
    "Modified: 1.8.1996 / 14:21:20 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2077
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2078
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2079
dependents
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2080
    "return a Collection of dependents - nil if there is none.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2081
     The default implementation here uses a global WeakDictionary to store
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2082
     dependents 
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2083
     This may be too slow for high frequency change&update,
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2084
     therefore, some classes (Model) redefine this for better performance.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2085
     Notice the mentioning of a WeakDictionary - read the classes documentation."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2086
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2087
    ^ Dependencies at:self ifAbsent:[nil]
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2088
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2089
    "Modified: 19.4.1996 / 12:36:46 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2090
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2091
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2092
dependents:aCollection
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2093
    "set the collection of dependents.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2094
     The default implementation here uses a global Dictionary to store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2095
     dependents which may be too slow for high frequency change&update.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2096
     Therefore, some classes (Model) redefine this for better performance."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2097
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2098
    "/ 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
  2099
    "/ 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
  2100
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2101
    "/ faster execution (and to avoid creation of garbage blocks).
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2102
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2103
    (OperatingSystem blockInterrupts) ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2104
	"/ the common case - already blocked
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
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2107
	    Dependencies removeKey:self ifAbsent:[]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2108
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2109
	    Dependencies at:self put:aCollection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2110
	].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2111
	^ self
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2112
    ].
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2113
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2114
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2115
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2116
	    Dependencies removeKey:self ifAbsent:[]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2117
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2118
	    Dependencies at:self put:aCollection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2119
	].
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2120
    ] valueNowOrOnUnwindDo:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2121
	OperatingSystem unblockInterrupts
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2122
    ]
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2123
2336
45f63b0d8832 tuned #dependents:
Claus Gittinger <cg@exept.de>
parents: 2327
diff changeset
  2124
    "Modified: 30.1.1997 / 21:22:10 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2125
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2126
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2127
dependentsDo:aBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2128
    "evaluate aBlock for all of my dependents"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2129
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2130
    |deps nwDeps|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2131
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2132
    deps := self dependents.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2133
    deps notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2134
	deps do:[:d | 
1780
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2135
		    (d notNil and:[d ~~ 0]) ifTrue:[
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2136
			aBlock value:d
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2137
		    ]
1b3a4ddc5b94 changed WeakArray to set emptied slots to zero
Claus Gittinger <cg@exept.de>
parents: 1762
diff changeset
  2138
		]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2139
    ].
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2140
    nwDeps := self nonWeakDependents.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2141
    (nwDeps notNil and:[nwDeps ~~ deps]) ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2142
	nwDeps do:aBlock 
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2143
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2144
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2145
    "Modified: 19.4.1996 / 12:35:54 / cg"
1098
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2146
!
e8543399e2a0 support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents: 1097
diff changeset
  2147
2445
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2148
myDependents
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2149
    "same as dependents - ST-80 compatibility"
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2150
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2151
    ^ self dependents
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2152
!
efd1b24db615 added #myDependents
ca
parents: 2437
diff changeset
  2153
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2154
release
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2155
    "remove all dependencies from the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2156
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2157
    self dependents:nil.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2158
    self nonWeakDependents:nil
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2159
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2160
    "Modified: 19.4.1996 / 10:55:36 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2161
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2162
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2163
removeDependent:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2164
    "make the argument, anObject be independent of the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2165
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2166
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2167
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2168
    "/ 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
  2169
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2170
    "/ 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
  2171
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2172
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2173
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2174
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2175
	|deps n d|
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2176
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2177
	deps := self dependents.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2178
	deps notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2179
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2180
	    "/ to save a fair amount of memory in case of
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2181
	    "/ many dependencies, we store a single dependent in
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2182
	    "/ a WeakArray, and switch to a WeakSet if more dependents are
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2183
	    "/ added. Here we have to do the inverse ...
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2184
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2185
	    deps class == WeakArray ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2186
		((d := deps at:1) == anObject 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2187
		or:[d isNil
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2188
		or:[d == 0]]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2189
		    self dependents:nil
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2190
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2191
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2192
		deps remove:anObject ifAbsent:[].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2193
		(n := deps size) == 0 ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2194
		    self dependents:nil
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2195
		] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2196
		    n == 1 ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2197
			d := deps firstIfEmpty:nil.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2198
			d notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2199
			    deps := WeakArray with:d
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2200
			] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2201
			    deps := nil
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2202
			].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2203
			self dependents:deps.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2204
		    ]
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
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2207
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2208
    ] valueNowOrOnUnwindDo:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2209
	wasBlocked ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2210
	    OperatingSystem unblockInterrupts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2211
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2212
    ]
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2213
2341
05b6a63f8b6f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2336
diff changeset
  2214
    "Modified: 31.1.1997 / 12:36:16 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2215
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2216
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2217
!Object methodsFor:'dependents access (nonWeak)'!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2218
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2219
addNonWeakDependent:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2220
    "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
  2221
     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
  2222
     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
  2223
     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
  2224
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2225
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2226
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2227
    "/ 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
  2228
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2229
    "/ 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
  2230
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2231
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2232
    wasBlocked := OperatingSystem blockInterrupts.
863
2c83fe958ca7 change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2233
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2234
	|deps dep|
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2235
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2236
	deps := self nonWeakDependents.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2237
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2238
	"/ to save a fair amount of memory in case of
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2239
	"/ many dependencies, we store a single dependent in
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2240
	"/ an Array, and switch to a Set if more dependents are
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2241
	"/ added.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2242
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2243
	deps isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2244
	    self nonWeakDependents:(Array with:anObject)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2245
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2246
	    deps class == Array ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2247
		dep := deps at:1.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2248
		dep ~~ anObject ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2249
		    self nonWeakDependents:(IdentitySet with:dep with:anObject)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2250
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2251
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2252
		deps add:anObject
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2253
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2254
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2255
    ] valueNowOrOnUnwindDo:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2256
	wasBlocked ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2257
	    OperatingSystem unblockInterrupts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2258
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2259
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2260
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2261
    "Created: 19.4.1996 / 10:54:08 / cg"
1624
50c5849dc9d4 mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents: 1611
diff changeset
  2262
    "Modified: 1.8.1996 / 14:22:12 / cg"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2263
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2264
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2265
nonWeakDependents
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2266
    "return a Collection of nonWeakDependents - nil if there is none.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2267
     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
  2268
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2269
    NonWeakDependencies isNil ifTrue:[^nil].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2270
    ^ NonWeakDependencies at:self ifAbsent:[nil]
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2271
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2272
    "Created: 19.4.1996 / 10:55:06 / cg"
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2273
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2274
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2275
nonWeakDependents:aCollection
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2276
    "set the collection of nonWeak dependents.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2277
     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
  2278
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2279
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2280
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2281
	    NonWeakDependencies removeKey:self ifAbsent:[]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2282
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2283
	    NonWeakDependencies at:self put:aCollection
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2284
	]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2285
    ] valueUninterruptably
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2286
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2287
    "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
  2288
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2289
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2290
removeNonWeakDependent:anObject
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2291
    "remove a nonWeak dependency from the receiver to the argument, anObject.
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2292
     (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
  2293
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2294
    |wasBlocked|
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2295
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2296
    "/ 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
  2297
    "/ is possibly accessed from multiple threads.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2298
    "/ 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
  2299
    "/ faster execution.
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2300
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2301
    wasBlocked := OperatingSystem blockInterrupts.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2302
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2303
	|deps n|
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2304
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2305
	deps := self nonWeakDependents.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2306
	deps notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2307
	    deps class == Array ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2308
		(deps at:1) == anObject ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2309
		    self nonWeakDependents:nil
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2310
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2311
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2312
		deps remove:anObject ifAbsent:[].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2313
		(n := deps size) == 0 ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2314
		    self nonWeakDependents:nil
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2315
		] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2316
		    n == 1 ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2317
			self nonWeakDependents:(Array with:(deps first))
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2318
		    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2319
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2320
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2321
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2322
    ] valueNowOrOnUnwindDo:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2323
	wasBlocked ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2324
	    OperatingSystem unblockInterrupts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2325
	]
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2326
    ]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2327
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2328
    "Created: 19.4.1996 / 11:44:44 / cg"
1585
5cfa7f2586ad use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents: 1533
diff changeset
  2329
    "Modified: 19.7.1996 / 12:42:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2330
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2331
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2332
!Object methodsFor:'error handling'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2333
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2334
appropriateDebugger:aSelector
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2335
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2336
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2337
    "return an appropriate debugger to use.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2338
     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
  2339
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2340
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2341
    |context|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2342
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2343
    "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
  2344
1685
5f867e93af8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
  2345
    (Processor isNil 
1684
98ce4d199c9b scheisse
Claus Gittinger <cg@exept.de>
parents: 1678
diff changeset
  2346
    or:[Processor activeProcessIsSystemProcess]) ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2347
	^ MiniDebugger
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2348
    ].
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2349
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2350
    context := thisContext.
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2851
diff changeset
  2351
    context := context findNextContextWithSelector:aSelector or:nil or:nil.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2352
    [context notNil] whileTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2353
	((context receiver class == Debugger) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2354
	 and:[context selector == aSelector]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2355
	    "we are already in some Debugger"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2356
	    (Debugger == MiniDebugger) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2357
		"we are already in the MiniDebugger"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2358
		ErrorRecursion ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2359
		    Smalltalk fatalAbort:'recursive error ...'
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2360
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2361
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2362
	    MiniDebugger isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2363
		Smalltalk fatalAbort:'no debugger'
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2364
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2365
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2366
	    "ok, an error occured while in the graphical debugger;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2367
	     lets try MiniDebugger"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2368
	    ^ MiniDebugger
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2369
	].
2893
8ba406da6b22 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2851
diff changeset
  2370
	context := context findNextContextWithSelector:aSelector or:nil or:nil.
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2371
    ].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2372
    "not within Debugger - no problem"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2373
    ^ Debugger
1678
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2374
1c0fc4e322d0 Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents: 1674
diff changeset
  2375
    "Modified: 23.9.1996 / 12:14:52 / stefan"
2511
35de13a3a71e dont mark all contexts as nonLifo in approriateDebugger.
Claus Gittinger <cg@exept.de>
parents: 2506
diff changeset
  2376
    "Modified: 27.3.1997 / 18:21:07 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2377
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2378
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2379
cannotSendMessage:aMessage to:someReceiver
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2380
    "this message is sent by the runtime system (VM),
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2381
     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
  2382
     a valid behavior (see documentation in Behavior)."
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2383
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2384
    ^ InternalErrorSignal
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2385
	  raiseRequestWith:someReceiver
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2386
	  errorString:('bad class in send of #' , aMessage selector)
2231
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2387
88ffbbaf1986 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  2388
    "Modified: 23.1.1997 / 00:05:39 / cg"
2229
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2389
!
a9881102b243 new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  2390
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2391
doesNotUnderstand:aMessage
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2392
    "this message is sent by the runtime system (VM) when
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2393
     a message is not understood by some object (i.e. there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2394
     is no method for that selector). The original message has
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2395
     been packed into aMessage (i.e. the receiver, selector and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2396
     any arguments) and the original receiver is then sent the
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2397
     #doesNotUnderstand: message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2398
     Here, we raise another signal which usually enters the debugger.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2399
     You can of course redefine #doesNotUnderstand: in your classes
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2400
     to implement message delegation, 
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2401
     or handle the MessageNotUnderstoodSignal gracefully."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2402
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2403
    |sel errorString cls sender|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2404
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2405
    sel := aMessage selector printString.
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2406
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2407
    "/ Although sel should always be a symbol,
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2408
    "/ always use printStrings in the code below.
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2409
    "/ 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
  2410
    "/ 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
  2411
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2412
    "/ handle the case of an error during early startup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2413
    "/ (output streams not yet initialized)
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2414
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2415
    Stdout isNil ifTrue:[
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2416
        Smalltalk fatalAbort:'error during init: ' , sel , ' not understood'.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2417
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2418
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2419
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2420
    "/ extract the class that should have implemented the message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2421
    "/ (in case of a super-send, this is not the receivers class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2422
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2423
    sender := thisContext sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2424
    cls := sender searchClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2425
    cls isNil ifTrue:[
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2426
        "it was NOT a super or directed send ..."
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2427
        cls := self class
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2428
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2429
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2430
    cls notNil ifTrue:[
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2431
        "/
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2432
        "/ displayString is better than 'cls name',
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2433
        "/ since it appends (obsolete) for outdated classes.
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2434
        "/ (this happens if you send messages to old instances
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2435
        "/  after changing a classes definition)
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2436
        "/
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2437
        errorString := cls displayString.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2438
    ] ifFalse:[    
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2439
        errorString := '(** nil-class **)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2440
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2441
    errorString := errorString , ' does not understand: ' , sel.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2442
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2443
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2444
    "/ this only happens, when YOU play around with my classvars ...
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2445
    "/ (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
  2446
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2447
    MessageNotUnderstoodSignal isNil ifTrue:[
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2448
        ^ self 
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2449
            enterDebuggerWithMessage:'oops - MessageNotUnderstoodSignal is gone'
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2450
            on:thisContext.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2451
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2452
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2453
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2454
    "/ 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
  2455
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2456
    ^ MessageNotUnderstoodSignal
2818
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2457
                raiseRequestWith:aMessage
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2458
                     errorString:errorString
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2459
                              in:sender
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2460
58125948706b care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
  2461
    "Modified: 31.7.1997 / 17:04:49 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2462
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2463
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2464
elementBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2465
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2466
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2467
    "report an error that badElement is out of bounds 
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2468
     (i.e. cannot be put into that collection).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2469
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2470
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2471
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2472
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2473
    "Modified: 8.5.1996 / 09:12:45 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2474
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2475
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2476
elementNotCharacter
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2477
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2478
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2479
    "report an error that object to be stored is no Character.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2480
     (usually when storing into Strings).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2481
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2482
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2483
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2484
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2485
    "Modified: 8.5.1996 / 09:12:49 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2486
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2487
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2488
elementNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2489
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2490
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2491
    "report an error that object to be stored is not Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2492
     (in collections that store integers only).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2493
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2494
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2495
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2496
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2497
    "Modified: 8.5.1996 / 09:12:51 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2498
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2499
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2500
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
  2501
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2502
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2503
    "enter the debugger with error-message aString"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2504
1674
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2505
    ^ self 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2506
	enterDebuggerWithMessage:aString 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2507
	on:anException suspendedContext
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2508
!
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2509
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2510
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
  2511
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2512
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2513
    "enter the debugger with error-message aString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2514
     The first visible context shown there is aContext 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2515
     (this allows intermediate helpers to hide themselfes from what is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2516
     presented to the user)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2517
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2518
    |debugger msg|
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2519
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2520
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2521
     if there is no debugger, exit smalltalk
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2522
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2523
    Debugger isNil ifTrue:[
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2524
        msg := 'error: ' , aString.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2525
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2526
        Smalltalk isStandAloneApp ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2527
            Dialog notNil ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2528
                (Dialog 
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2529
                    confirm:msg title:(Smalltalk commandName)
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2530
                    yesLabel:'ignore' noLabel:'exit'
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2531
                ) ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2532
                    ^ AbortSignal raise
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2533
                ]
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2534
            ].
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2535
            msg errorPrintCR.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2536
            OperatingSystem exit:1
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2537
        ].
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2538
        msg errorPrintCR.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2539
        Smalltalk fatalAbort:'no Debugger defined'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2540
    ].
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  2541
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2542
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2543
     find an appropriate debugger to use
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2544
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2545
    debugger := self appropriateDebugger:#'enter:withMessage:'.
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2546
    debugger isNil ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2547
        ^ AbortSignal raise
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2548
    ].    
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2549
    ^ 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
  2550
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  2551
    "Modified: 24.7.1997 / 10:09:20 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2552
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2553
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2554
error
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2555
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2556
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2557
    "report error that an error occured.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2558
     The error is reported by raising the ErrorSignal exception."
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2559
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2560
    ^ ErrorSignal raiseIn:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2561
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2562
    "Modified: 8.5.1996 / 09:13:01 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2563
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2564
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2565
error:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2566
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2567
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2568
    "enter debugger with error-message aString.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2569
     The error is reported by raising the ErrorSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2570
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2571
    ^ ErrorSignal raiseRequestWith:#error: 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2572
		       errorString:aString
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2573
				in:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2574
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2575
    "Modified: 8.5.1996 / 09:13:04 / cg"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2576
!
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2577
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2578
error:aString in:aContext
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2579
    "{ Pragma: +optSpace }"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2580
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2581
    "enter debugger with error-message aString.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2582
     The error is reported by raising the ErrorSignal exception."
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2583
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2584
    ^ ErrorSignal raiseRequestWith:#error: 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2585
		       errorString:aString
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2586
				in:aContext
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2587
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2588
    "Created: 8.5.1996 / 09:07:59 / cg"
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2589
    "Modified: 8.5.1996 / 09:13:06 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2590
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2591
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2592
errorKeyNotFound:aKey
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2593
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2594
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2595
    "report an error that a key was not found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2596
     The error is reported by raising the KeyNotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2597
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2598
    ^ KeyNotFoundSignal raiseRequestWith:aKey in:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2599
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2600
    "Modified: 8.5.1996 / 09:13:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2601
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2602
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2603
errorNotFound
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2604
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2605
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2606
    "report an error that no element was found in a collection.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2607
     The error is reported by raising the NotFoundSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2608
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2609
    ^ NotFoundSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2610
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2611
    "Modified: 8.5.1996 / 09:13:11 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2612
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2613
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2614
halt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2615
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2616
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2617
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2618
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2619
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2620
    ^ HaltSignal raiseIn:thisContext sender.
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2621
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2622
    "Modified: 8.5.1996 / 09:12:38 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2623
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2624
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2625
halt:aString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2626
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2627
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2628
    "enter debugger with halt-message.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2629
     The error is reported by raising the HaltSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2630
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2631
    ^ HaltSignal raiseRequestWith:#halt: 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2632
		      errorString:aString
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2633
			       in:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2634
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2635
    "Modified: 8.5.1996 / 09:13:23 / 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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2638
implementedBySubclass
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2639
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2640
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2641
    "this is sent by ST/V code - its the same as #subclassResponsibility"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2642
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2643
    ^ self subclassResponsibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2644
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2645
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2646
indexNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2647
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2648
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2649
    "report an error that index is not an Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2650
     (when accessing collections indexed by an integer key).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2651
     The error is reported by raising the NonIntegerIndexSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2652
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2653
    ^ NonIntegerIndexSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2654
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2655
    "Modified: 8.5.1996 / 09:13:37 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2656
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2657
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2658
integerCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2659
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2660
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2661
    "generated when a variable declared with an integer type gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2662
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2663
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2664
    ^ self error:'bad assign of ' , self printString , 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2665
		  ' (' , self class name , ') to integer-typed variable'
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2666
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2667
2829
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  2668
invalidCodeObject
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  2669
    "{ Pragma: +optSpace }"
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  2670
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  2671
    self error:'not an executable code object'
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  2672
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  2673
    "Created: 1.8.1997 / 00:16:44 / cg"
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  2674
!
909f31cc9b0b must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents: 2819
diff changeset
  2675
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2676
invalidMessage 
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2677
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2678
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2679
    "this is sent by ST/V code - its the same as #shouldNotImplement"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2680
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2681
    ^ self shouldNotImplement
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2682
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2683
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2684
mustBeRectangle
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2685
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2686
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2687
    "report an argument-not-rectangle-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2688
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2689
    ^ self error:'argument must be a Rectangle'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2690
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2691
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2692
mustBeString
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2693
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2694
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2695
    "report an argument-not-string-error"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2696
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2697
    ^ self error:'argument must be a String'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2698
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2699
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2700
notIndexed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2701
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2702
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2703
    "report an error that receiver has no indexed instance variables.
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2704
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2705
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2706
    ^ SubscriptOutOfBoundsSignal 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2707
	raiseErrorString:'receiver has no indexed variables'
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2708
	in:thisContext sender
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2709
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2710
    "Modified: 26.7.1996 / 16:43:13 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2711
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2712
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2713
primitiveFailed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2714
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2715
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2716
    "report an error that some primitive code failed.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2717
     The error is reported by raising the PrimitiveFailureSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2718
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2719
    ^ PrimitiveFailureSignal raiseIn:(thisContext sender)
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2720
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2721
    "Modified: 8.5.1996 / 09:14:07 / cg"
783
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2724
shouldNotImplement
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2725
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2726
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2727
    "report an error that this message should not be implemented"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2728
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2729
    ^ self error:'method not appropriate for this class'
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2730
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2731
    "Modified: 8.5.1996 / 09:09:44 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2732
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2733
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2734
subclassResponsibility
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2735
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2736
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2737
    "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
  2738
     subclass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2739
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2740
    ^ self error:'method must be reimplemented in subclass' in:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2741
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2742
    "Modified: 8.5.1996 / 09:09:26 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2743
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2744
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2745
subscriptBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2746
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2747
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2748
    "report an error that some index is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2749
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2750
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2751
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2752
    ^ SubscriptOutOfBoundsSignal 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2753
	raiseIn:thisContext sender
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2754
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2755
    "Modified: 26.7.1996 / 16:45:42 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2756
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2757
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2758
subscriptBoundsError:anIndex
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2759
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2760
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2761
    "report an error that anIndex is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2762
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2763
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2764
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2765
    ^ SubscriptOutOfBoundsSignal 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2766
	raiseRequestWith:anIndex 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2767
	errorString:('subscript (' , anIndex printString , ') out of bounds')
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2768
	in:thisContext sender
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2769
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2770
    "Modified: 8.5.1996 / 09:14:34 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2771
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2772
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2773
typeCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2774
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2775
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2776
    "generated when a variable declared with a type hint gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2777
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2778
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2779
    ^ self error:'bad assign of ' , self printString ,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2780
		  ' (' , self class name , ') to typed variable'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2781
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2782
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2783
!Object methodsFor:'evaluation'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2784
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2785
value
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2786
    "return the receiver itself.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2787
     This allows every object to be used where blocks or valueHolders
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2788
     are typically used, and allows for valueHolders and blocks to be
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2789
     used interchangably in some situations.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2790
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2791
     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
  2792
     style ... (the idea was borrowed from the Self language).
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2793
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2794
     WARNING: dont 'optimize' away ifXXX: blocks 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2795
	      (i.e. do NOT replace 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2796
			foo ifTrue:[var1] ifFalse:[var2]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2797
	       by:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2798
			foo ifTrue:var1 ifFalse:var2
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2799
	      )
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2800
	      - the compilers will only generate inline code for the if, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2801
		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
  2802
		generated.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2803
	      This 'oprimization' will work semantically correct,
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2804
	      but execute SLOWER instead."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2805
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2806
    ^ self
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2807
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2808
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2809
     #(1 2 3 4) indexOf:5 ifAbsent:0     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2810
     #(1 2 3 4) indexOf:5 ifAbsent:[0]     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2811
     1 > 2 ifTrue:['yes'] ifFalse:['no']  
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2812
     1 > 2 ifTrue:'yes' ifFalse:'no'       
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2813
    "
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
    "DO NOT DO THIS (its slower)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2816
     (1 > 4) ifTrue:'oops' ifFalse:'ok'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2817
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2818
     USE (the compiler optimizes blocks in if/while):
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2819
     (1 > 4) ifTrue:['oops'] ifFalse:['ok']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2820
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2821
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2822
    "Modified: 3.5.1996 / 11:57:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2823
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2824
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2825
!Object methodsFor:'initialization'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2826
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2827
initialize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2828
    "just to ignore initialize to objects which do not need it"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2829
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2830
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2831
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2832
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2833
!Object methodsFor:'interest'!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2834
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2835
addInterest:anInterest
1762
e7267ff590ff Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1751
diff changeset
  2836
    "install an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2837
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2838
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2839
    self addNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2840
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2841
    "Created: 14.10.1996 / 22:27:34 / stefan"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2842
!
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2843
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2844
expressInterestIn:aspect for:anObject sendBack:aSelector
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2845
    "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
  2846
     changes aspect."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2847
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2848
    "/ 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
  2849
    "/ 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
  2850
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2851
    self addInterest:(InterestConverter 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2852
			    destination:anObject 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2853
			    selector:aSelector 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2854
			    aspect:aspect)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2855
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2856
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2857
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2858
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2859
     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
  2860
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2861
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2862
     Transcript showCR:'interest in #foo:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2863
     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
  2864
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2865
     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
  2866
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2867
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2868
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2869
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2870
     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
  2871
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2872
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2873
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2874
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2875
     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
  2876
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2877
     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
  2878
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2879
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2880
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2881
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2882
     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
  2883
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2884
     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
  2885
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2886
     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
  2887
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2888
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2889
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2890
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2891
     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
  2892
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2893
     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
  2894
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2895
     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
  2896
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2897
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2898
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2899
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2900
     Transcript showCR:'no more interests:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2901
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2902
     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
  2903
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2904
     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
  2905
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2906
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2907
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2908
     p release.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2909
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2910
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2911
    "Created: 19.4.1996 / 10:26:22 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2912
    "Modified: 19.4.1996 / 12:34:08 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2913
    "Modified: 14.10.1996 / 22:28:20 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2914
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2915
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2916
interests
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2917
    "return a Collection of interests - nil if there is none.
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2918
     Here, we use the nonWeakDependents for interests."
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2919
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2920
    ^ self nonWeakDependents
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2921
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2922
    "Created: 14.10.1996 / 22:20:51 / stefan"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2923
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2924
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2925
onChangeSend:aSelector to:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2926
    "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
  2927
     changes."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2928
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2929
    "/ 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
  2930
    "/ 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
  2931
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2932
    self addInterest:(InterestConverter 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2933
			  destination:anObject 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2934
			  selector:aSelector)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2935
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2936
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2937
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2938
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2939
     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
  2940
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2941
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2942
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2943
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2944
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2945
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2946
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2947
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2948
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2949
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2950
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2951
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2952
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2953
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2954
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2955
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2956
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2957
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2958
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2959
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2960
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2961
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2962
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2963
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2964
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2965
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2966
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2967
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2968
    "Created: 19.4.1996 / 10:26:38 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2969
    "Modified: 19.4.1996 / 12:34:26 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2970
    "Modified: 14.10.1996 / 22:28:27 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2971
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2972
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2973
removeInterest:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2974
    "remove an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2975
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2976
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2977
    self removeNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2978
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2979
    "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
  2980
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2981
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2982
retractInterestIn:aspect for:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2983
    "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
  2984
     (as installed with #expressInterestIn:for:sendBack:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2985
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2986
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2987
    "/ 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
  2988
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2989
    |deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2990
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2991
    deps := self interests.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2992
    deps notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2993
	deps do:[:dep |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2994
	    (dep isMemberOf:InterestConverter) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2995
		dep destination == someOne ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2996
		    dep aspect == aspect ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2997
			self removeInterest:dep.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2998
			^ self
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2999
		    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3000
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3001
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3002
	]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3003
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3004
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3005
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3006
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3007
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3008
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3009
     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
  3010
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3011
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3012
     Transcript showCR:'interest in #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3013
     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
  3014
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3015
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3016
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3017
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3018
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3019
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3020
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3021
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3022
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3023
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3024
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3025
     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
  3026
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3027
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3028
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3029
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3030
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3031
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3032
     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
  3033
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3034
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3035
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3036
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3037
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3038
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3039
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3040
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3041
     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
  3042
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3043
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3044
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3045
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3046
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3047
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3048
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3049
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3050
     Transcript showCR:'no more interests'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3051
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3052
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3053
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3054
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3055
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3056
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3057
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3058
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3059
    "Created: 19.4.1996 / 10:27:11 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3060
    "Modified: 19.4.1996 / 12:29:52 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3061
    "Modified: 14.10.1996 / 22:21:19 / stefan"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3062
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3063
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3064
retractInterestsFor:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3065
    "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
  3066
     (as installed with #onChangeSend:to:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3067
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3068
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3069
    "/ 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
  3070
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3071
    |coll deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3072
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3073
    "/ 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
  3074
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3075
    coll := IdentitySet new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3076
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3077
    deps := self interests.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3078
    deps notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3079
	deps do:[:dep |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3080
	    (dep isMemberOf:InterestConverter) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3081
		dep destination == someOne ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3082
		    coll add:dep.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3083
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3084
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3085
	].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3086
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3087
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3088
    coll do:[:dep |
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3089
	self removeInterest:dep.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3090
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3091
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3092
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3093
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3094
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3095
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3096
     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
  3097
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3098
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3099
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3100
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3101
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3102
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3103
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3104
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3105
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3106
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3107
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3108
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3109
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3110
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3111
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3112
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3113
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3114
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3115
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3116
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3117
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3118
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3119
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3120
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3121
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3122
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3123
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3124
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3125
    "Created: 19.4.1996 / 10:23:46 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3126
    "Modified: 19.4.1996 / 12:30:03 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3127
    "Modified: 14.10.1996 / 22:21:25 / stefan"
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3128
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3129
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3130
!Object methodsFor:'interrupt handling'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3131
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3132
childSignalInterrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3133
    "death of a child process (unix process) - do nothing"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3134
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3135
    ^ self
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3138
customInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3139
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3140
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3141
    "a custom interrupt"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3142
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3143
    ^ self error:'custom interrupt'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3144
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3145
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3146
errorInterrupt:errorID with:aParameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3147
    "subsystem error. The arguments errorID and aParameter are the values passed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3148
     to the 'errorInterruptWithIDAndParameter(id, param)' function, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3149
     which can be called from C subsystems to raise an (asynchronous)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3150
     error exception.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3151
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3152
     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
  3153
     used from other C subsystems too, to upcast errors.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3154
     Especially, for subsystems which call errorHandler functions asynchronously.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3155
     IDs (currently) used:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3156
	#DisplayError ..... x-error interrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3157
	#XtError      ..... xt-error interrupt (Xt interface is not yet published)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3158
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3159
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3160
    |handler|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3161
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3162
    handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3163
    handler notNil ifTrue:[
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
	"/ handler found; let it do whatever it wants ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3166
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3167
	handler errorInterrupt:errorID with:aParameter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3168
	^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3169
    ].
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
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3172
    "/ no handler - raise errorSignal passing the errorId as parameter
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
    ^ ErrorSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3175
	raiseRequestWith:errorID 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3176
	errorString:('Subsystem error. ErrorID = ' , errorID printString)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3177
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3178
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3179
exceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3180
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3181
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3182
    "exception interrupt - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3183
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3184
    self error:'exception Interrupt'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3185
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3186
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3187
fpExceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3188
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3189
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3190
    "a floating point exception occured - this one
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3191
     has to be handled differently since it comes asynchronous
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3192
     on some machines (for example, on machines with a separate FPU
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3193
     or superscalar architectures. Also, errors from within primitive code
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3194
     (or library functions such as GL) are sent via the Unix-signal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3195
     mechanism this way."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3196
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3197
    ^ Float domainErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3198
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3199
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3200
internalError:msg
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3201
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3202
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3203
    "this is triggered, when VM hits some bad error,
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3204
     such as corrupted class, corrupted method/selector array
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3205
     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
  3206
     (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
  3207
     Its not guaranteed, that the system is in a working condition once
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3208
     this error occurred ...."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3209
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3210
    ^ InternalErrorSignal
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3211
	  raiseRequestWith:self
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3212
	  errorString:msg
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3213
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3214
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3215
ioInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3216
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3217
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3218
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3219
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3220
     or it does not understand the ioInterrupt message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3221
     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
  3222
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3223
    self error:'I/O Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3224
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3225
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3226
memoryInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3227
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3228
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3229
    "out-of-memory interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3230
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3231
    ^ self error:'almost out of memory'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3232
!
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
recursionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3235
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3236
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3237
    "recursion limit (actually: stack overflow) interrupt.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3238
     This interrupt is triggered, when a process stack grows above
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3239
     its stackLimit - usually, this leads into the debugger, but
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  3240
     could be caught and the stackLimit increased in the handler.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3241
     At the time we arrive here, the system has still some stack 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3242
     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
  3243
     debugging for a while.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3244
     If the signal is ignored, and the stack continues to grow, there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3245
     will be a few more chances (and more interrupts) before the VM
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3246
     hard-terminates the process."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3247
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3248
    thisContext isRecursive ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3249
	^ RecursionInterruptSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3250
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3251
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3252
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3253
schedulerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3254
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3255
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3256
    "scheduler interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3257
     If we arrive here, either the Processor does not understand it,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3258
     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
  3259
     big trouble. Enter debugger."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3260
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3261
    self error:'schedulerInterrupt - but no Processor'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3262
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3263
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3264
signalInterrupt:signalNumber
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3265
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3266
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3267
    "unix signal occured - some signals are handled as Smalltalk Exceptions 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3268
     (SIGPIPE), others (SIGBUS) are rather fatal ...
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3269
     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
  3270
     that one is raised.
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3271
     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
  3272
     signal.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3273
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3274
     exact cause etc.). This helps if segvs occur in primitive code.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3275
     Currently (temporary kludge), these are passed as global variables."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3276
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3277
    |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
  3278
     action title|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3279
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3280
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3281
     special case - since SIGPIPE has an ST-signal associated
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3282
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3283
    (signalNumber == 13) ifTrue:[
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3284
        "SIGPIPE - write on a pipe with no one to read"
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3285
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3286
        ^ PipeStream brokenPipeSignal raise.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3287
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3288
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3289
    "if there has been an ST-signal installed, use it ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3290
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3291
    sig := OperatingSystem operatingSystemSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3292
    sig notNil ifTrue:[
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3293
        ^ sig raise
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3294
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3295
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3296
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3297
     ... otherwise , bring up a box asking for what to do ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3298
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3299
    name := OperatingSystem nameForSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3300
    here := thisContext.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3301
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3302
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3303
     the context, in which the signal occurred:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3304
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3305
    badContext := here sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3306
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3307
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3308
     ungrab - in case it happened in a box/popupview
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3309
     otherwise display stays locked
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3310
    "
2851
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3311
"/    Display notNil ifTrue:[
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3312
"/        Display ungrabPointer.
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3313
"/        Display ungrabKeyboard.
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3314
"/    ].
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3315
    Screen notNil ifTrue:[
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3316
        Screen allScreens do:[:aScreen |
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3317
            aScreen ungrabPointer.
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3318
            aScreen ungrabKeyboard.
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3319
        ]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3320
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3321
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3322
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3323
     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
  3324
     since the system will retry the faulty instruction, which leads to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3325
     another signal - to avoid frustration, better not offer this option.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3326
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3327
    ignorable := (signalNumber ~~ OperatingSystem sigBUS)
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3328
                  and:[signalNumber ~~ OperatingSystem sigILL
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3329
                  and:[signalNumber ~~ OperatingSystem sigSEGV]].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3330
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3331
    ignorable ifFalse:[
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3332
        here isRecursive ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3333
            'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3334
            MiniDebugger enterWithMessage:'recursive signal'.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3335
            ^ self
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3336
        ].
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3337
        "
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3338
         a hard signal - go into debugger immediately
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3339
        "
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3340
        msg := 'OS-signal: ', name.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3341
        InterruptPcLow notNil ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3342
            pc := InterruptPcLow + (InterruptPcHi bitShift:16).
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3343
            pc ~~ 0 ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3344
                msg := msg , ' PC=' , (pc printStringRadix:16)
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3345
            ].
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3346
        ].
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3347
        InterruptAddrLow notNil ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3348
            addr := InterruptAddrLow + (InterruptAddrHi bitShift:16).
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3349
            addr ~~ 0 ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3350
                msg := msg , ' ADDR=' , (addr printStringRadix:16)
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3351
            ].
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3352
        ].
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3353
        Debugger enter:here withMessage:msg. 
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3354
        badContext return.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3355
        ^ nil.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3356
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3357
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3358
    OptionBox isNil ifTrue:[
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3359
        "
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3360
         a system without GUI ...
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3361
         go into minidebugger (if there is one)
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3362
        "
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3363
        MiniDebugger isNil ifTrue:[
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3364
            "
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3365
             a system without debugging facilities
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3366
             (i.e. a standalone system)
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3367
             output a message and exit.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3368
            "
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3369
            ('Object [error]: exit due to Signal ' , name , ' - and no debugger.') errorPrintCR.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3370
            Smalltalk exit.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3371
        ].
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3372
        MiniDebugger enterWithMessage:'Signal caught (' , name, ')'.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3373
        ^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3374
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3375
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3376
    titles := #('dump core' 'exit ST/X').
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3377
    actions := Array 
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3378
                 with:[Smalltalk fatalAbort]
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3379
                 with:[Smalltalk exit].
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3380
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3381
    action := nil.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3382
    title := 'OS Signal caught (' , name, ')'.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3383
    title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3384
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3385
    "/ if cought while in the scheduler or event dispatcher,
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3386
    "/ a modal dialog is not possible ...
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3387
    "/ (therefore, debug & return make no sense)
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3388
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3389
    Processor activeProcess isSystemProcess ifFalse:[
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3390
        titles := #('abort' 'debug') , titles.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3391
        actions := (Array
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3392
                        with:[action := #abort]
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3393
                        with:[action := #debug]) , actions.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3394
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3395
        badContext canReturn ifTrue:[
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3396
            titles := #('return') , titles.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3397
            actions := (Array with:[action := #return]) , actions.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3398
        ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3399
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3400
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3401
    ignorable ifTrue:[
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3402
        titles := titles, #('ignore').
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3403
        actions := actions , (Array with:[action := #ignore]).
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3404
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3405
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3406
    box := OptionBox 
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3407
                title:title
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3408
                numberOfOptions:actions size.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3409
    ignorable ifTrue:[
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3410
        box defaultButtonIndex:(actions size)
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3411
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3412
    box buttonTitles:titles.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3413
    box actions:actions.
2773
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3414
    box showAtPointer.
c9459bd8400d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  3415
2774
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3416
    action == #return ifTrue:[
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3417
        badContext return
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3418
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3419
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3420
    action == #abort ifTrue:[
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3421
        AbortSignal raise.
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3422
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3423
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3424
    action == #debug ifTrue:[
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3425
        Debugger enter:here withMessage:('Signal ', name). 
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3426
    ].
5a7467b9a531 better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents: 2773
diff changeset
  3427
2851
856557e261a3 ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents: 2829
diff changeset
  3428
    "Modified: 11.8.1997 / 16:04:26 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3429
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3430
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3431
spyInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3432
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3433
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3434
    "spy interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3435
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3436
    self error:'spy Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3437
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3438
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3439
timerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3440
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3441
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3442
    "timer interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3443
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3444
    self error:'timer Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3445
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3446
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3447
userInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3448
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3449
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3450
    "user (^c) interrupt.
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3451
     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
  3452
     controlling tty (i.e. in the xterm)."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3453
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3454
    UserInterruptSignal raise
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3455
!
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3456
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3457
userInterruptIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3458
    "{ Pragma: +optSpace }"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3459
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3460
    "user (^c) interrupt - enter debugger, but show aContext
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3461
     as top-context. 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3462
     This is used to hide any intermediate scheduler contexts, 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3463
     in case of an interrupted process. Typically, this is sent by
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3464
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3465
     processed."
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3466
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3467
    UserInterruptSignal raiseIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3468
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3469
    "Created: 18.10.1996 / 20:46:04 / cg"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3470
    "Modified: 20.10.1996 / 13:06:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3471
! !
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3472
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3473
!Object methodsFor:'message sending'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3474
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3475
perform:aSelector
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3476
    "send the message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3477
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3478
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3479
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3480
    static struct inlineCache ilc_0 = __ILCPERF0(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3481
    static struct inlineCache ilc_1 = __ILCPERF0(0);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3482
    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
  3483
    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
  3484
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3485
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3486
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3487
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3488
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3489
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3490
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3491
		last_0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3492
	    } else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3493
		pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3494
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3495
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3496
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3497
	    pIlc->ilc_func = __SEND0ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3498
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3499
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3500
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3501
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3502
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3503
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3504
	}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3505
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3506
	pIlc = &ilc_0;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3507
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3508
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3509
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3510
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3511
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3512
perform:aSelector inClass:aClass withArguments:argArray
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3513
    "send the message aSelector with all args taken from argArray 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3514
     to the receiver as a super-send message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3515
     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
  3516
     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
  3517
     immediate superclass).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3518
     Thus, it is (theoretically) possible to do 
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3519
         '5 perform:#< inClass:Magnitude withArguments:#(6)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3520
     and evaluate Magnitudes compare method even if there was one in Number.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3521
     This method is used by the interpreter to evaluate super sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3522
     and could be used for very special behavior (language extension ?).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3523
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3524
     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
  3525
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3526
    |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
  3527
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3528
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3529
     check, if aClass is really a superclass of the receiver
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3530
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3531
    (self class isSubclassOf:aClass) ifFalse:[
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3532
        self error:'class argument is not a superclass of the receiver'.
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3533
        ^ nil
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3534
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3535
%{
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3536
    REGISTER OBJ *argP;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3537
    int nargs, i;
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3538
    static struct inlineCache ilcSize = __ILC0(0);
1818
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3539
    static struct inlineCache ilc0 = _DUMMYILCSELF0;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3540
    static struct inlineCache ilc1 = _DUMMYILCSELF1;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3541
    static struct inlineCache ilc2 = _DUMMYILCSELF2;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3542
    static struct inlineCache ilc3 = _DUMMYILCSELF3;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3543
    static struct inlineCache ilc4 = _DUMMYILCSELF4;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3544
    static struct inlineCache ilc5 = _DUMMYILCSELF5;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3545
    static struct inlineCache ilc6 = _DUMMYILCSELF6;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3546
    static struct inlineCache ilc7 = _DUMMYILCSELF7;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3547
    static struct inlineCache ilc8 = _DUMMYILCSELF8;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3548
    static struct inlineCache ilc9 = _DUMMYILCSELF9;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3549
    static struct inlineCache ilc10 = _DUMMYILCSELF10;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3550
    static struct inlineCache ilc11 = _DUMMYILCSELF11;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3551
    static struct inlineCache ilc12 = _DUMMYILCSELF12;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3552
    static struct inlineCache ilc13 = _DUMMYILCSELF13;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3553
    static struct inlineCache ilc14 = _DUMMYILCSELF14;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3554
    static struct inlineCache ilc15 = _DUMMYILCSELF15;
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3555
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3556
    if (__isArray(argArray)) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3557
        nargs = __arraySize(argArray);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3558
        argP = __ArrayInstPtr(argArray)->a_element;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3559
    } else {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3560
        if (__isNonNilObject(argArray)) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3561
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3562
            if (!__isSmallInteger(numberOfArgs)) 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3563
                goto bad;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3564
            nargs = __intVal(numberOfArgs);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3565
            argP = (OBJ *)(&a1);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3566
            for (i=1; i <= nargs; i++) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3567
                *argP++ = __AT_(argArray, __MKSMALLINT(i));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3568
            }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3569
            argP = (OBJ *)(&a1);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3570
        } else {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3571
            nargs = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3572
        }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3573
    }
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3574
    switch (nargs) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3575
        case 0:
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3576
            RETURN (_SEND0(self, aSelector, aClass, &ilc0));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3577
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3578
        case 1: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3579
            RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3580
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3581
        case 2: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3582
            RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3583
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3584
        case 3: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3585
            RETURN ( _SEND3(self, aSelector, aClass, &ilc3, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3586
                             argP[0], argP[1], argP[2]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3587
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3588
        case 4: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3589
            RETURN ( _SEND4(self, aSelector, aClass, &ilc4,
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3590
                             argP[0], argP[1], argP[2], argP[3]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3591
        case 5: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3592
            RETURN ( _SEND5(self, aSelector, aClass, &ilc5, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3593
                             argP[0], argP[1], argP[2], argP[3], argP[4]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3594
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3595
        case 6: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3596
            RETURN ( _SEND6(self, aSelector, aClass, &ilc6, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3597
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3598
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3599
        case 7: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3600
            RETURN ( _SEND7(self, aSelector, aClass, &ilc7, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3601
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3602
                             argP[6]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3603
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3604
        case 8: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3605
            RETURN ( _SEND8(self, aSelector, aClass, &ilc8, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3606
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3607
                             argP[6], argP[7]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3608
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3609
        case 9: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3610
            RETURN ( _SEND9(self, aSelector, aClass, &ilc9, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3611
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3612
                             argP[6], argP[7], argP[8]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3613
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3614
        case 10: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3615
            RETURN ( _SEND10(self, aSelector, aClass, &ilc10, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3616
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3617
                             argP[6], argP[7], argP[8], argP[9]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3618
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3619
        case 11: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3620
            RETURN ( _SEND11(self, aSelector, aClass, &ilc11, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3621
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3622
                             argP[6], argP[7], argP[8], argP[9], argP[10]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3623
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3624
        case 12: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3625
            RETURN ( _SEND12(self, aSelector, aClass, &ilc12, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3626
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3627
                             argP[6], argP[7], argP[8], argP[9], argP[10], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3628
                             argP[11]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3629
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3630
        case 13: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3631
            RETURN ( _SEND13(self, aSelector, aClass, &ilc13, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3632
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3633
                             argP[6], argP[7], argP[8], argP[9], argP[10], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3634
                             argP[11], argP[12]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3635
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3636
        case 14: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3637
            RETURN ( _SEND14(self, aSelector, aClass, &ilc14, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3638
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3639
                             argP[6], argP[7], argP[8], argP[9], argP[10], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3640
                             argP[11], argP[12], argP[13]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3641
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3642
        case 15: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3643
            RETURN ( _SEND15(self, aSelector, aClass, &ilc15, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3644
                             argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3645
                             argP[6], argP[7], argP[8], argP[9], argP[10], 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3646
                             argP[11], argP[12], argP[13], argP[14]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3647
    }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3648
bad:;
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3649
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3650
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3651
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3652
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3653
    ^ self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3654
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3655
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3656
perform:aSelector with:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3657
    "send the one-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3658
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3659
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3660
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3661
    static struct inlineCache ilc_0 = __ILCPERF1(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3662
    static struct inlineCache ilc_1 = __ILCPERF1(0);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3663
    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
  3664
    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
  3665
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3666
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3667
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3668
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3669
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3670
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3671
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3672
		last_0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3673
	    } else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3674
		pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3675
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3676
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3677
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3678
	    pIlc->ilc_func = __SEND1ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3679
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3680
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3681
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3682
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3683
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3684
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3685
	}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3686
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3687
	pIlc = &ilc_0;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3688
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3689
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, anObject) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3690
%}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3691
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3692
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3693
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3694
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
  3695
    "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
  3696
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3697
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3698
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3699
    static struct inlineCache ilc_0 = __ILCPERF2(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3700
    static struct inlineCache ilc_1 = __ILCPERF2(0);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3701
    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
  3702
    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
  3703
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3704
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3705
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3706
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3707
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3708
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3709
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3710
		last_0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3711
	    } else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3712
		pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3713
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3714
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3715
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3716
	    pIlc->ilc_func = __SEND2ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3717
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3718
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3719
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3720
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3721
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3722
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3723
	}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3724
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3725
	pIlc = &ilc_0;
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3726
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3727
    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
  3728
%}
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3729
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3730
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3731
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3732
perform:aSelector with:arg1 with:arg2 with:arg3
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3733
    "send the three-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3734
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3735
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3736
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3737
    static struct inlineCache ilc_0 = __ILCPERF3(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3738
    static struct inlineCache ilc_1 = __ILCPERF3(0);
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3739
    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
  3740
    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
  3741
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3742
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3743
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3744
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3745
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3746
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3747
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3748
		last_0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3749
	    } else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3750
		pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3751
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3752
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3753
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3754
	    pIlc->ilc_func = __SEND3ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3755
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3756
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3757
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3758
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3759
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3760
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3761
	}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3762
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3763
	pIlc = &ilc_0;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3764
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3765
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2, arg3) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3766
%}
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3767
!
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3768
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3769
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
  3770
    "send the four-arg-message aSelector to the receiver"
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3771
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3772
%{
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3773
    struct inlineCache *pIlc;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3774
    static struct inlineCache ilc_0 = __ILCPERF4(0);
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3775
    static struct inlineCache ilc_1 = __ILCPERF4(0);
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3776
    static OBJ last_0 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3777
    static OBJ last_1 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3778
    static flip = 0;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3779
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3780
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3781
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3782
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3783
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3784
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3785
		last_0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3786
	    } else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3787
		pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3788
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3789
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3790
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3791
	    pIlc->ilc_func = __SEND4ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3792
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3793
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3794
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3795
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3796
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3797
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3798
	}
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3799
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3800
	pIlc = &ilc_0;
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3801
    }
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3802
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2, arg3, arg4) );
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3803
%}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3804
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3805
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3806
perform:aSelector withArguments:argArray
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3807
    "send the message aSelector with all args taken from argArray 
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3808
     to the receiver."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3809
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  3810
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3811
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3812
%{
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3813
    REGISTER OBJ *argP;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3814
    int nargs, i;
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3815
    static struct inlineCache ilcSize = __ILC0(0);
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3816
    static OBJ last0 = nil; static struct inlineCache ilc0 = __ILCPERF0(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3817
    static OBJ last1 = nil; static struct inlineCache ilc1 = __ILCPERF1(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3818
    static OBJ last2 = nil; static struct inlineCache ilc2 = __ILCPERF2(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3819
    static OBJ last3 = nil; static struct inlineCache ilc3 = __ILCPERF3(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3820
    static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3821
    static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3822
    static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3823
    static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3824
    static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3825
    static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3826
    static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3827
    static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3828
    static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3829
    static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3830
    static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3831
    static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(0);
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3832
    OBJ l;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3833
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3834
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3835
    /*
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  3836
     * must set lineno in sender by hand here ... (because of NOCONTEXT)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3837
     */
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3838
    if ((l = __ILC_LNO_AS_OBJ(__pilc)) != __MKSMALLINT(0)) {
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3839
        _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
  3840
    }
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3841
#endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3842
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3843
    if (__isArray(argArray)) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3844
        nargs = __arraySize(argArray);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3845
        argP = __ArrayInstPtr(argArray)->a_element;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3846
    } else {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3847
        if (__isNonNilObject(argArray)) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3848
            numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3849
            if (!__isSmallInteger(numberOfArgs)) 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3850
                goto bad;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3851
            nargs = __intVal(numberOfArgs);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3852
            argP = (OBJ *)(&a1);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3853
            for (i=1; i <= nargs; i++) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3854
                *argP++ = __AT_(argArray, __MKSMALLINT(i));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3855
            }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3856
            argP = (OBJ *)(&a1);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3857
        } else {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3858
            nargs = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3859
        }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3860
    }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3861
    switch (nargs) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3862
        case 0:
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3863
            if (aSelector != last0) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3864
                ilc0.ilc_func = __SEND0ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3865
                if (ilc0.ilc_poly) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3866
                    __flushPolyCache(ilc0.ilc_poly);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3867
                    ilc0.ilc_poly = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3868
                }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3869
                last0 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3870
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3871
#ifdef xxTHIS_CONTEXT  /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3872
            ilc0.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3873
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3874
            RETURN ((*ilc0.ilc_func)(self, aSelector, nil, &ilc0));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3875
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3876
        case 1: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3877
            if (aSelector != last1) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3878
                ilc1.ilc_func = __SEND1ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3879
                if (ilc1.ilc_poly) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3880
                    __flushPolyCache(ilc1.ilc_poly);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3881
                    ilc1.ilc_poly = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3882
                }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3883
                last1 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3884
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3885
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3886
            ilc1.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3887
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3888
            RETURN ( (*ilc1.ilc_func)(self, aSelector, nil, &ilc1, argP[0]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3889
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3890
        case 2: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3891
            if (aSelector != last2) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3892
                ilc2.ilc_func = __SEND2ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3893
                if (ilc2.ilc_poly) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3894
                    __flushPolyCache(ilc2.ilc_poly);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3895
                    ilc2.ilc_poly = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3896
                }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3897
                last2 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3898
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3899
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3900
            ilc2.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3901
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3902
            RETURN ( (*ilc2.ilc_func)(self, aSelector, nil, &ilc2, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3903
                                            argP[0], argP[1]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3904
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3905
        case 3: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3906
            if (aSelector != last3) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3907
                ilc3.ilc_func = __SEND3ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3908
                if (ilc3.ilc_poly) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3909
                    __flushPolyCache(ilc3.ilc_poly);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3910
                    ilc3.ilc_poly = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3911
                }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3912
                last3 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3913
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3914
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3915
            ilc3.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3916
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3917
            RETURN ( (*ilc3.ilc_func)(self, aSelector, nil, &ilc3, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3918
                                            argP[0], argP[1], argP[2]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3919
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3920
        case 4: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3921
            if (aSelector != last4) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3922
                ilc4.ilc_func = __SEND4ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3923
                if (ilc4.ilc_poly) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3924
                    __flushPolyCache(ilc4.ilc_poly);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3925
                    ilc4.ilc_poly = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3926
                }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3927
                last4 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3928
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3929
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3930
            ilc4.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3931
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3932
            RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3933
                                            argP[0], argP[1], argP[2], argP[3]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3934
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3935
        case 5: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3936
            if (aSelector != last5) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3937
                ilc5.ilc_func = __SEND5ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3938
                if (ilc5.ilc_poly) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3939
                    __flushPolyCache(ilc5.ilc_poly);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3940
                    ilc5.ilc_poly = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3941
                }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3942
                last5 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3943
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3944
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3945
            ilc5.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3946
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3947
            RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3948
                                            argP[0], argP[1], argP[2], argP[3], argP[4]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3949
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3950
        case 6: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3951
            if (aSelector != last6) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3952
                ilc6.ilc_func = __SEND6ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3953
                if (ilc6.ilc_poly) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3954
                    __flushPolyCache(ilc6.ilc_poly);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3955
                    ilc6.ilc_poly = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3956
                }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3957
                last6 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3958
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3959
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3960
            ilc6.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3961
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3962
            RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3963
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3964
                                            argP[5]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3965
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3966
        case 7: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3967
            if (aSelector != last7) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3968
                ilc7.ilc_func = __SEND7ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3969
                if (ilc7.ilc_poly) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3970
                    __flushPolyCache(ilc7.ilc_poly);
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3971
                    ilc7.ilc_poly = 0;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3972
                }
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3973
                last7 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3974
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3975
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3976
            ilc7.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3977
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3978
            RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3979
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3980
                                            argP[5], argP[6]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3981
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3982
        case 8:
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3983
            if (aSelector != last8) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3984
                ilc8.ilc_func = __SEND8ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3985
                last8 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3986
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3987
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3988
            ilc8.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3989
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3990
            RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3991
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3992
                                            argP[5], argP[6], argP[7]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3993
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3994
        case 9: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3995
            if (aSelector != last9) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3996
                ilc9.ilc_func = __SEND9ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3997
                last9 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  3998
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3999
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4000
            ilc9.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4001
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4002
            RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4003
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4004
                                            argP[5], argP[6], argP[7], argP[8]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4005
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4006
        case 10: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4007
            if (aSelector != last10) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4008
                ilc10.ilc_func = __SEND10ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4009
                last10 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4010
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4011
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4012
            ilc10.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4013
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4014
            RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4015
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4016
                                            argP[5], argP[6], argP[7], argP[8], argP[9]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4017
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4018
        case 11: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4019
            if (aSelector != last11) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4020
                ilc11.ilc_func = __SEND11ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4021
                last11 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4022
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4023
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4024
            ilc11.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4025
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4026
            RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4027
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4028
                                            argP[5], argP[6], argP[7], argP[8], argP[9],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4029
                                            argP[10]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4030
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4031
        case 12: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4032
            if (aSelector != last12) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4033
                ilc12.ilc_func = __SEND12ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4034
                last12 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4035
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4036
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4037
            ilc12.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4038
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4039
            RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4040
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4041
                                            argP[5], argP[6], argP[7], argP[8], argP[9],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4042
                                            argP[10], argP[11]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4043
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4044
        case 13: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4045
            if (aSelector != last13) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4046
                ilc13.ilc_func = __SEND13ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4047
                last13 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4048
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4049
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4050
            ilc13.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4051
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4052
            RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4053
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4054
                                            argP[5], argP[6], argP[7], argP[8], argP[9],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4055
                                            argP[10], argP[11], argP[12]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4056
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4057
        case 14: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4058
            if (aSelector != last14) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4059
                ilc14.ilc_func = __SEND14ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4060
                last14 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4061
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4062
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4063
            ilc14.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4064
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4065
            RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4066
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4067
                                            argP[5], argP[6], argP[7], argP[8], argP[9],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4068
                                            argP[10], argP[11], argP[12], argP[13]));
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4069
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4070
        case 15: 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4071
            if (aSelector != last15) {
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4072
                ilc15.ilc_func = __SEND15ADDR__;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4073
                last15 = aSelector;
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4074
            }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4075
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4076
            ilc15.ilc_lineNo = __pilc->ilc_lineNo;
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  4077
#endif
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4078
            RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, 
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4079
                                            argP[0], argP[1], argP[2], argP[3], argP[4],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4080
                                            argP[5], argP[6], argP[7], argP[8], argP[9],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4081
                                            argP[10], argP[11], argP[12], argP[13],
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4082
                                            argP[14]));
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4083
    }
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  4084
bad:;
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4085
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4086
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4087
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4088
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4089
    ^ self primitiveFailed
2819
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4090
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4091
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4092
performMethod:aMethod
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4093
    "invoke aMethod on the receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4094
     The method should be a zero-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4095
     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
  4096
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4097
     Warning:
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4098
         Take care for the method to be appropriate for the
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4099
         receiver - no checking is done by the VM."
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4100
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4101
    ^ aMethod valueWithReceiver:self arguments:#()
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4102
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4103
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4104
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4105
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4106
     mthd := SmallInteger compiledMethodAt:#negated.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4107
     Transcript showCR:(1 performMethod:mthd)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4108
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4109
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4110
    "BAD USE example:
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4111
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4112
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4113
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4114
     mthd := Point compiledMethodAt:#x.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4115
     Transcript showCR:((1->2) performMethod:mthd)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4116
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4117
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4118
    "Modified: 31.7.1997 / 17:41:50 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4119
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4120
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4121
performMethod:aMethod arguments:argumentArray
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4122
    "invoke aMethod on the receiver, passing an argumentArray.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4123
     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
  4124
     expected by the method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4125
     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
  4126
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4127
     Warning:
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4128
         Take care for the method to be appropriate for the
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4129
         receiver - no checking is done by the VM."
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4130
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4131
    ^ aMethod valueWithReceiver:self arguments:argumentArray
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4132
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4133
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4134
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4135
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4136
     mthd := SmallInteger compiledMethodAt:#+.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4137
     Transcript showCR:(1 performMethod:mthd arguments:#(2))
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4138
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4139
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4140
    "Created: 31.7.1997 / 17:46:31 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4141
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4142
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4143
performMethod:aMethod with:arg
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4144
    "invoke aMethod on the receiver, passing an argument.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4145
     The method should be a one-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4146
     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
  4147
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4148
     Warning:
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4149
         Take care for the method to be appropriate for the
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4150
         receiver - no checking is done by the VM."
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4151
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4152
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4153
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4154
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4155
     |mthd|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4156
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4157
     mthd := SmallInteger compiledMethodAt:#+.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4158
     Transcript showCR:(1 performMethod:mthd with:2)
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4159
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4160
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4161
    "Modified: 31.7.1997 / 17:42:32 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4162
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4163
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4164
performMethod:aMethod with:arg1 with:arg2
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4165
    "invoke aMethod on the receiver, passing two arguments.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4166
     The method should be a two-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4167
     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
  4168
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4169
     Warning:
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4170
         Take care for the method to be appropriate for the
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4171
         receiver - no checking is done by the VM."
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4172
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4173
    ^ 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
  4174
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4175
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4176
     |mthd arr|
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4177
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4178
     arr := Array new:1.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4179
     mthd := Array compiledMethodAt:#basicAt:put:.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4180
     arr performMethod:mthd with:1 with:'foo'.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4181
     Transcript showCR:arr
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4182
    "
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4183
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4184
    "Modified: 31.7.1997 / 17:44:54 / cg"
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4185
!
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4186
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4187
performMethod:aMethod with:arg1 with:arg2 with:arg3
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4188
    "invoke aMethod on the receiver, passing three arguments.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4189
     The method should be a three-argument method.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4190
     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
  4191
     in a functional way on a receiver.
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4192
     Warning:
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4193
         Take care for the method to be appropriate for the
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4194
         receiver - no checking is done by the VM."
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4195
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4196
    ^ 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
  4197
18316ec20169 added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents: 2818
diff changeset
  4198
    "Created: 31.7.1997 / 17:45:20 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4199
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4200
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4201
!Object methodsFor:'misc'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4202
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4203
-> anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4204
    "return an association with the receiver as key and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4205
     the argument as value"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4206
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4207
    ^ Association key:self value:anObject
2
claus
parents: 1
diff changeset
  4208
! !
claus
parents: 1
diff changeset
  4209
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4210
!Object methodsFor:'printing & storing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4211
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4212
className
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4213
    "return the classname of the receivers class"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4214
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4215
    ^ self class name
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4216
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4217
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4218
     1 className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4219
     1 class className   'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4220
     $a className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4221
     $a class className  'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4222
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4223
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4224
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4225
classNameWithArticle
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4226
    "return a string consisting of classname preceeded by an article.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4227
     (dont expect me to write national variants for this ... :-)
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4228
     If you have special preferences, redefine it ..."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4229
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4230
    |classname cls|
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4231
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4232
    (cls := self class) == self ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4233
	^ 'a funny object'
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4234
    ].
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4235
    classname := cls displayString.
85
claus
parents: 77
diff changeset
  4236
    ^ classname article , ' ' , classname
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4237
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4238
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4239
     1 classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4240
     (1->2) classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4241
     XWorkstation basicNew classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4242
    "
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4243
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4244
    "Modified: 13.5.1996 / 12:16:14 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4245
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4246
1445
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4247
displayOn:aGc
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4248
    "ST-80 Compatibility
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4249
     display the receiver in a graphicsContext at 0@0
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4250
     - this method allows for any object to be displayed in some view
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4251
     (although the fallBack is to display its printString ...)"
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4252
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4253
    ^ self displayOn:aGc x:0 y:0.
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4254
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4255
    "Created: 29.5.1996 / 16:28:58 / cg"
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4256
!
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4257
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4258
displayOn:aGc at:aPoint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4259
    "ST-80 Compatibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4260
     display the receiver in a graphicsContext - this method allows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4261
     for any object to be displayed in a ListView - for example."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4262
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4263
    ^ self displayOn:aGc x:(aPoint x) y:(aPoint y).
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4264
!
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4265
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4266
displayOn:aGc x:x y:y
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4267
    "display the receiver in a graphicsContext - this method allows
1445
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4268
     for any object to be displayed in a ListView - for example.
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4269
     The fallBack here shows the receivers printString."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4270
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4271
    ^ aGc displayString:(self displayString) x:x y:y.
1445
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4272
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4273
    "Modified: 29.5.1996 / 16:29:38 / cg"
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4274
!
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4275
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4276
displayString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4277
    "return a string used when displaying the receiver in a view;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4278
     for example an Inspector. This is usually the same as printString,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4279
     but sometimes redefined for a better look."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4280
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4281
    ^ self printString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4282
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4283
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4284
     #(1 2 3) printString    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4285
     #(1 2 3) displayString  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4286
     #(1 2 3) storeString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4287
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4288
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4289
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4290
errorPrint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4291
    "print the receiver on the standard error stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4292
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4293
    Stream streamErrorSignal catch:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4294
	self printOn:Stderr
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4295
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4296
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4297
    "Modified: 7.3.1996 / 19:11:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4298
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4299
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4300
errorPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4301
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4302
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4303
    "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
  4304
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4305
    Stream streamErrorSignal catch:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4306
	self printOn:Stderr.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4307
	Stderr cr
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4308
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4309
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4310
    "Modified: 7.3.1996 / 19:13:01 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4311
    "Created: 20.5.1996 / 10:20:41 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4312
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4313
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4314
errorPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4315
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4316
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4317
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4318
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4319
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4320
    ^ self errorPrintCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4321
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4322
    "Modified: 20.5.1996 / 10:24:45 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4323
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4324
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4325
errorPrintNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4326
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4327
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4328
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4329
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4330
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4331
    self errorPrintCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4332
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4333
    "Modified: 20.5.1996 / 10:24:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4334
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4335
356
claus
parents: 348
diff changeset
  4336
infoPrint
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4337
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4338
356
claus
parents: 348
diff changeset
  4339
    "print the receiver on the standard error stream.
claus
parents: 348
diff changeset
  4340
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  4341
     or fatal messages.
claus
parents: 348
diff changeset
  4342
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  4343
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4344
    InfoPrinting == true ifTrue:[
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4345
	self errorPrint
356
claus
parents: 348
diff changeset
  4346
    ]
claus
parents: 348
diff changeset
  4347
!
claus
parents: 348
diff changeset
  4348
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4349
infoPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4350
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4351
356
claus
parents: 348
diff changeset
  4352
    "print the receiver followed by a cr on the standard error stream.
claus
parents: 348
diff changeset
  4353
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  4354
     or fatal messages.
claus
parents: 348
diff changeset
  4355
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  4356
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4357
    InfoPrinting == true ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4358
	self errorPrintCR
356
claus
parents: 348
diff changeset
  4359
    ]
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4360
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4361
    "Created: 20.5.1996 / 10:21:28 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4362
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4363
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4364
infoPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4365
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4366
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4367
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4368
     This is meant for information messages which are not warnings
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4369
     or fatal messages.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4370
     These messages can be turned on/off by 'Object infoPrinting:true/false'.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4371
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4372
     Please use #infoPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4373
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4374
    ^ self infoPrintCR
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4375
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4376
    "Modified: 20.5.1996 / 10:25:07 / cg"
356
claus
parents: 348
diff changeset
  4377
!
claus
parents: 348
diff changeset
  4378
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4379
print
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4380
    "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
  4381
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4382
    self printOn:Stdout
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4383
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4384
    "Modified: 4.11.1996 / 23:36:58 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4385
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4386
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4387
printCR
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4388
    "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
  4389
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4390
    self printOn:Stdout.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4391
    Stdout cr
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4392
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4393
    "Created: 20.5.1996 / 10:21:37 / cg"
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4394
    "Modified: 4.11.1996 / 23:37:06 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4395
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4396
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4397
printNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4398
    "print the receiver followed by a cr on the standard output stream
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4399
     This exists for GNU Smalltalk compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4400
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4401
    ^ self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4402
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4403
    "Modified: 20.5.1996 / 10:25:31 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4404
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4405
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4406
printNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4407
    "print the receiver followed by a cr on the standard output stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4408
     This exists for backward compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4409
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4410
    self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4411
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4412
    "Modified: 20.5.1996 / 10:25:46 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4413
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4414
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4415
printOn:aStream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4416
    "print the receiver on the argument-stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4417
     The default here is to output the receivers class name.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4418
     BUT: this method is heavily redefined for objects which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4419
     can print prettier."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4420
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4421
    aStream nextPutAll:self classNameWithArticle
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4422
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4423
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4424
printOn:aStream leftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4425
    "print the receiver on aStream, padding with spaces up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4426
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4427
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4428
    self printOn:aStream leftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4429
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4430
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4431
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4432
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4433
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4434
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4435
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4436
printOn:aStream leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4437
    "print the receiver on aStream, padding with padCharacters up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4438
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4439
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4440
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4441
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4442
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4443
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4444
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4445
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4446
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4447
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4448
printOn:aStream paddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4449
    "print the receiver on aStream, padding with spaces up to size."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4450
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4451
    self printOn:aStream paddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4452
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4453
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4454
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4455
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4456
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4457
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4458
printOn:aStream paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4459
    "print the receiver on aStream, padding with padCharacter up to size"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4460
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4461
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4462
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4463
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4464
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4465
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4466
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4467
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4468
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4469
printOn:aStream zeroPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4470
    "print the receiver on aStream, padding with zeros up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4471
     Usually used with float numbers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4472
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4473
    self printOn:aStream paddedTo:size with:$0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4474
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4475
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4476
     123.0 printOn:Transcript zeroPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4477
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4478
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4479
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4480
printRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4481
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4482
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4483
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4484
    (self printStringLeftPaddedTo:size) printOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4485
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4486
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4487
printString
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4488
    "return a string for printing the receiver.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4489
     Since we now use printOn: as the basic print mechanism,
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4490
     we have to create a stream and print into it."
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4491
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4492
    |s|
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4493
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4494
    s := WriteStream on:(String new:30).
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4495
    self printOn:s.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4496
    ^ s contents
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4497
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4498
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4499
printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4500
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4501
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4502
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4503
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4504
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4505
    ^ self printStringLeftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4506
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4507
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4508
     10 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4509
     1 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4510
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4511
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4512
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4513
printStringLeftPaddedTo:size ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4514
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4515
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4516
     If the printString is larger than size,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4517
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4518
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4519
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4520
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4521
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4522
     12   printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4523
     123  printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4524
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4525
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4526
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4527
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4528
printStringLeftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4529
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4530
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4531
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4532
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4533
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4534
    ^ (self printString) leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4535
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4536
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4537
     123 printStringLeftPaddedTo:10 with:$.   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4538
     1 printStringLeftPaddedTo:10 with:$.      
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4539
     (Float pi) printStringLeftPaddedTo:20 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4540
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4541
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4542
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4543
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4544
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4545
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4546
     If the printString is larger than size,
369
claus
parents: 362
diff changeset
  4547
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  4548
claus
parents: 362
diff changeset
  4549
    |s|
claus
parents: 362
diff changeset
  4550
claus
parents: 362
diff changeset
  4551
    s := self printString.
claus
parents: 362
diff changeset
  4552
    s size > size ifTrue:[^ alternative value].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4553
    ^ s leftPaddedTo:size with:padCharacter
369
claus
parents: 362
diff changeset
  4554
claus
parents: 362
diff changeset
  4555
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4556
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4557
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4558
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4559
    "
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4560
!
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4561
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4562
printStringPaddedTo:size
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4563
    "return a printed representation of the receiver,
369
claus
parents: 362
diff changeset
  4564
     padded with spaces (at the right) up to size.
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4565
     If the printString is longer than size, 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4566
     it is returned unchanged (i.e. not truncated)"
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4567
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4568
    ^ self printStringPaddedTo:size with:(Character space)
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4569
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4570
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4571
     123 printStringPaddedTo:10    
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4572
     1234567890123456 printStringPaddedTo:10  
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4573
     'hello' printStringPaddedTo:10   
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4574
    "
2
claus
parents: 1
diff changeset
  4575
!
claus
parents: 1
diff changeset
  4576
369
claus
parents: 362
diff changeset
  4577
printStringPaddedTo:size ifLarger:alternative
claus
parents: 362
diff changeset
  4578
    "return a printed representation of the receiver,
claus
parents: 362
diff changeset
  4579
     padded with spaces (at the right) up to size.
claus
parents: 362
diff changeset
  4580
     If the resulting printString is too large, 
claus
parents: 362
diff changeset
  4581
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  4582
claus
parents: 362
diff changeset
  4583
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
claus
parents: 362
diff changeset
  4584
claus
parents: 362
diff changeset
  4585
    "
claus
parents: 362
diff changeset
  4586
     12   printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4587
     123  printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4588
     1234 printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4589
    "
claus
parents: 362
diff changeset
  4590
!
claus
parents: 362
diff changeset
  4591
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4592
printStringPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4593
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4594
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4595
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4596
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4597
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4598
    ^ (self printString) paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4599
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4600
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4601
     123  printStringPaddedTo:10 with:$.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4602
     123  printStringPaddedTo:10 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4603
     123  printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4604
     1234 printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4605
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4606
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4607
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4608
printStringPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4609
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4610
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4611
     If the resulting printString is too large, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4612
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4613
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4614
    |s|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4615
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4616
    s := self printString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4617
    s size > size ifTrue:[^ alternative value].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4618
    ^ s paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4619
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4620
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4621
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4622
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4623
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4624
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4625
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4626
printStringRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4627
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4628
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4629
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4630
    ^ self printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4631
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4632
2
claus
parents: 1
diff changeset
  4633
printStringZeroPaddedTo:size
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4634
    "return a printed representation of the receiver, 
369
claus
parents: 362
diff changeset
  4635
     padded with zero (at the right) characters up to size.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4636
     Usually used with float numbers."
2
claus
parents: 1
diff changeset
  4637
claus
parents: 1
diff changeset
  4638
    ^ self printStringPaddedTo:size with:$0
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4639
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4640
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4641
     123.0 printStringZeroPaddedTo:10 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4642
    "
2
claus
parents: 1
diff changeset
  4643
!
claus
parents: 1
diff changeset
  4644
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4645
store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4646
    "store the receiver on standard output.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4647
     this method is useless, but included for compatibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4648
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4649
    self storeOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4650
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4651
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4652
storeCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4653
    "store the receiver on standard output; append a carriage return."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4654
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4655
    self store.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4656
    Character cr print
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4657
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4658
    "Created: 20.5.1996 / 10:26:01 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4659
    "Modified: 20.5.1996 / 10:26:57 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4660
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4661
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4662
storeNl
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4663
    "store the receiver on standard output; append a newline.
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4664
     This method is included for backward compatibility-  use #storeCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4665
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4666
    self storeCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4667
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4668
    "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
  4669
!
7e058858cc3b New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents: 446
diff changeset
  4670
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4671
storeOn:aStream
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4672
    "store the receiver on aStream; i.e. print an expression which will
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4673
     reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4674
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4675
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4676
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4677
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4678
    |myClass hasSemi sz "{ Class: SmallInteger }" |
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4679
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  4680
    thisContext isRecursive ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4681
	('Object [error]: storeString of self referencing object.') errorPrintCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4682
	aStream nextPutAll:'#("recursive")'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4683
	^ self
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  4684
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4685
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4686
    myClass := self class.
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4687
    aStream nextPut:$(.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4688
    aStream nextPutAll:self class name.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4689
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4690
    hasSemi := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4691
    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4692
	aStream nextPutAll:' basicNew:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4693
	self basicSize printOn:aStream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4694
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4695
	aStream nextPutAll:' basicNew'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4696
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4697
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4698
    sz := myClass instSize.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4699
    1 to:sz do:[:i | 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4700
	aStream nextPutAll:' instVarAt:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4701
	i printOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4702
	aStream nextPutAll:' put:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4703
	(self instVarAt:i) storeOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4704
	aStream nextPut:$;.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4705
	hasSemi := true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4706
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4707
    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4708
	sz := self basicSize.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4709
	1 to:sz do:[:i | 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4710
	    aStream nextPutAll:' basicAt:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4711
	    i printOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4712
	    aStream nextPutAll:' put:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4713
	    (self basicAt:i) storeOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4714
	    aStream nextPut:$;.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4715
	    hasSemi := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4716
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4717
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4718
    hasSemi ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4719
	aStream nextPutAll:' yourself'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4720
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4721
    aStream nextPut:$).
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4722
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4723
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4724
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4725
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4726
     s := WriteStream on:(String new).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4727
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4728
     s := ReadStream on:(s contents).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4729
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4730
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4731
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4732
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4733
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4734
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4735
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4736
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4737
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4738
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4739
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4740
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4741
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4742
    "does not work example:"
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4743
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4744
     |s a|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4745
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4746
     a := Array new:2.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4747
     a at:1 put:a.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4748
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4749
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4750
     a storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4751
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4752
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4753
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4754
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4755
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4756
2287
3d5330d2b368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4757
    "Modified: 28.1.1997 / 00:36:12 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4758
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4759
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4760
storeString
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4761
    "return a string representing an expression to reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4762
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4763
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4764
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4765
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4766
    |s|
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4767
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4768
    s := WriteStream on:(String new:50).
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4769
    self storeOn:s.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4770
    ^ s contents
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4771
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4772
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4773
!Object methodsFor:'queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4774
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4775
basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4776
    "return the number of the receivers indexed instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4777
     0 if it has none.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4778
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4779
     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
  4780
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4781
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4782
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4783
    REGISTER int nbytes;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4784
    REGISTER OBJ myClass;
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4785
    REGISTER INT flags;
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4786
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4787
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4788
     * notice the missing test for self being a nonNilObject -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4789
     * this can be done since basicSize is defined both in UndefinedObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4790
     * and SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4791
     */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4792
    myClass = __qClass(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4793
    nbytes = __qSize(self) 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4794
	      - OHDR_SIZE 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4795
	      - __OBJS2BYTES__(__intVal(__ClassInstPtr(myClass)->c_ninstvars));
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4796
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4797
    flags = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK);
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4798
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4799
     * replaced switch by open-if; this is slightly faster since
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4800
     * it avoids the range check and also checks the most common case first
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4801
     */
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4802
    if (flags == __MASKSMALLINT(POINTERARRAY)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4803
	RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4804
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4805
    if (flags == __MASKSMALLINT(BYTEARRAY)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4806
	    RETURN ( __MKSMALLINT(nbytes / sizeof(char)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4807
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4808
    if (flags == __MASKSMALLINT(WKPOINTERARRAY)) {
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4809
	RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4810
    }
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4811
    if (flags == __MASKSMALLINT(FLOATARRAY)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4812
	RETURN ( __MKSMALLINT(nbytes / sizeof(float)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4813
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4814
    if (flags == __MASKSMALLINT(DOUBLEARRAY)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4815
#ifdef NEED_DOUBLE_ALIGN
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4816
	    /*
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4817
	     * care for filler
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4818
	     */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4819
	    nbytes -= sizeof(FILLTYPE);
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4820
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4821
	    RETURN ( __MKSMALLINT(nbytes / sizeof(double)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4822
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4823
    if ((flags == __MASKSMALLINT(WORDARRAY)) || (flags == __MASKSMALLINT(SWORDARRAY))) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4824
	RETURN ( __MKSMALLINT(nbytes / sizeof(short)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4825
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4826
    if ((flags == __MASKSMALLINT(LONGARRAY)) || (flags == __MASKSMALLINT(SLONGARRAY))) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4827
	RETURN ( __MKSMALLINT(nbytes / sizeof(long)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4828
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4829
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4830
    ^ 0
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4831
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4832
2575
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4833
byteSize
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4834
    "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
  4835
     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
  4836
     instvars i.e. byteArrays, wordArrays etc.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4837
     Notice: for Strings the returned size may look strange.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4838
     Only useful with binary storage."
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4839
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4840
%{  /* NOCONTEXT */
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4841
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4842
    REGISTER int indx;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4843
    int nIndex;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4844
    REGISTER OBJ slf;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4845
    REGISTER OBJ cls;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4846
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4847
    slf = self;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4848
    if (__isNonNilObject(slf)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4849
	cls = __qClass(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4850
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4851
	switch (__intVal(__ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4852
	    case BYTEARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4853
	    case WORDARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4854
	    case LONGARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4855
	    case SWORDARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4856
	    case SLONGARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4857
	    case FLOATARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4858
	    case DOUBLEARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4859
		    nIndex = __byteArraySize(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4860
		    nIndex -= __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4861
		    RETURN ( __MKSMALLINT(nIndex) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4862
	}
2575
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4863
    }
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4864
%}.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4865
    ^ 0
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4866
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4867
    "
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4868
     Point new byteSize   
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4869
     'hello' byteSize     
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4870
     (ByteArray with:1 with:2) byteSize 
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4871
     (FloatArray with:1.5) byteSize    
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4872
    "
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4873
!
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4874
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4875
class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4876
    "return the receivers class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4877
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4878
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4879
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4880
    RETURN ( __Class(self) );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4881
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4882
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4883
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4884
respondsTo:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4885
    "return true, if the receiver implements a method with selector equal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4886
     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
  4887
     receivers class or one of its superclasses.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4888
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4889
     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
  4890
     an error being raised. For example, an implementation could send
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4891
     #shouldNotImplement or #subclassResponsibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4892
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4893
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4894
     should we go via the cache, or search (by class) ?
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4895
     The first is faster, most of the time; while the 2nd fills
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4896
     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
  4897
     For now, use the cache ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4898
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4899
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4900
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
  4901
    if (__lookup(__Class(self), aSelector) == nil) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4902
	RETURN ( false );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4903
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4904
    RETURN ( true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4905
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4906
.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4907
"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4908
    ^ self class canUnderstand:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4909
"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4910
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4911
    "'aString' respondsTo:#+"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4912
    "'aString' respondsTo:#,"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4913
    "'aString' respondsTo:#collect:"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4914
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4915
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4916
respondsToArithmetic
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4917
    "return true, if the receiver responds to arithmetic messages.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4918
     false is returned here - the method is redefined in ArithmeticValue."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4919
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4920
    ^ false
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4923
size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4924
    "return the number of the receivers indexed instance variables;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4925
     this method may be redefined in subclasses"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4926
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4927
    ^ self basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4928
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4929
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4930
species
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4931
    "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
  4932
     This is used to create an appropriate object when creating derived
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4933
     copies in the collection classes (sometimes redefined)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4934
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4935
    ^ self class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4936
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4937
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4938
yourself
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4939
    "return the receiver - used for cascades to return self at the end"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4940
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4941
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4942
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4943
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4944
!Object methodsFor:'secure message sending'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4945
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4946
askFor:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4947
    "try to send the receiver the message, aSelector.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4948
     If it does not understand it, return false. Otherwise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4949
     the real value returned.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4950
     Useful to send messages such as: 'isColor' to unknown
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4951
     receivers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4952
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4953
    ^ self perform:aSelector ifNotUnderstood:[false]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4954
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4955
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4956
     1 askFor:#isColor
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4957
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4958
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4959
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4960
perform:aSelector ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4961
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4962
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4963
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4964
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4965
    |val|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4966
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4967
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4968
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4969
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4970
	val := self perform:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4971
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4972
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4973
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4974
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4975
     1.2345 perform:#foo ifNotUnderstood:['sorry'] 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4976
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4977
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4978
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4979
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4980
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4981
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4982
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4983
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4984
    |val|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4985
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4986
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4987
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4988
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4989
	val := self perform:aSelector with:argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4990
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4991
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4992
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4993
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4994
     |unknown|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4995
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4996
     unknown := 1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4997
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4998
     unknown := 'high there'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4999
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5000
    "
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5001
!
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5002
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5003
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5004
    "try to send message aSelector to the receiver.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5005
     If its understood, return the methods returned value,
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5006
     otherwise return the value of the exceptionBlock"
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5007
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5008
    |val|
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5009
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5010
    MessageNotUnderstoodSignal handle:[:ex |
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5011
	^ exceptionBlock value
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5012
    ] do:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5013
	val := self perform:aSelector withArguments:argumentArray
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5014
    ].
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5015
    ^ val
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5016
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5017
    "
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5018
     |unknown|
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5019
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5020
     unknown := 1.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5021
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5022
     unknown := 'high there'.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5023
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5024
    "
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5025
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  5026
    "Modified: 27.3.1997 / 14:13:16 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5027
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5028
2448
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5029
!Object methodsFor:'signal constants'!
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5030
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5031
messageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5032
    ^ MessageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5033
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5034
    "Created: 6.3.1997 / 15:46:52 / cg"
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5035
! !
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  5036
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5037
!Object methodsFor:'special queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5038
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5039
allOwners
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5040
    "return a collection of all objects referencing the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5041
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5042
    ^ ObjectMemory whoReferences:self
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5045
references:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5046
    "return true, if the receiver refers to the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5047
     - for debugging only"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5048
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5049
"/    |myClass 
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5050
"/     numInst "{ Class: SmallInteger }" |
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5051
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5052
%{  /* NOCONTEXT */
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5053
    OBJ cls, flags;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5054
    int nInsts, i;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5055
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5056
    if (! __isNonNilObject(self)) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5057
	RETURN (false);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5058
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5059
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5060
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5061
     * a little optimization: use the fact that all old objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5062
     * 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
  5063
     * a trivial reject is possible, if anObject is a newbee
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5064
     */
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5065
    if (__isNonNilObject(anObject)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5066
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5067
	    int spc;
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
	    if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5070
		RETURN (false);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5071
	    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5072
	}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5073
    }
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5074
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5075
    cls = __qClass(self);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5076
    if (cls == anObject) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5077
	RETURN (true);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5078
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5079
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5080
    flags = __ClassInstPtr(cls)->c_flags;
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
  5081
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5082
	nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5083
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5084
	nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5085
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5086
    if (! nInsts) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5087
	RETURN (false);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5088
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5089
    for (i=0; i<nInsts; i++) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5090
	if (__InstPtr(self)->i_instvars[i] == anObject) {
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5091
	    RETURN (true);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5092
	}
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5093
    }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5094
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5095
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5096
"/    myClass := self class.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5097
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5098
"/    "check the class"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5099
"/    (myClass == anObject) ifTrue:[^ true].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5100
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5101
"/    "check the instance variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5102
"/    numInst := myClass instSize.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5103
"/    1 to:numInst do:[:i | 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5104
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5105
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5106
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5107
"/    "check the indexed variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5108
"/    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5109
"/      myClass isPointers ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5110
"/          "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5111
"/          "/ we could argue about the following unconditional return:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5112
"/          "/ 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
  5113
"/          "/ 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
  5114
"/          "/ integer. However, it avoids useless searches in huge byteArray
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5115
"/          "/ 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
  5116
"/          "/ 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
  5117
"/          "/ 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
  5118
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5119
"/          ^ false.
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5120
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5121
"/          "/ alternative:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5122
"/          "/  anObject isNumber ifFalse:[^ false].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5123
"/      ].
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5124
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5125
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5126
"/      "/ 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
  5127
"/      "/ idenitytIndex method, use it
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5128
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5129
"/      myClass == Array ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5130
"/          ^ (self identityIndexOf:anObject) ~~ 0
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5131
"/      ].
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5132
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5133
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5134
"/      "/ otherwise, do it the slow way
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5135
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5136
"/      numInst := self basicSize.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5137
"/      1 to:numInst do:[:i | 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5138
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5139
"/      ]
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5140
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  5141
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5142
    ^ false
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
     |v|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5146
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5147
     v := View new initialize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5148
     v references:Display. 
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5152
referencesDerivedInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5153
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5154
     the argument, aClass or its subclass. This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5155
     to support searching for users of a class."
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
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5158
     numInst "{ Class: SmallInteger }" |
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
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5161
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5162
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5163
    (myClass isKindOf:aClass) ifTrue:[^ true].
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
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5166
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5167
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5168
	((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5169
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5170
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5171
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5172
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5173
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5174
	    "no need to search in non pointer fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5175
	    ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5176
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5177
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5178
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5179
	    ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5180
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5181
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5182
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5183
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5184
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5185
     (1 @ 3.4) referencesDerivedInstanceOf:Number  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5186
     (1 @ 3.4) referencesDerivedInstanceOf:Array   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5187
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5188
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5189
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5190
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5191
referencesInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5192
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5193
     the argument, aClass.This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5194
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5195
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5196
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5197
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5198
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5199
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5200
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5201
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5202
    (myClass isMemberOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5203
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5204
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5205
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5206
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5207
	((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5208
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5209
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5210
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5211
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5212
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5213
	    "no need to search in non-pointer indexed fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5214
	    myClass isLongs ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5215
		(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5216
	    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5217
		myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5218
		^ aClass == SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5219
	    ]
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
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5222
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5223
	    ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5224
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5225
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5226
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5227
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
     (1 @ 3.4) referencesInstanceOf:Float     
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5230
     (1 @ 3.4) referencesInstanceOf:Fraction    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5231
     View new initialize referencesInstanceOf:(Display class)  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5232
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5233
! !
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5234
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5235
!Object methodsFor:'synchronized evaluation'!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5236
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5237
freeSynchronizationSemaphore    
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5238
    "free synchronizationSemaphore. May be used, to save memory when
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5239
     an object is no longer used synchronized."
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5240
2342
4e72f4d7caf1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
  5241
    |sema|
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5242
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5243
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5244
    sema notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5245
	sema wait.              "/ get lock
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5246
	self synchronizationSemaphore:nil.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5247
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5248
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5249
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5250
     self synchronized:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5251
     self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5252
     self freeSynchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5253
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5254
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5255
    "Created: 28.1.1997 / 19:31:20 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5256
    "Modified: 28.1.1997 / 19:47:55 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5257
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5258
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5259
synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5260
    "return the synchronization semaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5261
     subclasses may redefine"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5262
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5263
    ^ SynchronizationSemaphores at:self ifAbsent:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5264
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5265
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5266
      self synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5267
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5268
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5269
    "Modified: 28.1.1997 / 19:47:09 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5270
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5271
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5272
synchronizationSemaphore:aSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5273
    "set the synchronisationSemaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5274
     subclasses may redefine this method"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5275
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5276
    aSemaphore isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5277
	"/ remove Semaphore
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5278
	SynchronizationSemaphores removeKey:self ifAbsent:[].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5279
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5280
	SynchronizationSemaphores at:self put:aSemaphore.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5281
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5282
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5283
    "Modified: 28.1.1997 / 19:37:48 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5284
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5285
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5286
synchronized:aBlock
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5287
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5288
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5289
    |sema blocked gotSema|
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5290
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5291
    blocked := OperatingSystem blockInterrupts.
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5292
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5293
    "/ the following avoids creation of an additional
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5294
    "/ block in the common case
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5296
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5297
    sema isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5298
	"get a locked semaphore (with count = 0)"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5299
	sema := Semaphore new.  
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5300
	self synchronizationSemaphore:sema.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5301
	blocked ifFalse:[OperatingSystem unblockInterrupts].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5302
	^ aBlock valueNowOrOnUnwindDo:[sema signal].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5303
    ].
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5304
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5305
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5306
     Poll sema (never waits).
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5307
     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
  5308
     of some blocks.
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5309
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5310
    (sema waitWithTimeout:0) notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5311
	blocked ifFalse:[OperatingSystem unblockInterrupts].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5312
	^ aBlock valueNowOrOnUnwindDo:[sema signal].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5313
    ].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5314
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5315
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5316
	gotSema := sema wait.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5317
	blocked ifFalse:[OperatingSystem unblockInterrupts].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5318
	^ aBlock value.
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5319
    ] valueNowOrOnUnwindDo:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5320
	gotSema notNil ifTrue:[gotSema signal]
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5321
    ].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5322
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5323
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5324
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5325
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5326
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5327
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5328
    "Created: 28.1.1997 / 17:52:56 / stefan"
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5329
    "Modified: 30.1.1997 / 13:38:54 / cg"
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5330
    "Modified: 20.2.1997 / 09:43:35 / stefan"
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5331
! !
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5332
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5333
!Object methodsFor:'system primitives'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5334
1957
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5335
asOop
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5336
    "ST-80 compatibility:
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5337
     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
  5338
     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
  5339
     be used (since its changing over time), we return the objects identityHash 
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5340
     key, which provides (at least) some identity indication.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5341
     However, notice that (in contrast to ST-80's #asOop), the identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5342
     key of two non-identical objects may be the same.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5343
     You'd better not use it - especially do not misuse it."
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5344
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5345
    ^ self identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5346
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5347
    "Created: 9.11.1996 / 19:09:56 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5348
    "Modified: 9.11.1996 / 19:16:04 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5349
!
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5350
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5351
become:anotherObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5352
    "make all references to the receiver become references to anotherObject
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5353
     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
  5354
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5355
     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
  5356
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5357
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5358
     This may also be an expensive (i.e. slow) operation, 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5359
     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
  5360
     references to the two objects (although the primitive tries hard to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5361
     limit the search, for acceptable performance in most cases). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5362
     This method fails, if the receiver or the argument is a SmallInteger 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5363
     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
  5364
     returned).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5365
     (notice that #become: is not used heavily by the system 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5366
      - the Collection-classes have been rewritten to not use it.)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5367
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  5368
    if (__primBecome(self, anotherObject)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5369
	RETURN ( self );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5370
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5371
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5372
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5373
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5374
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5375
becomeNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5376
    "make all references to the receiver become nil - effectively getting
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5377
     rid of the receiver. 
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5378
     This can be a very dangerous operation - be warned.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5379
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5380
     This may be an expensive (i.e. slow) operation.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5381
     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
  5382
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5383
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  5384
    if (__primBecomeNil(self)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5385
	RETURN ( nil );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5386
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5387
%}.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5388
    self primitiveFailed
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5389
!
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5390
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5391
becomeSameAs:anotherObject
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5392
    "make all references to the receiver become references to anotherObject
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5393
     but NOT vice versa (as done in #become:).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5394
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5395
     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
  5396
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5397
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5398
     This may also be an expensive (i.e. slow) operation,
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5399
     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
  5400
     references to the two objects (although the primitive tries hard to
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5401
     limit the search, for acceptable performance in most cases).
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5402
     This method fails, if the receiver or the argument is a SmallInteger
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5403
     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
  5404
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  5405
    if (__primBecomeSameAs(self, anotherObject)) {
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5406
	RETURN ( self );
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5407
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5408
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5409
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5410
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5411
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5412
changeClassTo:otherClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5413
    "changes the class of the receiver to the argument, otherClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5414
     This is only allowed (possible), if the receivers class and the argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5415
     have the same structure (i.e. number of named instance variables and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5416
     type of indexed instance variables). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5417
     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
  5418
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5419
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5420
    |myClass ok|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5421
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5422
    "check for UndefinedObject/SmallInteger receiver or newClass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5423
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5424
    {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5425
	OBJ other = otherClass;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5426
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5427
	if (__isNonNilObject(self) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5428
	 && __isNonNilObject(other)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5429
	 && (other != UndefinedObject)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5430
	 && (other != SmallInteger)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5431
	    ok = true;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5432
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5433
	    ok = false;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5434
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5435
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5436
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5437
    ok ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5438
	ok := false.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5439
	myClass := self class.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5440
	myClass flags == otherClass flags ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5441
	    myClass instSize == otherClass instSize ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5442
		"same instance layout and types: its ok to do it"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5443
		ok := true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5444
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5445
		myClass isPointers ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5446
		    myClass isVariable ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5447
			ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5448
		    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5449
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5450
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5451
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5452
	    myClass isPointers ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5453
		"if newClass is a variable class, with instSize <= my instsize,
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5454
		 we can do it (effectively mapping additional instvars into the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5455
		 variable part) - usefulness is questionable, though"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5456
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5457
		otherClass isPointers ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5458
		    otherClass isVariable ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5459
			otherClass instSize <= (myClass instSize + self basicSize) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5460
			ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5461
			    ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5462
			]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5463
		    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5464
			otherClass instSize == (myClass instSize + self basicSize) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5465
			ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5466
			    ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5467
			]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5468
		    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5469
		] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5470
		    "it does not make sense to convert pointers to bytes ..."
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5471
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5472
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5473
		"does it make sense, to convert bits ?"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5474
		"could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5475
		(myClass isBits and:[otherClass isBits]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5476
		    ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5477
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5478
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5479
	]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5480
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5481
    ok ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5482
	"now, change the receivers class ..."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5483
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5484
	{
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5485
	    OBJ me = self;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5486
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5487
	    __qClass(me) = otherClass;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5488
	    __STORE(me, otherClass);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5489
	    RETURN (me);
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5490
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5491
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5492
    ].
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5493
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5494
    "
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5495
     the receiver cannot be represented as a instance of
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5496
     the desired class.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5497
     For example, you cannot change a bitInstance (byteArray etc.) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5498
     into a pointer object and vice versa.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5499
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5500
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5501
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5502
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5503
changeClassToThatOf:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5504
    "changes the class of the receiver to that of the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5505
     This is only allowed (possible), if the receivers class and the arguments
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5506
     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
  5507
     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
  5508
     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
  5509
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5510
    self changeClassTo:(anObject class)
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
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5513
!Object methodsFor:'testing'!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5514
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5515
? defaultValue
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5516
     "if the receiver is nil, return the defaultValue;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5517
      otherwise, return the receiver.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5518
      This method is only redefined in UndefinedObject - therefore,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5519
      the recevier is retuned here.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5520
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5521
      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
  5522
	  foo ? bar
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5523
      is the same as:
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5524
	  (foo isNil ifTrue:[bar] ifFalse:[foo])
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5525
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5526
      if they are message sends, the equivalent code is:
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5527
	  [
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5528
	      |t1 t2|
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5529
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5530
	      t1 := foo.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5531
	      t2 := bar.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5532
	      t1 isNil ifTrue:[t2] ifFalse:[t1]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5533
	  ] value
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5534
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5535
      Can be used to provide defaultValues to variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5536
      as in:
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5537
	  foo := arg ? #defaultValue
2147
3579ce76c8c8 comment
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  5538
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  5539
      Note: this method should never be redefined in classes other than UndefinedObject.
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5540
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5541
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5542
    ^ self
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5543
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5544
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5545
     1 ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5546
     nil ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5547
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5548
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5549
    "Created: 4.11.1996 / 20:36:19 / cg"
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  5550
    "Modified: 11.1.1997 / 14:56:47 / cg"
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5551
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5552
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5553
isArray
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5554
    "return true, if the receiver is some kind of array (or weakArray etc);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5555
     false is returned here - the method is only redefined in Array."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5556
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5557
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5558
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5559
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5560
isAssociation
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5561
    "return true, if the receiver is some kind of association;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5562
     false is returned here - the method is only redefined in Association."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5563
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5564
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5565
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5566
    "Created: 14.5.1996 / 17:03:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5567
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5568
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5569
isBehavior
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5570
    "return true, if the receiver is some kind of class (i.e. behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5571
     false is returned here - the method is only redefined in Behavior."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5572
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5573
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5574
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5575
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5576
isBlock
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5577
    "return true, if the receiver is some kind of block;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5578
     false returned here - the method is only redefined in Block."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5579
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5580
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5581
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5582
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5583
isCharacter
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5584
    "return true, if the receiver is some kind of character;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5585
     false is returned here - the method is only redefined in Character."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5586
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5587
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5588
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5589
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5590
isClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5591
    "return true, if the receiver is some kind of class (real class, 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5592
     not just behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5593
     false is returned here - the method is only redefined in Class."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5594
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5595
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5596
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5597
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5598
isCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5599
    "return true, if the receiver is some kind of collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5600
     false is returned here - the method is only redefined in Collection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5601
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5602
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5603
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5604
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5605
isColor
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5606
    "return true, if the receiver is some kind of color;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5607
     false is returned here - the method is only redefined in Color."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5608
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5609
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5610
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5611
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5612
isContext
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5613
    "return true, if the receiver is some kind of context;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5614
     false returned here - the method is only redefined in Context."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5615
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5616
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5617
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5618
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5619
isExternalStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5620
    "return true, if the receiver is some kind of externalStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5621
     false is returned here - the method is only redefined in ExternalStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5622
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5623
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5624
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5625
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5626
isFileStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5627
    "return true, if the receiver is some kind of fileStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5628
     false is returned here - the method is only redefined in FileStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5629
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5630
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5631
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5632
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5633
isFixedPoint
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5634
    "return true, if the receiver is some kind of fixedPoint number;
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5635
     false is returned here - the method is only redefined in FixedPoint."
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5636
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5637
    ^ false
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5638
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5639
    "Created: 5.11.1996 / 19:23:04 / cg"
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5640
!
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5641
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5642
isFixedSize
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5643
    "return true if the receiver cannot grow easily 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5644
     (i.e. a grow may be expensive, since it involves a become:)"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5645
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5646
    ^ true
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5647
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5648
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5649
isForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5650
    "return true, if the receiver is some kind of form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5651
     false is returned here - the method is only redefined in Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5652
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5653
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5654
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5655
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5656
isFraction
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5657
    "return true, if the receiver is some kind of fraction;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5658
     false is returned here - the method is only redefined in Fraction."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5659
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5660
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5661
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5662
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5663
isImage
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5664
    "return true, if the receiver is some kind of image;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5665
     false is returned here - the method is only redefined in Image."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5666
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5667
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5668
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5669
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5670
isImageOrForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5671
    "return true, if the receiver is some kind of image or form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5672
     false is returned here - the method is only redefined in Image and Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5673
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5674
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5675
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5676
2673
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5677
isImmediate
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5678
    "return true if this object has immediate representation"
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5679
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5680
    ^ self class hasImmediateInstances
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5681
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5682
    "Created: 3.6.1997 / 12:00:18 / cg"
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5683
!
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5684
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5685
isInteger
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5686
    "return true, if the receiver is some kind of integer number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5687
     false is returned here - the method is only redefined in Integer."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5688
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5689
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5690
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5691
2502
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5692
isJavaClass
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5693
    ^ false
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5694
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5695
    "Created: 26.3.1997 / 13:34:54 / cg"
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5696
!
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5697
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5698
isJavaObject
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5699
    ^ false
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5700
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5701
    "Created: 26.3.1997 / 13:34:48 / cg"
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5702
!
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5703
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5704
isKindOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5705
    "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
  5706
     subclasses, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5707
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5708
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5709
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5710
	to instances of certain classes and fences you into a specific inheritance 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5711
	hierarchy.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5712
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5713
	(such as #isXXXX, #respondsTo: or #isNumber).
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5714
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5715
	Using #isKindOf: is considered BAD STYLE.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5716
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5717
     Advice2:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5718
	Be aware, that using an #isXXX method is usually much faster than 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5719
	using #isKindOf:; because isKindOf: has to walk up all the superclass 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5720
	hierarchy, comparing every class on the way. 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5721
	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
  5722
	a single function call.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5723
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5724
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5725
%{  /* NOCONTEXT */
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5726
    register OBJ thisClass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5727
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5728
    thisClass = __Class(self);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5729
    while (thisClass != nil) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5730
	if (thisClass == aClass) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5731
	    RETURN ( true );
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5732
	}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5733
	thisClass = __ClassInstPtr(thisClass)->c_superclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5734
    }
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5735
%}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5736
.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5737
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5738
"/  the above code is equivalent to:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5739
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5740
"/  thisClass := self class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5741
"/  [thisClass notNil] whileTrue:[
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5742
"/      thisClass == aClass ifTrue:[^ true].
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5743
"/      thisClass := thisClass superclass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5744
"/  ]
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5745
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5746
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5747
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5748
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5749
isLayout
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5750
    "return true, if the receiver is some kind of layout;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5751
     false is returned here - the method is only redefined in Layout."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5752
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5753
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5754
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5755
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5756
isLiteral
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5757
    "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
  5758
     false is returned here - the method is redefined in some classes."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5759
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5760
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5761
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5762
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5763
isMemberOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5764
    "return true, if the receiver is an instance of aClass, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5765
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5766
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5767
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5768
	to instances of a certain class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5769
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5770
	(such as #isXXX, #respondsTo: or #isNumber);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5771
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5772
	Using #isMemberOf: is considered BAD STYLE."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5773
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5774
    ^ (self class) == aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5775
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5776
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5777
isMeta
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5778
    "return true, if the receiver is some kind of metaclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5779
     false is returned here - the method is only redefined in Metaclass."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5780
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5781
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5782
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5783
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5784
isMethod
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5785
    "return true, if the receiver is some kind of method;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5786
     false returned here - the method is only redefined in Method."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5787
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5788
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5789
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5790
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5791
isNamespace
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5792
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5793
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5794
    "Created: 11.10.1996 / 18:08:56 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5795
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5796
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5797
isNumber
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5798
    "return true, if the receiver is some kind of number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5799
     false is returned here - the method is only redefined in Number."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5800
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5801
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5802
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5803
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5804
isPoint
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5805
    "return true, if the receiver is some kind of point;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5806
     false is returned here - the method is only redefined in Point."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5807
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5808
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5809
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5810
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5811
isReal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5812
    "return true, if the receiver is some kind of real number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5813
     false is returned here - the method is only redefined in LimitedPrecisionReal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5814
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5815
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5816
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5817
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5818
isRectangle
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5819
    "return true, if the receiver is some kind of rectangle;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5820
     false is returned here - the method is only redefined in Rectangle."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5821
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5822
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5823
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5824
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5825
isRemoteObject
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5826
    "return true, if the receiver is some kind of remoteObject,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5827
     false if its local - the method is only redefined in RemoteObject."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5828
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5829
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5830
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5831
    "Created: 28.10.1996 / 15:18:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5832
    "Modified: 28.10.1996 / 15:20:57 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5833
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5834
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5835
isSequenceable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5836
    "return true, if the receiver is some kind of sequenceable collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5837
     false is returned here - the method is only redefined in SequenceableCollection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5838
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5839
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5840
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5841
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5842
isSequenceableCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5843
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5844
     This method is a historic leftover and will be removed soon ..."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5845
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5846
    self obsoleteMethodWarning:'use #isSequenceable'.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5847
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5848
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5849
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5850
isSignal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5851
    "return true, if the receiver is some kind of signal;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5852
     false returned here - the method is only redefined in Signal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5853
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5854
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5855
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5856
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5857
isStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5858
    "return true, if the receiver is some kind of stream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5859
     false is returned here - the method is only redefined in Stream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5860
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5861
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5862
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5863
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5864
isString
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5865
    "return true, if the receiver is some kind of string;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5866
     false is returned here - the method is only redefined in String."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5868
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5869
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5870
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5871
isSymbol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5872
    "return true, if the receiver is some kind of symbol;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5873
     false is returned here - the method is only redefined in Symbol."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5874
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5875
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5876
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5877
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5878
isText
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5879
    "return true, if the receiver is some kind of text object;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5880
     false is returned here - the method is only redefined in Text."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5881
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5882
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5883
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5884
    "Created: 12.5.1996 / 10:56:50 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5885
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5886
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5887
isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5888
    "return true if the receiver has indexed instance variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5889
     false otherwise."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5890
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5891
    ^ self class isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5892
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5893
2704
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  5894
isVariableBinding
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  5895
    ^ false
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  5896
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  5897
    "Created: 19.6.1997 / 17:38:44 / cg"
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  5898
!
3f56a3a9908a more ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2689
diff changeset
  5899
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5900
isView
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5901
    "return true, if the receiver is some kind of view;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5902
     false is returned here - the method is only redefined in View."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5903
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5904
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5905
! !
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5906
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5907
!Object methodsFor:'user interaction & notifications'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5908
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5909
activityNotification:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5910
    "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
  5911
     some long-time activity.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5912
     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
  5913
     passing the argument. The handler should show this message whereever it likes,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5914
     and proceed. If there is no handler, this is simply ignored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5915
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5916
     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
  5917
     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
  5918
     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
  5919
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5920
    ActivityNotificationSignal isHandled ifTrue:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5921
	^ ActivityNotificationSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5922
    ].
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
     nil activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5926
     self activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5927
    "
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
     ActivityNotificationSignal handle:[:ex |
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5931
	ex errorString printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5932
	ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5933
     ] do:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5934
	'hello' printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5935
	self activityNotification:'doing some long time computation'.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5936
	'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5937
     ]
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5940
    "Modified: 16.12.1995 / 18:23:42 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5941
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5942
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5943
confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5944
    "launch a confirmer, which allows user to enter yes or no.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5945
     return true for yes, false for no"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5946
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5947
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5948
     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
  5949
     and return true (as if yes was answered)
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5950
     Q: should we ask user by reading Stdin ?
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5951
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5952
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5953
	'*** confirmation requested during initialization:' printCR. 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5954
	aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5955
	'*** I''ll continue, assuming <yes> ...' printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5956
	^ true
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5957
    ].
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5958
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5959
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5960
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5961
	Transcript showCR:'continue, assuming <yes>'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5962
	^ true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5963
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5964
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5965
    ^ Dialog confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5966
        
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
     nil confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5969
     self confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5970
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5971
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5972
    "Modified: 20.5.1996 / 10:28:40 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5973
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5974
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5975
errorNotify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5976
    "launch a Notifier, showing top stack, telling user something
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5977
     and give user a chance to enter debugger."
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5978
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5979
    ^ self
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5980
	errorNotify:aString 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5981
	from:thisContext sender
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5982
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5983
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5984
     nil errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5985
     self errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5986
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5987
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5988
    "Modified: 11.1.1997 / 18:39:20 / cg"
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5989
!
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5990
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5991
errorNotify:aString from:aContext
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5992
    "launch a Notifier, showing top stack (above aContext), 
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5993
     telling user something and give user a chance to enter debugger."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5994
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5995
    |info con sender action|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5996
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5997
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5998
	'errorNotification: ' print. aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5999
	^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6000
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6001
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6002
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6003
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6004
	 on systems without GUI, simply show
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6005
	 the message on the Transcript and abort.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6006
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6007
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6008
	AbortSignal raise.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6009
	^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6010
    ].
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6011
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6012
    Processor activeProcessIsSystemProcess ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6013
	action := #debug.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6014
	sender := aContext.
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6015
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6016
	Dialog autoload.        "in case its autoloaded"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6017
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6018
	ErrorSignal handle:[:ex |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6019
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6020
	    "/ a recursive error - quickly enter debugger
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6021
	    "/ this happened, when I corrupted the Dialog class ...
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6022
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  6023
	    ('Object [error]: ' , ex errorString , ' caught in errorNotification') errorPrintCR.
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6024
	    action := #debug.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6025
	    ex return.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6026
	] do:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6027
	    sender := aContext.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6028
	    sender isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6029
		sender := thisContext sender.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6030
		"/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6031
		"/ 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
  6032
"/                sender isBlockContext ifTrue:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6033
"/                    sender := sender sender
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  6034
"/                ].
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6035
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6036
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6037
	    "/ skip intermediate (signal & exception) contexts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6038
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6039
	    DebugView notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6040
		sender := DebugView interestingContextFrom:sender
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6041
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6042
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6043
	    "/ show the first 5 contexts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6044
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6045
	    con := sender.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6046
	    info := aString , Character cr asString , Character cr asString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6047
	    1 to:5 do:[:n |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6048
		con notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6049
		    info := info , con printString , Character cr asString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6050
		    con := con sender
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6051
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6052
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6053
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6054
	    action := Dialog 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6055
			choose:info 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6056
			label:('Exception [' , Processor activeProcess nameOrId , ']')
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6057
			labels:#('proceed' 'abort' 'debug')
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6058
			values:#(#proceed #abort #debug)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6059
			default:#debug.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6060
	].
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6061
    ].
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6062
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6063
    action == #debug ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6064
	Debugger enter:sender withMessage:aString
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  6065
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6066
	action == #abort ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6067
	    AbortSignal raise
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6068
	]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6069
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6070
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6071
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6072
     nil errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6073
     self errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6074
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  6075
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  6076
    "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
  6077
    "Modified: 8.2.1997 / 12:47:41 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6078
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6079
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6080
information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6081
    "launch an InfoBox, telling user something. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6082
     These info-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6083
     UserNotification- or InformationSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6084
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6085
    InformationSignal isHandled ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6086
	^ InformationSignal raiseRequestWith:self errorString:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6087
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6088
    self notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6089
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6090
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6091
     nil information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6092
     self information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6093
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6094
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6095
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6096
     InformationSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6097
	'no box popped' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6098
	ex proceed.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6099
     ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6100
	'hello' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6101
	self information:'some info'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6102
	'world' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6103
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6104
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6105
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6106
    "Modified: 24.11.1995 / 22:29:49 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6107
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6108
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6109
notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6110
    "launch a Notifier, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6111
     Use #information: for ignorable messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6112
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6113
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6114
	'information: ' print. aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6115
	^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6116
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6117
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6118
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6119
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6120
	 on systems without GUI, simply show
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6121
	 the message on the Transcript.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6122
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6123
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6124
	^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6125
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6126
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6127
    Dialog information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6128
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6129
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6130
     nil notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6131
     self notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6132
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  6133
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6134
    "Modified: 20.5.1996 / 10:28:48 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6135
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6136
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6137
warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6138
    "launch a WarningBox, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6139
     These warn-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6140
     UserNotification- or WarningSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6141
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6142
    WarningSignal isHandled ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6143
	^ WarningSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6144
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6145
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6146
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6147
	'warning: ' print. aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6148
	^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6149
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  6150
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6151
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6152
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6153
	 on systems without GUI, simply show
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6154
	 the message on the Transcript.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6155
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6156
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6157
	^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6158
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6159
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6160
    Dialog warn:aString
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6163
     nil warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6164
     self warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6165
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6166
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6167
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6168
     WarningSignal handle:[:ex |
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6169
	ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6170
     ] do:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6171
	'hello' printNL.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6172
	self warn:'some info'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  6173
	'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6174
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6175
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  6176
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  6177
    "Modified: 20.5.1996 / 10:28:53 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6178
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6179
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  6180
!Object class methodsFor:'documentation'!
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6181
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6182
version
2895
41fbba8eb543 Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents: 2893
diff changeset
  6183
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.205 1997-09-03 12:53:30 stefan Exp $'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6184
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  6185
Object initialize!