Object.st
author Claus Gittinger <cg@exept.de>
Mon, 16 Jun 1997 20:21:41 +0200
changeset 2689 ada9b102abcf
parent 2673 f514189f6096
child 2704 3f56a3a9908a
permissions -rw-r--r--
typo fix
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);
63087903a3e0 oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents: 2647
diff changeset
  1771
	__qNew(theCopy, sz);
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.
2511
35de13a3a71e dont mark all contexts as nonLifo in approriateDebugger.
Claus Gittinger <cg@exept.de>
parents: 2506
diff changeset
  2351
    context := context findNextContextWithSelector:aSelector 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
	].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2370
	context := context findNextContextWithSelector:aSelector 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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2405
    "/ handle the case of an error during early startup
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2406
    "/ (output streams not yet initialized)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2407
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2408
    Stdout isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2409
	Smalltalk fatalAbort:'error during init: ' , aMessage selector , ' not understood'.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2410
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2411
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2412
    (sel := aMessage selector) isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2413
	"/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2414
	"/ happens when things go mad, or a method has been
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2415
	"/ called by valueWithReceiver: with a wrong receiver.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2416
	"/ To avoid later trouble (when concatenating strings),
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2417
	"/ replace the selector by some (nonNil) string
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2418
	"/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2419
	sel := '(nil)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2420
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2421
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
    "/ extract the class that should have implemented the message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2424
    "/ (in case of a super-send, this is not the receivers class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2425
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2426
    sender := thisContext sender.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2427
    cls := sender searchClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2428
    cls isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2429
	"it was NOT a super or directed send ..."
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2430
	cls := self class
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2431
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2432
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2433
    cls notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2434
	"/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2435
	"/ displayString is better than 'cls name',
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2436
	"/ since it appends (obsolete) for outdated classes.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2437
	"/ (this happens if you send messages to old instances
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2438
	"/  after changing a classes definition)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2439
	"/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2440
	errorString := cls displayString.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2441
    ] ifFalse:[    
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2442
	errorString := '(** nil-class **)'
783
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
    errorString := errorString , ' does not understand: ' , sel.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2445
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
    "/ this only happens, when YOU play around with my classvars ...
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2448
    "/ (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
  2449
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2450
    MessageNotUnderstoodSignal isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2451
	^ self 
1674
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2452
	    enterDebuggerWithMessage:'oops - MessageNotUnderstoodSignal is gone'
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2453
	    on:thisContext.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2454
    ].
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
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2457
    "/ 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
  2458
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2459
    ^ MessageNotUnderstoodSignal
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2460
		raiseRequestWith:aMessage
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2461
		     errorString:errorString
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2462
			      in:sender
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2463
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2464
    "Modified: 3.5.1996 / 11:51:45 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2465
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2466
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2467
elementBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2468
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2469
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2470
    "report an error that badElement is out of bounds 
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2471
     (i.e. cannot be put into that collection).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2472
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2473
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2474
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2475
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2476
    "Modified: 8.5.1996 / 09:12:45 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2477
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2478
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2479
elementNotCharacter
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2480
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2481
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2482
    "report an error that object to be stored is no Character.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2483
     (usually when storing into Strings).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2484
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2485
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2486
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2487
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2488
    "Modified: 8.5.1996 / 09:12:49 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2489
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2490
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2491
elementNotInteger
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2492
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2493
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2494
    "report an error that object to be stored is not Integer.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2495
     (in collections that store integers only).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2496
     The error is reported by raising the ElementOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2497
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2498
    ^ ElementOutOfBoundsSignal raiseIn:thisContext sender
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2499
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2500
    "Modified: 8.5.1996 / 09:12:51 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2501
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2502
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2503
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
  2504
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2505
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2506
    "enter the debugger with error-message aString"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2507
1674
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2508
    ^ self 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2509
	enterDebuggerWithMessage:aString 
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2510
	on:anException suspendedContext
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2511
!
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2512
edc395b278ab *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1626
diff changeset
  2513
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
  2514
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2515
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2516
    "enter the debugger with error-message aString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2517
     The first visible context shown there is aContext 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2518
     (this allows intermediate helpers to hide themselfes from what is
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2519
     presented to the user)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2520
1094
af10927dc0f2 standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents: 1089
diff changeset
  2521
    |debugger msg|
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2522
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2523
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2524
     if there is no debugger, exit smalltalk
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2525
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2526
    Debugger isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2527
	msg := 'error: ' , aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2528
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2529
	Smalltalk isStandAloneApp ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2530
	    Dialog notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2531
		(Dialog 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2532
		    confirm:msg title:(Smalltalk commandName)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2533
		    yesLabel:'ignore' noLabel:'exit'
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2534
		) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2535
		    ^ AbortSignal raise
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2536
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2537
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2538
	    msg errorPrintCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2539
	    OperatingSystem exit:1
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2540
	].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2541
	msg errorPrintCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2542
	Smalltalk fatalAbort:'no Debugger defined'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2543
    ].
983
86239edb7b7d change in VM data structures
Claus Gittinger <cg@exept.de>
parents: 925
diff changeset
  2544
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2545
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2546
     find an appropriate debugger to use
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2547
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2548
    debugger := self appropriateDebugger:#'enter:withMessage:'.
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
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  2551
    "Modified: 10.1.1997 / 19:11:52 / 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
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2668
invalidMessage 
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2669
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2670
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2671
    "this is sent by ST/V code - its the same as #shouldNotImplement"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2672
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2673
    ^ self shouldNotImplement
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2674
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2675
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2676
mustBeRectangle
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
    "report an argument-not-rectangle-error"
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 error:'argument must be a Rectangle'
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
mustBeString
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-string-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 String'
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
notIndexed
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
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2695
    "report an error that receiver has no indexed instance variables.
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2696
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2697
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2698
    ^ SubscriptOutOfBoundsSignal 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2699
	raiseErrorString:'receiver has no indexed variables'
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2700
	in:thisContext sender
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2701
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2702
    "Modified: 26.7.1996 / 16:43:13 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2703
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2704
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2705
primitiveFailed
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2706
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2707
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2708
    "report an error that some primitive code failed.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2709
     The error is reported by raising the PrimitiveFailureSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2710
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2711
    ^ PrimitiveFailureSignal raiseIn:(thisContext sender)
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2712
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2713
    "Modified: 8.5.1996 / 09:14:07 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2714
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2715
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2716
shouldNotImplement
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2717
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2718
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2719
    "report an error that this message should not be implemented"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2720
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2721
    ^ self error:'method not appropriate for this class'
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2722
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2723
    "Modified: 8.5.1996 / 09:09:44 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2724
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2725
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2726
subclassResponsibility
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2727
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2728
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2729
    "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
  2730
     subclass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2731
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2732
    ^ self error:'method must be reimplemented in subclass' in:thisContext sender
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2733
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2734
    "Modified: 8.5.1996 / 09:09:26 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2735
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2736
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2737
subscriptBoundsError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2738
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2739
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2740
    "report an error that some index is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2741
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2742
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2743
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2744
    ^ SubscriptOutOfBoundsSignal 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2745
	raiseIn:thisContext sender
1611
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2746
f8c9a3ab9929 notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents: 1585
diff changeset
  2747
    "Modified: 26.7.1996 / 16:45:42 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2748
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2749
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2750
subscriptBoundsError:anIndex
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2751
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2752
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2753
    "report an error that anIndex is out of bounds.
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2754
     (when accessing indexable collections).
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2755
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2756
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2757
    ^ SubscriptOutOfBoundsSignal 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2758
	raiseRequestWith:anIndex 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2759
	errorString:('subscript (' , anIndex printString , ') out of bounds')
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2760
	in:thisContext sender
1021
b0c7f4a235fb show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents: 985
diff changeset
  2761
1345
2a7936bdc81a commentary
Claus Gittinger <cg@exept.de>
parents: 1327
diff changeset
  2762
    "Modified: 8.5.1996 / 09:14:34 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2763
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2764
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2765
typeCheckError
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2766
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  2767
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2768
    "generated when a variable declared with a type hint gets a bad
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2769
     value assigned"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2770
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2771
    ^ self error:'bad assign of ' , self printString ,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2772
		  ' (' , self class name , ') to typed variable'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2773
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2774
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2775
!Object methodsFor:'evaluation'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2776
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2777
value
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2778
    "return the receiver itself.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2779
     This allows every object to be used where blocks or valueHolders
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2780
     are typically used, and allows for valueHolders and blocks to be
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2781
     used interchangably in some situations.
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2782
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2783
     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
  2784
     style ... (the idea was borrowed from the Self language).
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2785
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2786
     WARNING: dont 'optimize' away ifXXX: blocks 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2787
	      (i.e. do NOT replace 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2788
			foo ifTrue:[var1] ifFalse:[var2]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2789
	       by:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2790
			foo ifTrue:var1 ifFalse:var2
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2791
	      )
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2792
	      - the compilers will only generate inline code for the if, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2793
		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
  2794
		generated.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2795
	      This 'oprimization' will work semantically correct,
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2796
	      but execute SLOWER instead."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2797
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2798
    ^ self
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2799
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  2800
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2801
     #(1 2 3 4) indexOf:5 ifAbsent:0     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2802
     #(1 2 3 4) indexOf:5 ifAbsent:[0]     
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2803
     1 > 2 ifTrue:['yes'] ifFalse:['no']  
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2804
     1 > 2 ifTrue:'yes' ifFalse:'no'       
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2807
    "DO NOT DO THIS (its slower)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2808
     (1 > 4) ifTrue:'oops' ifFalse:'ok'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2809
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2810
     USE (the compiler optimizes blocks in if/while):
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2811
     (1 > 4) ifTrue:['oops'] ifFalse:['ok']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2812
    "
1327
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2813
5dd6b52d8325 comments
Claus Gittinger <cg@exept.de>
parents: 1294
diff changeset
  2814
    "Modified: 3.5.1996 / 11:57:08 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2815
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2816
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2817
!Object methodsFor:'initialization'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2818
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2819
initialize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2820
    "just to ignore initialize to objects which do not need it"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2821
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  2822
    ^ self
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
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2825
!Object methodsFor:'interest'!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2826
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2827
addInterest:anInterest
1762
e7267ff590ff Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1751
diff changeset
  2828
    "install an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2829
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2830
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2831
    self addNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2832
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2833
    "Created: 14.10.1996 / 22:27:34 / stefan"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2834
!
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2835
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2836
expressInterestIn:aspect for:anObject sendBack:aSelector
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2837
    "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
  2838
     changes aspect."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2839
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2840
    "/ 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
  2841
    "/ 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
  2842
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2843
    self addInterest:(InterestConverter 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2844
			    destination:anObject 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2845
			    selector:aSelector 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2846
			    aspect:aspect)
1217
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
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2849
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2850
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2851
     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
  2852
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2853
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2854
     Transcript showCR:'interest in #foo:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2855
     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
  2856
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2857
     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
  2858
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2859
     Transcript cr.
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
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2862
     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
  2863
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2864
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2865
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2866
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2867
     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
  2868
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2869
     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
  2870
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2871
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2872
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2873
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2874
     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
  2875
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2876
     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
  2877
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2878
     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
  2879
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2880
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2881
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2882
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2883
     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
  2884
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2885
     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
  2886
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2887
     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
  2888
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2889
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2890
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2891
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2892
     Transcript showCR:'no more interests:'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2893
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2894
     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
  2895
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2896
     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
  2897
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2898
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2899
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2900
     p release.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2901
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2902
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2903
    "Created: 19.4.1996 / 10:26:22 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2904
    "Modified: 19.4.1996 / 12:34:08 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2905
    "Modified: 14.10.1996 / 22:28:20 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2906
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2907
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2908
interests
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2909
    "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
  2910
     Here, we use the nonWeakDependents for interests."
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2911
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2912
    ^ self nonWeakDependents
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2913
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2914
    "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
  2915
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2916
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2917
onChangeSend:aSelector to:anObject
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2918
    "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
  2919
     changes."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2920
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2921
    "/ 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
  2922
    "/ 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
  2923
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2924
    self addInterest:(InterestConverter 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2925
			  destination:anObject 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2926
			  selector:aSelector)
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2927
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
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2930
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2931
     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
  2932
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2933
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2934
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2935
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2936
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2937
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2938
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2939
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2940
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2941
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2942
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2943
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2944
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2945
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2946
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2947
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2948
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2949
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2950
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2951
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2952
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2953
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2954
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  2955
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2956
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2957
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2958
    "
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
    "Created: 19.4.1996 / 10:26:38 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2961
    "Modified: 19.4.1996 / 12:34:26 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2962
    "Modified: 14.10.1996 / 22:28:27 / stefan"
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2963
!
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2964
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2965
removeInterest:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2966
    "remove an interest forwarder.
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2967
     Here, we use the nonWeakDependencies."
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  2968
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2969
    self removeNonWeakDependent:anInterest
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2970
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2971
    "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
  2972
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2973
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2974
retractInterestIn:aspect for:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2975
    "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
  2976
     (as installed with #expressInterestIn:for:sendBack:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2977
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2978
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2979
    "/ 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
  2980
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2981
    |deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2982
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  2983
    deps := self interests.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2984
    deps notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2985
	deps do:[:dep |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2986
	    (dep isMemberOf:InterestConverter) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2987
		dep destination == someOne ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2988
		    dep aspect == aspect ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2989
			self removeInterest:dep.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2990
			^ self
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2991
		    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2992
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2993
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2994
	]
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2995
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2996
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2997
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2998
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  2999
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3000
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3001
     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
  3002
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3003
     p := Point new.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3004
     Transcript showCR:'interest in #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3005
     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
  3006
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3007
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3008
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3009
     Transcript cr.
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
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3012
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3013
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3014
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3015
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3016
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3017
     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
  3018
     p retractInterestIn:#foo for:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3019
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3020
     p changed:#foo.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3021
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3022
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3023
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3024
     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
  3025
     p expressInterestIn:#bar for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3026
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3027
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3028
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3029
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3030
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3031
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3032
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3033
     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
  3034
     p expressInterestIn:#foo for:b sendBack:#value.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3035
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3036
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3037
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3038
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3039
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3040
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3041
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3042
     Transcript showCR:'no more interests'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3043
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3044
     Transcript showCR:'now changing #foo'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3045
     p changed:#foo.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3046
     Transcript showCR:'now changing #bar'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3047
     p changed:#bar.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3048
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3049
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3050
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3051
    "Created: 19.4.1996 / 10:27:11 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3052
    "Modified: 19.4.1996 / 12:29:52 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3053
    "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
  3054
!
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3055
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3056
retractInterestsFor:someOne
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3057
    "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
  3058
     (as installed with #onChangeSend:to:)."
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3059
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3060
    "/ for now, remove the interestConverter.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3061
    "/ 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
  3062
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3063
    |coll deps|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3064
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3065
    "/ 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
  3066
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3067
    coll := IdentitySet new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3068
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3069
    deps := self interests.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3070
    deps notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3071
	deps do:[:dep |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3072
	    (dep isMemberOf:InterestConverter) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3073
		dep destination == someOne ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3074
		    coll add:dep.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3075
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3076
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3077
	].
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3078
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3079
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3080
    coll do:[:dep |
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3081
	self removeInterest:dep.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3082
    ].
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3083
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3084
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3085
    "
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3086
     |p b|
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3087
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3088
     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
  3089
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3090
     p := Point new.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3091
     p onChangeSend:#value to:b.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3092
     p x:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3093
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3094
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3095
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3096
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3097
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3098
     Transcript showCR:'now changing'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3099
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3100
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3101
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3102
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3103
     Transcript showCR:'no more interest'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3104
     p retractInterestsFor:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3105
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3106
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3107
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3108
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3109
     Delay waitForSeconds:1.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3110
     Transcript showCR:'interest again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3111
     p onChangeSend:#value to:b.
1422
9a0b792f2953 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1417
diff changeset
  3112
     Transcript showCR:'now changing again'.
1217
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3113
     p changed.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3114
     Transcript cr.
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3115
    "
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
    "Created: 19.4.1996 / 10:23:46 / cg"
1231
4f457f654e57 interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents: 1217
diff changeset
  3118
    "Modified: 19.4.1996 / 12:30:03 / cg"
1751
0902cadafee2 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1705
diff changeset
  3119
    "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
  3120
! !
4f7099eb007c separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents: 1133
diff changeset
  3121
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3122
!Object methodsFor:'interrupt handling'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3123
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3124
childSignalInterrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3125
    "death of a child process (unix process) - do nothing"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3126
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3127
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3128
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3129
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3130
customInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3131
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3132
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3133
    "a custom interrupt"
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 error:'custom interrupt'
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
errorInterrupt:errorID with:aParameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3139
    "subsystem error. The arguments errorID and aParameter are the values passed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3140
     to the 'errorInterruptWithIDAndParameter(id, param)' function, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3141
     which can be called from C subsystems to raise an (asynchronous)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3142
     error exception.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3143
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3144
     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
  3145
     used from other C subsystems too, to upcast errors.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3146
     Especially, for subsystems which call errorHandler functions asynchronously.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3147
     IDs (currently) used:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3148
	#DisplayError ..... x-error interrupt
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3149
	#XtError      ..... xt-error interrupt (Xt interface is not yet published)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3150
    "
783
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
    |handler|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3153
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3154
    handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3155
    handler notNil ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3156
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3157
	"/ handler found; let it do whatever it wants ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3158
	"/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3159
	handler errorInterrupt:errorID with:aParameter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3160
	^ self
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3163
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3164
    "/ no handler - raise errorSignal passing the errorId as parameter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3165
    "/
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3166
    ^ ErrorSignal 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3167
	raiseRequestWith:errorID 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3168
	errorString:('Subsystem error. ErrorID = ' , errorID printString)
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
exceptionInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3172
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3173
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3174
    "exception interrupt - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3175
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3176
    self error:'exception Interrupt'
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
fpExceptionInterrupt
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
    "a floating point exception occured - this one
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3183
     has to be handled differently since it comes asynchronous
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3184
     on some machines (for example, on machines with a separate FPU
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3185
     or superscalar architectures. Also, errors from within primitive code
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3186
     (or library functions such as GL) are sent via the Unix-signal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3187
     mechanism this way."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3188
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3189
    ^ Float domainErrorSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3190
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3191
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3192
internalError:msg
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3193
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3194
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3195
    "this is triggered, when VM hits some bad error,
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3196
     such as corrupted class, corrupted method/selector array
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3197
     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
  3198
     (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
  3199
     Its not guaranteed, that the system is in a working condition once
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3200
     this error occurred ...."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3201
2227
eb1e28c62f14 use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents: 2209
diff changeset
  3202
    ^ InternalErrorSignal
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3203
	  raiseRequestWith:self
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3204
	  errorString:msg
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3205
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3206
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3207
ioInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3208
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3209
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3210
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3211
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3212
     or it does not understand the ioInterrupt message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3213
     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
  3214
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3215
    self error:'I/O Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3216
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3217
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3218
memoryInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3219
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3220
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3221
    "out-of-memory interrupt and no handler - 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:'almost out of memory'
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
recursionInterrupt
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
    "recursion limit (actually: stack overflow) interrupt.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3230
     This interrupt is triggered, when a process stack grows above
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3231
     its stackLimit - usually, this leads into the debugger, but
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  3232
     could be caught and the stackLimit increased in the handler.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3233
     At the time we arrive here, the system has still some stack 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3234
     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
  3235
     debugging for a while.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3236
     If the signal is ignored, and the stack continues to grow, there
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3237
     will be a few more chances (and more interrupts) before the VM
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3238
     hard-terminates the process."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3239
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3240
    thisContext isRecursive ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3241
	^ RecursionInterruptSignal raise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3242
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3243
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3244
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3245
schedulerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3246
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3247
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3248
    "scheduler interrupt (supposed to be sent to Processor).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3249
     If we arrive here, either the Processor does not understand it,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3250
     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
  3251
     big trouble. Enter debugger."
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
    self error:'schedulerInterrupt - but no Processor'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3254
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3255
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3256
signalInterrupt:signalNumber
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3257
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3258
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3259
    "unix signal occured - some signals are handled as Smalltalk Exceptions 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3260
     (SIGPIPE), others (SIGBUS) are rather fatal ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3261
     In any case, if a smalltalk-signal has been connected to the OS signal,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3262
     that one is raised.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3263
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3264
     exact cause etc.). This helps if segvs occur in primitive code.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3265
     Currently (temporary kludge), these are passed as global variables."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3266
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3267
    |box name here sig ignorable titles actions badContext msg pc addr|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3268
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3269
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3270
     special case - since SIGPIPE has an ST-signal associated
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3271
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3272
    (signalNumber == 13) ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3273
	"SIGPIPE - write on a pipe with no one to read"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3274
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3275
	^ PipeStream brokenPipeSignal raise.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3276
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3277
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3278
    "if there has been an ST-signal installed, use it ..."
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
    sig := OperatingSystem operatingSystemSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3281
    sig notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3282
	^ sig raise
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3283
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3284
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3285
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3286
     ... otherwise , bring up a box asking for what to do ...
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
    name := OperatingSystem nameForSignal:signalNumber.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3289
    here := thisContext.
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3292
     the context, in which the signal occurred:
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3293
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3294
    badContext := here sender.
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
     ungrab - in case it happened in a box/popupview
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3298
     otherwise display stays locked
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3299
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3300
    Display notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3301
	Display ungrabPointer.
2655
efbeb1fe80c0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2652
diff changeset
  3302
	Display ungrabKeyboard.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3303
    ].
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3306
     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
  3307
     since the system will retry the faulty instruction, which leads to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3308
     another signal - to avoid frustration, better not offer this option.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3309
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3310
    ignorable := (signalNumber ~~ OperatingSystem sigBUS)
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3311
		  and:[signalNumber ~~ OperatingSystem sigILL
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3312
		  and:[signalNumber ~~ OperatingSystem sigSEGV]].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3313
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3314
    ignorable ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3315
	here isRecursive ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3316
	    'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3317
	    MiniDebugger enterWithMessage:'recursive signal'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3318
	    ^ self
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3319
	].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3320
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3321
	 a hard signal - go into debugger immediately
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3322
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3323
	msg := 'OS-signal: ', name.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3324
	InterruptPcLow notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3325
	    pc := InterruptPcLow + (InterruptPcHi bitShift:16).
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3326
	    pc ~~ 0 ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3327
		msg := msg , ' PC=' , (pc printStringRadix:16)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3328
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3329
	].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3330
	InterruptAddrLow notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3331
	    addr := InterruptAddrLow + (InterruptAddrHi bitShift:16).
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3332
	    addr ~~ 0 ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3333
		msg := msg , ' ADDR=' , (addr printStringRadix:16)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3334
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3335
	].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3336
	Debugger enter:here withMessage:msg. 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3337
	badContext return.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3338
	^ nil.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3339
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3340
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3341
    OptionBox isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3342
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3343
	 a system without GUI ...
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3344
	 go into minidebugger (if there is one)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3345
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3346
	MiniDebugger isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3347
	    "
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3348
	     a system without debugging facilities
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3349
	     (i.e. a standalone system)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3350
	     output a message and exit.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3351
	    "
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3352
	    ('Object [error]: exit due to Signal ' , name , ' - and no debugger.') errorPrintCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3353
	    Smalltalk exit.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3354
	].
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  3355
	MiniDebugger enterWithMessage:'Signal caught (' , name, ')'.
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3356
	^ self
783
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3359
    box := OptionBox 
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  3360
		title:'Signal caught (' , name, ')'
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3361
		numberOfOptions:(ignorable ifTrue:[5] ifFalse:[4]).
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3362
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3363
    titles := #('return' 'debug' 'dump' 'exit').
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3364
    actions := Array 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3365
		 with:[badContext return]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3366
		 with:[Debugger enter:here withMessage:('Signal ', name). ^nil]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3367
		 with:[Smalltalk fatalAbort]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3368
		 with:[Smalltalk exit].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3369
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3370
    ignorable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3371
	titles := #('ignore') , titles.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3372
	actions := (Array with:[^ nil]) , actions.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3373
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3374
    box buttonTitles:titles.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3375
    box actions:actions.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3376
    box showAtPointer
2043
cc841f83b3c1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2042
diff changeset
  3377
2136
36c63754670a *PrintNL eliminated
Claus Gittinger <cg@exept.de>
parents: 2132
diff changeset
  3378
    "Modified: 10.1.1997 / 19:09:39 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3379
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3380
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3381
spyInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3382
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3383
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3384
    "spy interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3385
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3386
    self error:'spy Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3387
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3388
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3389
timerInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3390
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3391
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3392
    "timer interrupt and no handler - enter debugger"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3393
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3394
    self error:'timer Interrupt - but no handler'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3395
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3396
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3397
userInterrupt
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3398
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  3399
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3400
    "user (^c) interrupt.
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3401
     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
  3402
     controlling tty (i.e. in the xterm)."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3403
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3404
    UserInterruptSignal raise
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3405
!
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3406
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3407
userInterruptIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3408
    "{ Pragma: +optSpace }"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3409
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3410
    "user (^c) interrupt - enter debugger, but show aContext
1792
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3411
     as top-context. 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3412
     This is used to hide any intermediate scheduler contexts, 
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3413
     in case of an interrupted process. Typically, this is sent by
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3414
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
ba0dc099895c comment
Claus Gittinger <cg@exept.de>
parents: 1788
diff changeset
  3415
     processed."
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3416
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3417
    UserInterruptSignal raiseIn:aContext
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3418
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3419
    "Created: 18.10.1996 / 20:46:04 / cg"
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  3420
    "Modified: 20.10.1996 / 13:06:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3421
! !
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3422
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3423
!Object methodsFor:'message sending'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3424
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3425
perform:aSelector
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3426
    "send the message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3427
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3428
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3429
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3430
    static struct inlineCache ilc_0 = __ILCPERF0(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3431
    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
  3432
    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
  3433
    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
  3434
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3435
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3436
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3437
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3438
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3439
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3440
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3441
		last_0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3442
	    } else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3443
		pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3444
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3445
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3446
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3447
	    pIlc->ilc_func = __SEND0ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3448
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3449
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3450
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3451
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3452
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3453
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3454
	}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3455
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3456
	pIlc = &ilc_0;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3457
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3458
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3459
%}
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3460
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3461
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3462
perform:aSelector inClass:aClass withArguments:argArray
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3463
    "send the message aSelector with all args taken from argArray 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3464
     to the receiver as a super-send message.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3465
     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
  3466
     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
  3467
     immediate superclass).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3468
     Thus, it is (theoretically) possible to do 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3469
	 '5 perform:#< inClass:Magnitude withArguments:#(6)'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3470
     and evaluate Magnitudes compare method even if there was one in Number.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3471
     This method is used by the interpreter to evaluate super sends
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3472
     and could be used for very special behavior (language extension ?).
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3473
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3474
     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
  3475
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3476
    |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
  3477
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3478
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3479
     check, if aClass is really a superclass of the receiver
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3480
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3481
    (self class isSubclassOf:aClass) ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3482
	self error:'class argument is not a superclass of the receiver'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3483
	^ nil
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3484
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3485
    numberOfArgs := argArray size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3486
%{
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3487
    REGISTER OBJ *argP;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3488
    int nargs, i;
1818
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3489
    static struct inlineCache ilc0 = _DUMMYILCSELF0;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3490
    static struct inlineCache ilc1 = _DUMMYILCSELF1;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3491
    static struct inlineCache ilc2 = _DUMMYILCSELF2;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3492
    static struct inlineCache ilc3 = _DUMMYILCSELF3;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3493
    static struct inlineCache ilc4 = _DUMMYILCSELF4;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3494
    static struct inlineCache ilc5 = _DUMMYILCSELF5;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3495
    static struct inlineCache ilc6 = _DUMMYILCSELF6;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3496
    static struct inlineCache ilc7 = _DUMMYILCSELF7;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3497
    static struct inlineCache ilc8 = _DUMMYILCSELF8;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3498
    static struct inlineCache ilc9 = _DUMMYILCSELF9;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3499
    static struct inlineCache ilc10 = _DUMMYILCSELF10;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3500
    static struct inlineCache ilc11 = _DUMMYILCSELF11;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3501
    static struct inlineCache ilc12 = _DUMMYILCSELF12;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3502
    static struct inlineCache ilc13 = _DUMMYILCSELF13;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3503
    static struct inlineCache ilc14 = _DUMMYILCSELF14;
384851e6fa7e performs must be treated like self-sends,
Claus Gittinger <cg@exept.de>
parents: 1792
diff changeset
  3504
    static struct inlineCache ilc15 = _DUMMYILCSELF15;
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3505
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3506
    if (__isSmallInteger(numberOfArgs)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3507
	nargs = __intVal(numberOfArgs);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3508
	if (nargs == 0) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3509
	    RETURN (_SEND0(self, aSelector, aClass, &ilc0));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3510
	}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3511
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3512
	argP = (OBJ *)(&a1);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3513
	if (__Class(argArray) == @global(Array)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3514
	    for (i=0; i < nargs; i++) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3515
		*argP++ = __ArrayInstPtr(argArray)->a_element[i];
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3516
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3517
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3518
	    for (i=1; i <= nargs; i++) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3519
		*argP++ = __AT_(argArray, __MKSMALLINT(i));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3520
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3521
	}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3522
	switch (nargs) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3523
	    case 1: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3524
		RETURN ( _SEND1(self, aSelector, aClass, &ilc1, a1));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3525
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3526
	    case 2: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3527
		RETURN ( _SEND2(self, aSelector, aClass, &ilc2, a1, a2));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3528
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3529
	    case 3: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3530
		RETURN ( _SEND3(self, aSelector, aClass, &ilc3, a1, a2, a3));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3531
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3532
	    case 4: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3533
		RETURN ( _SEND4(self, aSelector, aClass, &ilc4, a1, a2, a3, a4));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3534
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3535
	    case 5: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3536
		RETURN ( _SEND5(self, aSelector, aClass, &ilc5, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3537
				a1, a2, a3, a4, a5));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3538
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3539
	    case 6: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3540
		RETURN ( _SEND6(self, aSelector, aClass, &ilc6, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3541
				a1, a2, a3, a4, a5, a6));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3542
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3543
	    case 7: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3544
		RETURN ( _SEND7(self, aSelector, aClass, &ilc7, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3545
				a1, a2, a3, a4, a5, a6, a7));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3546
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3547
	    case 8: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3548
		RETURN ( _SEND8(self, aSelector, aClass, &ilc8, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3549
				a1, a2, a3, a4, a5, a6, a7, a8));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3550
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3551
	    case 9: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3552
		RETURN ( _SEND9(self, aSelector, aClass, &ilc9, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3553
				a1, a2, a3, a4, a5, a6, a7, a8, a9));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3554
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3555
	    case 10: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3556
		RETURN ( _SEND10(self, aSelector, aClass, &ilc10, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3557
				 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3558
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3559
	    case 11: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3560
		RETURN ( _SEND11(self, aSelector, aClass, &ilc11, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3561
				 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3562
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3563
	    case 12: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3564
		RETURN ( _SEND12(self, aSelector, aClass, &ilc12, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3565
				 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3566
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3567
	    case 13: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3568
		RETURN ( _SEND13(self, aSelector, aClass, &ilc13, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3569
				 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3570
				 a13));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3571
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3572
	    case 14: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3573
		RETURN ( _SEND14(self, aSelector, aClass, &ilc14, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3574
				 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3575
				 a13, a14));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3576
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3577
	    case 15: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3578
		RETURN ( _SEND15(self, aSelector, aClass, &ilc15, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3579
				 a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12,
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3580
				 a13, a14, a15));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3581
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3582
    }
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3583
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3584
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3585
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  3586
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3587
    ^ self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3588
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  3589
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3590
perform:aSelector with:anObject
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3591
    "send the one-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3592
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3593
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3594
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3595
    static struct inlineCache ilc_0 = __ILCPERF1(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3596
    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
  3597
    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
  3598
    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
  3599
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3600
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3601
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3602
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3603
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3604
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3605
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3606
		last_0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3607
	    } else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3608
		pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3609
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3610
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3611
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3612
	    pIlc->ilc_func = __SEND1ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3613
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3614
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3615
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3616
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3617
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3618
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3619
	}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3620
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3621
	pIlc = &ilc_0;
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3622
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3623
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, anObject) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3624
%}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3625
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3626
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3627
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3628
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
  3629
    "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
  3630
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3631
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3632
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3633
    static struct inlineCache ilc_0 = __ILCPERF2(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3634
    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
  3635
    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
  3636
    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
  3637
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3638
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3639
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3640
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3641
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3642
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3643
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3644
		last_0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3645
	    } else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3646
		pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3647
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3648
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3649
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3650
	    pIlc->ilc_func = __SEND2ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3651
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3652
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3653
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3654
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3655
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3656
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3657
	}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3658
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3659
	pIlc = &ilc_0;
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3660
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3661
    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
  3662
%}
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3663
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3664
!
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3665
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3666
perform:aSelector with:arg1 with:arg2 with:arg3
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3667
    "send the three-arg-message aSelector to the receiver"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3668
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3669
%{
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3670
    struct inlineCache *pIlc;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3671
    static struct inlineCache ilc_0 = __ILCPERF3(0);
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3672
    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
  3673
    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
  3674
    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
  3675
    static flip = 0;
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3676
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3677
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3678
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3679
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3680
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3681
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3682
		last_0 = aSelector;
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
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3686
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3687
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3688
	    pIlc->ilc_func = __SEND3ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3689
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3690
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3691
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3692
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3693
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3694
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3695
	}
1533
179ce527e383 added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents: 1528
diff changeset
  3696
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3697
	pIlc = &ilc_0;
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3698
    }
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  3699
    RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2, arg3) );
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3700
%}
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3701
!
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3702
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3703
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
  3704
    "send the four-arg-message aSelector to the receiver"
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3705
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3706
%{
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3707
    struct inlineCache *pIlc;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3708
    static struct inlineCache ilc_0 = __ILCPERF4(0);
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3709
    static struct inlineCache ilc_1 = __ILCPERF4(0);
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3710
    static OBJ last_0 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3711
    static OBJ last_1 = nil;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3712
    static flip = 0;
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3713
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3714
    if (aSelector != last_0) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3715
	if (aSelector != last_1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3716
	    if (flip) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3717
		pIlc = &ilc_0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3718
		flip = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3719
		last_0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3720
	    } else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3721
		pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3722
		flip = 1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3723
		last_1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3724
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3725
	    pIlc->ilc_func = __SEND4ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3726
	    if (pIlc->ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3727
		__flushPolyCache(pIlc->ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3728
		pIlc->ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3729
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3730
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3731
	    pIlc = &ilc_1;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3732
	}
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3733
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3734
	pIlc = &ilc_0;
2437
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3735
    }
63905fb8d89e added perform with 4 args
Claus Gittinger <cg@exept.de>
parents: 2412
diff changeset
  3736
    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
  3737
%}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3738
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3739
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3740
perform:aSelector withArguments:argArray
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3741
    "send the message aSelector with all args taken from argArray 
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3742
     to the receiver."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3743
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  3744
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3745
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3746
    numberOfArgs := argArray size.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3747
%{
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3748
    REGISTER OBJ *argP;
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3749
    int nargs, i;
1820
f56384710f2e need another ILC-type: ILCPERF.
Claus Gittinger <cg@exept.de>
parents: 1818
diff changeset
  3750
    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
  3751
    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
  3752
    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
  3753
    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
  3754
    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
  3755
    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
  3756
    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
  3757
    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
  3758
    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
  3759
    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
  3760
    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
  3761
    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
  3762
    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
  3763
    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
  3764
    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
  3765
    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
  3766
    OBJ l;
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3767
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3768
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3769
    /*
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  3770
     * must set lineno in sender by hand here ... (because of NOCONTEXT)
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3771
     */
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3772
    if ((l = __ILC_LNO_AS_OBJ(__pilc)) != __MKSMALLINT(0)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3773
	_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
  3774
    }
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3775
#endif
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3776
253
30daee717a53 *** empty log message ***
claus
parents: 228
diff changeset
  3777
    if (__isSmallInteger(numberOfArgs)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3778
	nargs = __intVal(numberOfArgs);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3779
	if (nargs == 0) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3780
	    if (aSelector != last0) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3781
		ilc0.ilc_func = __SEND0ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3782
		if (ilc0.ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3783
		    __flushPolyCache(ilc0.ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3784
		    ilc0.ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3785
		}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3786
		last0 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3787
	    }
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3788
#ifdef xxTHIS_CONTEXT  /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3789
	    ilc0.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3790
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3791
	    RETURN ((*ilc0.ilc_func)(self, aSelector, nil, &ilc0));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3792
	}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3793
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3794
	if (__isArray(argArray)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3795
	    argP = __ArrayInstPtr(argArray)->a_element;
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
	    argP = (OBJ *)(&a1);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3798
	    for (i=1; i <= nargs; i++) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3799
		*argP++ = __AT_(argArray, __MKSMALLINT(i));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3800
	    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3801
	}
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3802
	switch (nargs) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3803
	    case 1: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3804
		if (aSelector != last1) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3805
		    ilc1.ilc_func = __SEND1ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3806
		    if (ilc1.ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3807
			__flushPolyCache(ilc1.ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3808
			ilc1.ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3809
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3810
		    last1 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3811
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3812
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3813
		ilc1.ilc_lineNo = __pilc->ilc_lineNo;
44
b262907c93ea *** empty log message ***
claus
parents: 39
diff changeset
  3814
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3815
		RETURN ( (*ilc1.ilc_func)(self, aSelector, nil, &ilc1, argP[0]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3816
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3817
	    case 2: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3818
		if (aSelector != last2) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3819
		    ilc2.ilc_func = __SEND2ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3820
		    if (ilc2.ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3821
			__flushPolyCache(ilc2.ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3822
			ilc2.ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3823
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3824
		    last2 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3825
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3826
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3827
		ilc2.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3828
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3829
		RETURN ( (*ilc2.ilc_func)(self, aSelector, nil, &ilc2, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3830
						argP[0], argP[1]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3831
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3832
	    case 3: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3833
		if (aSelector != last3) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3834
		    ilc3.ilc_func = __SEND3ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3835
		    if (ilc3.ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3836
			__flushPolyCache(ilc3.ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3837
			ilc3.ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3838
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3839
		    last3 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3840
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3841
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3842
		ilc3.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3843
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3844
		RETURN ( (*ilc3.ilc_func)(self, aSelector, nil, &ilc3, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3845
						argP[0], argP[1], argP[2]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3846
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3847
	    case 4: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3848
		if (aSelector != last4) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3849
		    ilc4.ilc_func = __SEND4ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3850
		    if (ilc4.ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3851
			__flushPolyCache(ilc4.ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3852
			ilc4.ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3853
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3854
		    last4 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3855
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3856
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3857
		ilc4.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3858
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3859
		RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3860
						argP[0], argP[1], argP[2], argP[3]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3861
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3862
	    case 5: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3863
		if (aSelector != last5) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3864
		    ilc5.ilc_func = __SEND5ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3865
		    if (ilc5.ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3866
			__flushPolyCache(ilc5.ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3867
			ilc5.ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3868
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3869
		    last5 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
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 */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3872
		ilc5.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3873
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3874
		RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3875
						argP[0], argP[1], argP[2], argP[3], argP[4]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3876
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3877
	    case 6: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3878
		if (aSelector != last6) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3879
		    ilc6.ilc_func = __SEND6ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3880
		    if (ilc6.ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3881
			__flushPolyCache(ilc6.ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3882
			ilc6.ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3883
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3884
		    last6 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3885
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3886
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3887
		ilc6.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3888
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3889
		RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3890
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3891
						argP[5]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3892
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3893
	    case 7: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3894
		if (aSelector != last7) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3895
		    ilc7.ilc_func = __SEND7ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3896
		    if (ilc7.ilc_poly) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3897
			__flushPolyCache(ilc7.ilc_poly);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3898
			ilc7.ilc_poly = 0;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3899
		    }
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3900
		    last7 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3901
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3902
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3903
		ilc7.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3904
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3905
		RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3906
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3907
						argP[5], argP[6]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3908
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3909
	    case 8:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3910
		if (aSelector != last8) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3911
		    ilc8.ilc_func = __SEND8ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3912
		    last8 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
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 */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3915
		ilc8.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3916
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3917
		RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3918
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3919
						argP[5], argP[6], argP[7]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3920
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3921
	    case 9: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3922
		if (aSelector != last9) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3923
		    ilc9.ilc_func = __SEND9ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3924
		    last9 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3925
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3926
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3927
		ilc9.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3928
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3929
		RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3930
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3931
						argP[5], argP[6], argP[7], argP[8]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3932
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3933
	    case 10: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3934
		if (aSelector != last10) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3935
		    ilc10.ilc_func = __SEND10ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3936
		    last10 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3937
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3938
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3939
		ilc10.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3940
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3941
		RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3942
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3943
						argP[5], argP[6], argP[7], argP[8], argP[9]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3944
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3945
	    case 11: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3946
		if (aSelector != last11) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3947
		    ilc11.ilc_func = __SEND11ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3948
		    last11 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3949
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3950
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3951
		ilc11.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3952
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3953
		RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3954
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3955
						argP[5], argP[6], argP[7], argP[8], argP[9],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3956
						argP[10]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3957
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3958
	    case 12: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3959
		if (aSelector != last12) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3960
		    ilc12.ilc_func = __SEND12ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3961
		    last12 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3962
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3963
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3964
		ilc12.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3965
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3966
		RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3967
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3968
						argP[5], argP[6], argP[7], argP[8], argP[9],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3969
						argP[10], argP[11]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3970
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3971
	    case 13: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3972
		if (aSelector != last13) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3973
		    ilc13.ilc_func = __SEND13ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3974
		    last13 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3975
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3976
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3977
		ilc13.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3978
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3979
		RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3980
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3981
						argP[5], argP[6], argP[7], argP[8], argP[9],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3982
						argP[10], argP[11], argP[12]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3983
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3984
	    case 14: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3985
		if (aSelector != last14) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3986
		    ilc14.ilc_func = __SEND14ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3987
		    last14 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3988
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  3989
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3990
		ilc14.ilc_lineNo = __pilc->ilc_lineNo;
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  3991
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3992
		RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3993
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3994
						argP[5], argP[6], argP[7], argP[8], argP[9],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3995
						argP[10], argP[11], argP[12], argP[13]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3996
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3997
	    case 15: 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3998
		if (aSelector != last15) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  3999
		    ilc15.ilc_func = __SEND15ADDR__;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4000
		    last15 = aSelector;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4001
		}
1085
3f5ae1995e83 fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents: 1078
diff changeset
  4002
#ifdef xxTHIS_CONTEXT /* not because this has a context */
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4003
		ilc15.ilc_lineNo = __pilc->ilc_lineNo;
77
6c38ca59927f *** empty log message ***
claus
parents: 71
diff changeset
  4004
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4005
		RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4006
						argP[0], argP[1], argP[2], argP[3], argP[4],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4007
						argP[5], argP[6], argP[7], argP[8], argP[9],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4008
						argP[10], argP[11], argP[12], argP[13],
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4009
						argP[14]));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4010
	}
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4011
    }
1626
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4012
%}.
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4013
    "/ arrive here, if bad number of arguments (too many)
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4014
    "/ ST/X (currently) only allows up to 15 method arguments
b3b69b572627 comments
Claus Gittinger <cg@exept.de>
parents: 1624
diff changeset
  4015
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4016
    ^ self primitiveFailed
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4017
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4018
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4019
!Object methodsFor:'misc'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4020
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4021
-> anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4022
    "return an association with the receiver as key and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4023
     the argument as value"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4024
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4025
    ^ Association key:self value:anObject
2
claus
parents: 1
diff changeset
  4026
! !
claus
parents: 1
diff changeset
  4027
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4028
!Object methodsFor:'printing & storing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4029
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4030
className
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4031
    "return the classname of the receivers class"
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4032
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4033
    ^ self class name
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4034
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4035
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4036
     1 className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4037
     1 class className   'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4038
     $a className
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4039
     $a class className  'this may change ...'
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4040
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4041
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4042
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4043
classNameWithArticle
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4044
    "return a string consisting of classname preceeded by an article.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4045
     (dont expect me to write national variants for this ... :-)
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4046
     If you have special preferences, redefine it ..."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4047
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4048
    |classname cls|
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4049
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4050
    (cls := self class) == self ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4051
	^ 'a funny object'
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4052
    ].
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4053
    classname := cls displayString.
85
claus
parents: 77
diff changeset
  4054
    ^ classname article , ' ' , classname
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4055
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4056
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4057
     1 classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4058
     (1->2) classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4059
     XWorkstation basicNew classNameWithArticle
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4060
    "
1391
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4061
c2e4f3ee163c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1386
diff changeset
  4062
    "Modified: 13.5.1996 / 12:16:14 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4063
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4064
1445
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4065
displayOn:aGc
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4066
    "ST-80 Compatibility
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4067
     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
  4068
     - 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
  4069
     (although the fallBack is to display its printString ...)"
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4070
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4071
    ^ self displayOn:aGc x:0 y:0.
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4072
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4073
    "Created: 29.5.1996 / 16:28:58 / cg"
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4074
!
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4075
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4076
displayOn:aGc at:aPoint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4077
    "ST-80 Compatibility
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4078
     display the receiver in a graphicsContext - this method allows
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4079
     for any object to be displayed in a ListView - for example."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4080
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4081
    ^ self displayOn:aGc x:(aPoint x) y:(aPoint y).
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4082
!
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4083
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4084
displayOn:aGc x:x y:y
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4085
    "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
  4086
     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
  4087
     The fallBack here shows the receivers printString."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4088
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4089
    ^ 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
  4090
c2dc94f9921b added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents: 1425
diff changeset
  4091
    "Modified: 29.5.1996 / 16:29:38 / cg"
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4092
!
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4093
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4094
displayString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4095
    "return a string used when displaying the receiver in a view;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4096
     for example an Inspector. This is usually the same as printString,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4097
     but sometimes redefined for a better look."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4098
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4099
    ^ self printString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4100
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4101
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4102
     #(1 2 3) printString    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4103
     #(1 2 3) displayString  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4104
     #(1 2 3) storeString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4105
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4106
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4107
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4108
errorPrint
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4109
    "print the receiver on the standard error stream."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4110
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4111
    Stream streamErrorSignal catch:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4112
	self printOn:Stderr
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4113
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4114
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4115
    "Modified: 7.3.1996 / 19:11:29 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4116
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4117
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4118
errorPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4119
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4120
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4121
    "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
  4122
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4123
    Stream streamErrorSignal catch:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4124
	self printOn:Stderr.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4125
	Stderr cr
1089
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4126
    ]
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4127
6df9414b354f catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents: 1085
diff changeset
  4128
    "Modified: 7.3.1996 / 19:13:01 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4129
    "Created: 20.5.1996 / 10:20:41 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4130
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4131
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4132
errorPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4133
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4134
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4135
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4136
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4137
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4138
    ^ self errorPrintCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4139
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4140
    "Modified: 20.5.1996 / 10:24:45 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4141
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4142
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4143
errorPrintNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4144
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4145
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4146
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4147
     Please use #errorPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4148
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4149
    self errorPrintCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4150
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4151
    "Modified: 20.5.1996 / 10:24:38 / cg"
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4152
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4153
356
claus
parents: 348
diff changeset
  4154
infoPrint
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4155
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4156
356
claus
parents: 348
diff changeset
  4157
    "print the receiver on the standard error stream.
claus
parents: 348
diff changeset
  4158
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  4159
     or fatal messages.
claus
parents: 348
diff changeset
  4160
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  4161
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4162
    InfoPrinting == true ifTrue:[
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4163
	self errorPrint
356
claus
parents: 348
diff changeset
  4164
    ]
claus
parents: 348
diff changeset
  4165
!
claus
parents: 348
diff changeset
  4166
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4167
infoPrintCR
1119
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4168
    "{ Pragma: +optSpace }"
956d62a5656c compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents: 1109
diff changeset
  4169
356
claus
parents: 348
diff changeset
  4170
    "print the receiver followed by a cr on the standard error stream.
claus
parents: 348
diff changeset
  4171
     This is meant for information messages which are not warnings
claus
parents: 348
diff changeset
  4172
     or fatal messages.
claus
parents: 348
diff changeset
  4173
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
claus
parents: 348
diff changeset
  4174
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4175
    InfoPrinting == true ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4176
	self errorPrintCR
356
claus
parents: 348
diff changeset
  4177
    ]
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4178
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4179
    "Created: 20.5.1996 / 10:21:28 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4180
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4181
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4182
infoPrintNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4183
    "{ Pragma: +optSpace }"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4184
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4185
    "print the receiver followed by a cr on the standard error stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4186
     This is meant for information messages which are not warnings
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4187
     or fatal messages.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4188
     These messages can be turned on/off by 'Object infoPrinting:true/false'.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4189
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4190
     Please use #infoPrintCR - this method exists for backward compatibility."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4191
2114
706cf3f9019a initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents: 2096
diff changeset
  4192
    ^ self infoPrintCR
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4193
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4194
    "Modified: 20.5.1996 / 10:25:07 / cg"
356
claus
parents: 348
diff changeset
  4195
!
claus
parents: 348
diff changeset
  4196
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4197
print
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4198
    "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
  4199
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4200
    self printOn:Stdout
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4201
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4202
    "Modified: 4.11.1996 / 23:36:58 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4203
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4204
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4205
printCR
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4206
    "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
  4207
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4208
    self printOn:Stdout.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4209
    Stdout cr
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4210
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4211
    "Created: 20.5.1996 / 10:21:37 / cg"
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  4212
    "Modified: 4.11.1996 / 23:37:06 / cg"
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4213
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4214
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4215
printNL
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4216
    "print the receiver followed by a cr on the standard output stream
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4217
     This exists for GNU Smalltalk compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4218
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4219
    ^ self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4220
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4221
    "Modified: 20.5.1996 / 10:25:31 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4222
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4223
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4224
printNewline
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4225
    "print the receiver followed by a cr on the standard output stream.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4226
     This exists for backward compatibility - please use #printCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4227
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4228
    self printCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4229
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4230
    "Modified: 20.5.1996 / 10:25:46 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4231
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4232
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4233
printOn:aStream
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4234
    "print the receiver on the argument-stream.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4235
     The default here is to output the receivers class name.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4236
     BUT: this method is heavily redefined for objects which
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4237
     can print prettier."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4238
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4239
    aStream nextPutAll:self classNameWithArticle
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4240
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4241
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4242
printOn:aStream leftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4243
    "print the receiver on aStream, padding with spaces up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4244
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4245
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4246
    self printOn:aStream leftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4247
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4248
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4249
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4250
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4251
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4252
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4253
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4254
printOn:aStream leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4255
    "print the receiver on aStream, padding with padCharacters up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4256
     padding is done on the left."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4257
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4258
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4259
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4260
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4261
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4262
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4263
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4264
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4265
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4266
printOn:aStream paddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4267
    "print the receiver on aStream, padding with spaces up to size."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4268
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4269
    self printOn:aStream paddedTo:size with:(Character space)
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4272
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4273
    "
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4274
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4275
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4276
printOn:aStream paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4277
    "print the receiver on aStream, padding with padCharacter up to size"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4278
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4279
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4282
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4283
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4284
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4285
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4286
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4287
printOn:aStream zeroPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4288
    "print the receiver on aStream, padding with zeros up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4289
     Usually used with float numbers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4290
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4291
    self printOn:aStream paddedTo:size with:$0.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4292
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4293
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4294
     123.0 printOn:Transcript zeroPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4295
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4296
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4297
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4298
printRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4299
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4300
     This method will go away ..."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4301
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4302
    (self printStringLeftPaddedTo:size) printOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4303
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4304
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4305
printString
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4306
    "return a string for printing the receiver.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4307
     Since we now use printOn: as the basic print mechanism,
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4308
     we have to create a stream and print into it."
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4309
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4310
    |s|
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4311
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4312
    s := WriteStream on:(String new:30).
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4313
    self printOn:s.
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4314
    ^ s contents
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4315
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4316
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4317
printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4318
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4319
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4320
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4321
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4322
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4323
    ^ self printStringLeftPaddedTo:size with:(Character space)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4324
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4325
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4326
     10 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4327
     1 printStringLeftPaddedTo:10
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4328
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4329
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4330
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4331
printStringLeftPaddedTo:size ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4332
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4333
     characters on the left are filled with spaces.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4334
     If the printString is larger than size,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4335
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4336
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4337
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4338
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4339
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4340
     12   printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4341
     123  printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4342
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4343
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4344
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4345
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4346
printStringLeftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4347
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4348
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4349
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4350
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4351
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4352
    ^ (self printString) leftPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4353
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4354
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4355
     123 printStringLeftPaddedTo:10 with:$.   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4356
     1 printStringLeftPaddedTo:10 with:$.      
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4357
     (Float pi) printStringLeftPaddedTo:20 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4358
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4359
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4360
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4361
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4362
    "return my printString as a right-adjusted string of length size;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4363
     characters on the left are filled with padCharacter.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4364
     If the printString is larger than size,
369
claus
parents: 362
diff changeset
  4365
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  4366
claus
parents: 362
diff changeset
  4367
    |s|
claus
parents: 362
diff changeset
  4368
claus
parents: 362
diff changeset
  4369
    s := self printString.
claus
parents: 362
diff changeset
  4370
    s size > size ifTrue:[^ alternative value].
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4371
    ^ s leftPaddedTo:size with:padCharacter
369
claus
parents: 362
diff changeset
  4372
claus
parents: 362
diff changeset
  4373
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4374
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4375
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4376
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4377
    "
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4378
!
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4379
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4380
printStringPaddedTo:size
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4381
    "return a printed representation of the receiver,
369
claus
parents: 362
diff changeset
  4382
     padded with spaces (at the right) up to size.
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4383
     If the printString is longer than size, 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4384
     it is returned unchanged (i.e. not truncated)"
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4385
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4386
    ^ self printStringPaddedTo:size with:(Character space)
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4387
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4388
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4389
     123 printStringPaddedTo:10    
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4390
     1234567890123456 printStringPaddedTo:10  
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4391
     'hello' printStringPaddedTo:10   
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4392
    "
2
claus
parents: 1
diff changeset
  4393
!
claus
parents: 1
diff changeset
  4394
369
claus
parents: 362
diff changeset
  4395
printStringPaddedTo:size ifLarger:alternative
claus
parents: 362
diff changeset
  4396
    "return a printed representation of the receiver,
claus
parents: 362
diff changeset
  4397
     padded with spaces (at the right) up to size.
claus
parents: 362
diff changeset
  4398
     If the resulting printString is too large, 
claus
parents: 362
diff changeset
  4399
     return the result from evaluating alternative."
claus
parents: 362
diff changeset
  4400
claus
parents: 362
diff changeset
  4401
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
claus
parents: 362
diff changeset
  4402
claus
parents: 362
diff changeset
  4403
    "
claus
parents: 362
diff changeset
  4404
     12   printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4405
     123  printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4406
     1234 printStringPaddedTo:3 ifLarger:['***']   
claus
parents: 362
diff changeset
  4407
    "
claus
parents: 362
diff changeset
  4408
!
claus
parents: 362
diff changeset
  4409
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4410
printStringPaddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4411
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4412
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4413
     If the printString is longer than size, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4414
     it is returned unchanged (i.e. not truncated)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4415
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4416
    ^ (self printString) paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4417
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4418
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4419
     123  printStringPaddedTo:10 with:$.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4420
     123  printStringPaddedTo:10 with:$*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4421
     123  printStringPaddedTo:3 with:$*   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4422
     1234 printStringPaddedTo:3 with:$*   
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
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4425
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4426
printStringPaddedTo:size with:padCharacter ifLarger:alternative
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4427
    "return a printed representation of the receiver,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4428
     padded with padCharacter (at the right) up to size.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4429
     If the resulting printString is too large, 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4430
     return the result from evaluating alternative."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4431
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4432
    |s|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4433
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4434
    s := self printString.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4435
    s size > size ifTrue:[^ alternative value].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4436
    ^ s paddedTo:size with:padCharacter
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4437
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4438
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4439
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4440
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4444
printStringRightAdjustLen:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4445
    "obsolete - just a name confusion.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4446
     This method will go away ..."
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
    ^ self printStringLeftPaddedTo:size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4449
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4450
2
claus
parents: 1
diff changeset
  4451
printStringZeroPaddedTo:size
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4452
    "return a printed representation of the receiver, 
369
claus
parents: 362
diff changeset
  4453
     padded with zero (at the right) characters up to size.
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4454
     Usually used with float numbers."
2
claus
parents: 1
diff changeset
  4455
claus
parents: 1
diff changeset
  4456
    ^ self printStringPaddedTo:size with:$0
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  4457
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4458
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4459
     123.0 printStringZeroPaddedTo:10 
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4460
    "
2
claus
parents: 1
diff changeset
  4461
!
claus
parents: 1
diff changeset
  4462
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4463
store
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4464
    "store the receiver on standard output.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4465
     this method is useless, but included for compatibility."
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
    self storeOn:Stdout
71
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4468
!
a42874820e27 *** empty log message ***
claus
parents: 56
diff changeset
  4469
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4470
storeCR
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4471
    "store the receiver on standard output; append a carriage return."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4472
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4473
    self store.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4474
    Character cr print
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4475
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4476
    "Created: 20.5.1996 / 10:26:01 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4477
    "Modified: 20.5.1996 / 10:26:57 / cg"
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4478
!
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4479
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4480
storeNl
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4481
    "store the receiver on standard output; append a newline.
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4482
     This method is included for backward compatibility-  use #storeCR."
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4483
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4484
    self storeCR.
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4485
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  4486
    "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
  4487
!
7e058858cc3b New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents: 446
diff changeset
  4488
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4489
storeOn:aStream
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4490
    "store the receiver on aStream; i.e. print an expression which will
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4491
     reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4492
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4493
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4494
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4495
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4496
    |myClass hasSemi sz "{ Class: SmallInteger }" |
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4497
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  4498
    thisContext isRecursive ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4499
	('Object [error]: storeString of self referencing object.') errorPrintCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4500
	aStream nextPutAll:'#("recursive")'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4501
	^ self
25
e34a6267c79b *** empty log message ***
claus
parents: 13
diff changeset
  4502
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4503
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4504
    myClass := self class.
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4505
    aStream nextPut:$(.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4506
    aStream nextPutAll:self class name.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4507
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4508
    hasSemi := false.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4509
    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4510
	aStream nextPutAll:' basicNew:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4511
	self basicSize printOn:aStream
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4512
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4513
	aStream nextPutAll:' basicNew'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4514
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4515
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4516
    sz := myClass instSize.
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4517
    1 to:sz do:[:i | 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4518
	aStream nextPutAll:' instVarAt:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4519
	i printOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4520
	aStream nextPutAll:' put:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4521
	(self instVarAt:i) storeOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4522
	aStream nextPut:$;.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4523
	hasSemi := true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4524
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4525
    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4526
	sz := self basicSize.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4527
	1 to:sz do:[:i | 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4528
	    aStream nextPutAll:' basicAt:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4529
	    i printOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4530
	    aStream nextPutAll:' put:'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4531
	    (self basicAt:i) storeOn:aStream.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4532
	    aStream nextPut:$;.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4533
	    hasSemi := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4534
	]
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4535
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4536
    hasSemi ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4537
	aStream nextPutAll:' yourself'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4538
    ].
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4539
    aStream nextPut:$).
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4540
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4541
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4542
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4543
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4544
     s := WriteStream on:(String new).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4545
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4546
     s := ReadStream on:(s contents).
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4547
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4548
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4549
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4550
     |s|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4551
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4552
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4553
     ('hello' -> 'world') storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4554
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4555
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4556
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4557
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4558
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4559
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4560
    "does not work example:"
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4561
    "
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4562
     |s a|
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4563
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4564
     a := Array new:2.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4565
     a at:1 put:a.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4566
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4567
     s := 'data' asFilename writeStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4568
     a storeOn:s.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4569
     s close.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4570
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4571
     s := 'data' asFilename readStream.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4572
     (Object readFrom:s) inspect
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4573
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  4574
2287
3d5330d2b368 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2231
diff changeset
  4575
    "Modified: 28.1.1997 / 00:36:12 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4576
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4577
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4578
storeString
293
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4579
    "return a string representing an expression to reconstruct the receiver.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4580
     Notice, that no self referencing or cyclic objects can be represented
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4581
     in this format.
31df3850e98c *** empty log message ***
claus
parents: 283
diff changeset
  4582
     Use storeBinaryOn:, which handles these cases correctly."
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4583
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4584
    |s|
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4585
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4586
    s := WriteStream on:(String new:50).
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4587
    self storeOn:s.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  4588
    ^ s contents
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4589
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4590
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4591
!Object methodsFor:'queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4592
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4593
basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4594
    "return the number of the receivers indexed instance variables,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4595
     0 if it has none.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4596
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  4597
     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
  4598
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4599
%{  /* NOCONTEXT */
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
    REGISTER int nbytes;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4602
    REGISTER OBJ myClass;
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4603
    REGISTER INT flags;
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4604
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
     * notice the missing test for self being a nonNilObject -
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4607
     * this can be done since basicSize is defined both in UndefinedObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4608
     * and SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4609
     */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4610
    myClass = __qClass(self);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4611
    nbytes = __qSize(self) 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4612
	      - OHDR_SIZE 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4613
	      - __OBJS2BYTES__(__intVal(__ClassInstPtr(myClass)->c_ninstvars));
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  4614
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4615
    flags = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK);
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4616
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4617
     * replaced switch by open-if; this is slightly faster since
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4618
     * 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
  4619
     */
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4620
    if (flags == __MASKSMALLINT(POINTERARRAY)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4621
	RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4622
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4623
    if (flags == __MASKSMALLINT(BYTEARRAY)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4624
	    RETURN ( __MKSMALLINT(nbytes / sizeof(char)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4625
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4626
    if (flags == __MASKSMALLINT(WKPOINTERARRAY)) {
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4627
	RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4628
    }
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4629
    if (flags == __MASKSMALLINT(FLOATARRAY)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4630
	RETURN ( __MKSMALLINT(nbytes / sizeof(float)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4631
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4632
    if (flags == __MASKSMALLINT(DOUBLEARRAY)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4633
#ifdef NEED_DOUBLE_ALIGN
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4634
	    /*
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4635
	     * care for filler
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4636
	     */
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4637
	    nbytes -= sizeof(FILLTYPE);
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4638
#endif
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4639
	    RETURN ( __MKSMALLINT(nbytes / sizeof(double)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4640
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4641
    if ((flags == __MASKSMALLINT(WORDARRAY)) || (flags == __MASKSMALLINT(SWORDARRAY))) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4642
	RETURN ( __MKSMALLINT(nbytes / sizeof(short)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4643
    }
2209
6ddff479f0ea slightly better basicSize
Claus Gittinger <cg@exept.de>
parents: 2203
diff changeset
  4644
    if ((flags == __MASKSMALLINT(LONGARRAY)) || (flags == __MASKSMALLINT(SLONGARRAY))) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4645
	RETURN ( __MKSMALLINT(nbytes / sizeof(long)) );
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4646
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4647
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4648
    ^ 0
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4649
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4650
2575
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4651
byteSize
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4652
    "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
  4653
     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
  4654
     instvars i.e. byteArrays, wordArrays etc.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4655
     Notice: for Strings the returned size may look strange.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4656
     Only useful with binary storage."
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4657
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4658
%{  /* NOCONTEXT */
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4659
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4660
    REGISTER int indx;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4661
    int nIndex;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4662
    REGISTER OBJ slf;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4663
    REGISTER OBJ cls;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4664
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4665
    slf = self;
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4666
    if (__isNonNilObject(slf)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4667
	cls = __qClass(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4668
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4669
	switch (__intVal(__ClassInstPtr(cls)->c_flags) & ARRAYMASK) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4670
	    case BYTEARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4671
	    case WORDARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4672
	    case LONGARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4673
	    case SWORDARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4674
	    case SLONGARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4675
	    case FLOATARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4676
	    case DOUBLEARRAY:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4677
		    nIndex = __byteArraySize(slf);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4678
		    nIndex -= __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4679
		    RETURN ( __MKSMALLINT(nIndex) );
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4680
	}
2575
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4681
    }
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4682
%}.
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4683
    ^ 0
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4684
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4685
    "
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4686
     Point new byteSize   
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4687
     'hello' byteSize     
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4688
     (ByteArray with:1 with:2) byteSize 
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4689
     (FloatArray with:1.5) byteSize    
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4690
    "
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4691
!
797f7408e03c added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents: 2574
diff changeset
  4692
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4693
class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4694
    "return the receivers class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4695
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4696
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4697
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4698
    RETURN ( __Class(self) );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4699
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4700
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4701
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4702
respondsTo:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4703
    "return true, if the receiver implements a method with selector equal
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4704
     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
  4705
     receivers class or one of its superclasses.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4706
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4707
     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
  4708
     an error being raised. For example, an implementation could send
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4709
     #shouldNotImplement or #subclassResponsibility."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4710
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4711
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4712
     should we go via the cache, or search (by class) ?
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4713
     The first is faster, most of the time; while the 2nd fills
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4714
     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
  4715
     For now, use the cache ...
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4716
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4717
%{  /* NOCONTEXT */
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4718
829
fc386319f41c removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
  4719
    if (__lookup(__Class(self), aSelector) == nil) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4720
	RETURN ( false );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4721
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4722
    RETURN ( true );
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4723
%}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4724
.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4725
"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4726
    ^ self class canUnderstand:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4727
"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4728
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4729
    "'aString' respondsTo:#+"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4730
    "'aString' respondsTo:#,"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4731
    "'aString' respondsTo:#collect:"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4732
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4733
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4734
respondsToArithmetic
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4735
    "return true, if the receiver responds to arithmetic messages.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4736
     false is returned here - the method is redefined in ArithmeticValue."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4737
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4738
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4739
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4740
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4741
size
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4742
    "return the number of the receivers indexed instance variables;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4743
     this method may be redefined in subclasses"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4744
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4745
    ^ self basicSize
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4746
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4747
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4748
species
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4749
    "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
  4750
     This is used to create an appropriate object when creating derived
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4751
     copies in the collection classes (sometimes redefined)."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4752
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4753
    ^ self class
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4754
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4755
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4756
yourself
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4757
    "return the receiver - used for cascades to return self at the end"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4758
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4759
    ^ self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4760
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4761
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4762
!Object methodsFor:'secure message sending'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4763
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4764
askFor:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4765
    "try to send the receiver the message, aSelector.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4766
     If it does not understand it, return false. Otherwise
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4767
     the real value returned.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4768
     Useful to send messages such as: 'isColor' to unknown
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4769
     receivers."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4770
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4771
    ^ self perform:aSelector ifNotUnderstood:[false]
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4774
     1 askFor:#isColor
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4775
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4776
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4777
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4778
perform:aSelector ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4779
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4780
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4781
     otherwise return the value of the exceptionBlock"
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
    |val|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4784
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4785
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4786
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4787
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4788
	val := self perform:aSelector
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4789
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4790
    ^ val
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4793
     1.2345 perform:#foo ifNotUnderstood:['sorry'] 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4794
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4795
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4796
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4797
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4798
    "try to send message aSelector to the receiver.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4799
     If its understood, return the methods returned value,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4800
     otherwise return the value of the exceptionBlock"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4801
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4802
    |val|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4803
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4804
    MessageNotUnderstoodSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4805
	^ exceptionBlock value
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4806
    ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4807
	val := self perform:aSelector with:argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4808
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4809
    ^ val
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4810
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4811
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4812
     |unknown|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4813
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4814
     unknown := 1.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4815
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4816
     unknown := 'high there'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4817
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4818
    "
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4819
!
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4820
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4821
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4822
    "try to send message aSelector to the receiver.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4823
     If its understood, return the methods returned value,
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4824
     otherwise return the value of the exceptionBlock"
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4825
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4826
    |val|
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4827
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4828
    MessageNotUnderstoodSignal handle:[:ex |
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4829
	^ exceptionBlock value
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4830
    ] do:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4831
	val := self perform:aSelector withArguments:argumentArray
2506
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4832
    ].
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4833
    ^ val
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4834
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4835
    "
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4836
     |unknown|
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4837
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4838
     unknown := 1.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4839
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4840
     unknown := 'high there'.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4841
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4842
    "
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4843
255c87b6fb4f added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents: 2505
diff changeset
  4844
    "Modified: 27.3.1997 / 14:13:16 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4845
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4846
2448
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4847
!Object methodsFor:'signal constants'!
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4848
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4849
messageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4850
    ^ MessageNotUnderstoodSignal
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4851
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4852
    "Created: 6.3.1997 / 15:46:52 / cg"
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4853
! !
ab70ff46b982 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4854
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4855
!Object methodsFor:'special queries'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4856
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4857
allOwners
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4858
    "return a collection of all objects referencing the receiver"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4859
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4860
    ^ ObjectMemory whoReferences:self
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4861
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4862
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4863
references:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4864
    "return true, if the receiver refers to the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4865
     - for debugging only"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4866
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4867
"/    |myClass 
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4868
"/     numInst "{ Class: SmallInteger }" |
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4869
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4870
%{  /* NOCONTEXT */
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4871
    OBJ cls, flags;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4872
    int nInsts, i;
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4873
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4874
    if (! __isNonNilObject(self)) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4875
	RETURN (false);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4876
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4877
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4878
    /*
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4879
     * a little optimization: use the fact that all old objects
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4880
     * 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
  4881
     * a trivial reject is possible, if anObject is a newbee
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4882
     */
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4883
    if (__isNonNilObject(anObject)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4884
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4885
	    int spc;
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4886
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4887
	    if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4888
		RETURN (false);
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4889
	    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4890
	}
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4891
    }
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4892
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4893
    cls = __qClass(self);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4894
    if (cls == anObject) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4895
	RETURN (true);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4896
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4897
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4898
    flags = __ClassInstPtr(cls)->c_flags;
1386
a31cecccdfd8 _MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents: 1377
diff changeset
  4899
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4900
	nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4901
    } else {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4902
	nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4903
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4904
    if (! nInsts) {
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4905
	RETURN (false);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4906
    }
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4907
    for (i=0; i<nInsts; i++) {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4908
	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
  4909
	    RETURN (true);
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4910
	}
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4911
    }
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4912
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4913
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4914
"/    myClass := self class.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4915
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4916
"/    "check the class"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4917
"/    (myClass == anObject) ifTrue:[^ true].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4918
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4919
"/    "check the instance variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4920
"/    numInst := myClass instSize.
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4921
"/    1 to:numInst do:[:i | 
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4922
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4923
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4924
"/
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4925
"/    "check the indexed variables"
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4926
"/    myClass isVariable ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4927
"/      myClass isPointers ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4928
"/          "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4929
"/          "/ we could argue about the following unconditional return:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4930
"/          "/ 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
  4931
"/          "/ 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
  4932
"/          "/ integer. However, it avoids useless searches in huge byteArray
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4933
"/          "/ 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
  4934
"/          "/ 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
  4935
"/          "/ 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
  4936
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4937
"/          ^ false.
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4938
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4939
"/          "/ alternative:
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4940
"/          "/  anObject isNumber ifFalse:[^ false].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4941
"/      ].
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4942
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4943
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4944
"/      "/ 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
  4945
"/      "/ idenitytIndex method, use it
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4946
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4947
"/      myClass == Array ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4948
"/          ^ (self identityIndexOf:anObject) ~~ 0
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4949
"/      ].
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4950
"/
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4951
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4952
"/      "/ otherwise, do it the slow way
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4953
"/      "/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4954
"/      numInst := self basicSize.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4955
"/      1 to:numInst do:[:i | 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4956
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  4957
"/      ]
1109
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4958
"/    ].
38956a3cd61e speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents: 1101
diff changeset
  4959
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4960
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4961
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4962
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4963
     |v|
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
     v := View new initialize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4966
     v references:Display. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4967
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4968
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4969
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4970
referencesDerivedInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4971
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4972
     the argument, aClass or its subclass. This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4973
     to support searching for users of a class."
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
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4976
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4977
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4978
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4979
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4980
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4981
    (myClass isKindOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4982
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4983
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4984
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4985
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4986
	((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4987
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4988
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4989
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4990
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4991
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4992
	    "no need to search in non pointer fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4993
	    ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4994
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4995
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4996
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4997
	    ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4998
	]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  4999
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5000
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5001
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5002
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5003
     (1 @ 3.4) referencesDerivedInstanceOf:Number  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5004
     (1 @ 3.4) referencesDerivedInstanceOf:Array   
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5005
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5006
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5007
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5008
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5009
referencesInstanceOf:aClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5010
    "return true, if the receiver refers to an instance of
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5011
     the argument, aClass.This method exists
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5012
     to support searching for users of a class."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5013
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5014
    |myClass 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5015
     numInst "{ Class: SmallInteger }" |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5016
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5017
    myClass := self class.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5018
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5019
    "check the class"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5020
    (myClass isMemberOf:aClass) ifTrue:[^ true].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5021
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5022
    "check the instance variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5023
    numInst := myClass instSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5024
    1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5025
	((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5026
    ].
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
    "check the indexed variables"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5029
    myClass isVariable ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5030
	myClass isPointers ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5031
	    "no need to search in non-pointer indexed fields"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5032
	    myClass isLongs ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5033
		(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5034
	    ] ifFalse:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5035
		myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5036
		^ aClass == SmallInteger
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5037
	    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5038
	].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5039
	numInst := self basicSize.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5040
	1 to:numInst do:[:i | 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5041
	    ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5042
	]
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
    ^ false
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5045
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5046
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5047
     (1 @ 3.4) referencesInstanceOf:Float     
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5048
     (1 @ 3.4) referencesInstanceOf:Fraction    
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5049
     View new initialize referencesInstanceOf:(Display class)  
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5050
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  5051
! !
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5052
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5053
!Object methodsFor:'synchronized evaluation'!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5054
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5055
freeSynchronizationSemaphore    
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5056
    "free synchronizationSemaphore. May be used, to save memory when
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5057
     an object is no longer used synchronized."
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5058
2342
4e72f4d7caf1 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2341
diff changeset
  5059
    |sema|
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5060
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5061
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5062
    sema notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5063
	sema wait.              "/ get lock
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5064
	self synchronizationSemaphore:nil.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5065
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5066
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5067
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5068
     self synchronized:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5069
     self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5070
     self freeSynchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5071
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5072
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5073
    "Created: 28.1.1997 / 19:31:20 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5074
    "Modified: 28.1.1997 / 19:47:55 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5075
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5076
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5077
synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5078
    "return the synchronization semaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5079
     subclasses may redefine"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5080
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5081
    ^ SynchronizationSemaphores at:self ifAbsent:[].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5082
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5083
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5084
      self synchronizationSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5085
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5086
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5087
    "Modified: 28.1.1997 / 19:47:09 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5088
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5089
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5090
synchronizationSemaphore:aSemaphore
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5091
    "set the synchronisationSemaphore for myself.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5092
     subclasses may redefine this method"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5093
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5094
    aSemaphore isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5095
	"/ remove Semaphore
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5096
	SynchronizationSemaphores removeKey:self ifAbsent:[].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5097
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5098
	SynchronizationSemaphores at:self put:aSemaphore.
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5099
    ].
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5100
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5101
    "Modified: 28.1.1997 / 19:37:48 / stefan"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5102
!
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5103
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5104
synchronized:aBlock
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5105
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5106
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5107
    |sema blocked gotSema|
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5108
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5109
    blocked := OperatingSystem blockInterrupts.
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5110
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5111
    "/ the following avoids creation of an additional
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5112
    "/ block in the common case
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5113
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5114
    sema := self synchronizationSemaphore.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5115
    sema isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5116
	"get a locked semaphore (with count = 0)"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5117
	sema := Semaphore new.  
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5118
	self synchronizationSemaphore:sema.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5119
	blocked ifFalse:[OperatingSystem unblockInterrupts].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5120
	^ aBlock valueNowOrOnUnwindDo:[sema signal].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5121
    ].
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5122
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5123
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5124
     Poll sema (never waits).
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5125
     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
  5126
     of some blocks.
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5127
    "
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5128
    (sema waitWithTimeout:0) notNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5129
	blocked ifFalse:[OperatingSystem unblockInterrupts].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5130
	^ aBlock valueNowOrOnUnwindDo:[sema signal].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5131
    ].
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5132
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5133
    [
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5134
	gotSema := sema wait.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5135
	blocked ifFalse:[OperatingSystem unblockInterrupts].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5136
	^ aBlock value.
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5137
    ] valueNowOrOnUnwindDo:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5138
	gotSema notNil ifTrue:[gotSema signal]
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5139
    ].
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5140
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5141
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5142
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5143
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5144
    "
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5145
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5146
    "Created: 28.1.1997 / 17:52:56 / stefan"
2327
90f4a4b737d9 synchronized
Claus Gittinger <cg@exept.de>
parents: 2296
diff changeset
  5147
    "Modified: 30.1.1997 / 13:38:54 / cg"
2412
f20a5b10e6ab Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents: 2359
diff changeset
  5148
    "Modified: 20.2.1997 / 09:43:35 / stefan"
2295
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5149
! !
75eccb7762c1 Add #synchronized: method.
Stefan Vogel <sv@exept.de>
parents: 2287
diff changeset
  5150
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5151
!Object methodsFor:'system primitives'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5152
1957
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5153
asOop
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5154
    "ST-80 compatibility:
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5155
     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
  5156
     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
  5157
     be used (since its changing over time), we return the objects identityHash 
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5158
     key, which provides (at least) some identity indication.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5159
     However, notice that (in contrast to ST-80's #asOop), the identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5160
     key of two non-identical objects may be the same.
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5161
     You'd better not use it - especially do not misuse it."
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5162
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5163
    ^ self identityHash
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5164
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5165
    "Created: 9.11.1996 / 19:09:56 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5166
    "Modified: 9.11.1996 / 19:16:04 / cg"
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5167
!
3988b7bd159b added #asOop.
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
  5168
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5169
become:anotherObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5170
    "make all references to the receiver become references to anotherObject
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5171
     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
  5172
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5173
     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
  5174
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5175
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5176
     This may also be an expensive (i.e. slow) operation, 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5177
     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
  5178
     references to the two objects (although the primitive tries hard to
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5179
     limit the search, for acceptable performance in most cases). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5180
     This method fails, if the receiver or the argument is a SmallInteger 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5181
     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
  5182
     returned).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5183
     (notice that #become: is not used heavily by the system 
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5184
      - the Collection-classes have been rewritten to not use it.)"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5185
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  5186
    if (__primBecome(self, anotherObject)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5187
	RETURN ( self );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5188
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5189
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5190
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5191
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5192
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5193
becomeNil
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5194
    "make all references to the receiver become nil - effectively getting
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5195
     rid of the receiver. 
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5196
     This can be a very dangerous operation - be warned.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5197
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5198
     This may be an expensive (i.e. slow) operation.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5199
     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
  5200
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5201
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  5202
    if (__primBecomeNil(self)) {
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5203
	RETURN ( nil );
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5204
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5205
%}.
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5206
    self primitiveFailed
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5207
!
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5208
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5209
becomeSameAs:anotherObject
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5210
    "make all references to the receiver become references to anotherObject
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5211
     but NOT vice versa (as done in #become:).
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5212
     This can be a very dangerous operation - be warned.
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5213
     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
  5214
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5215
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5216
     This may also be an expensive (i.e. slow) operation,
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5217
     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
  5218
     references to the two objects (although the primitive tries hard to
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5219
     limit the search, for acceptable performance in most cases).
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5220
     This method fails, if the receiver or the argument is a SmallInteger
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5221
     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
  5222
%{
1688
8a42db1eea60 removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents: 1685
diff changeset
  5223
    if (__primBecomeSameAs(self, anotherObject)) {
859
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5224
	RETURN ( self );
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5225
    }
a532cd2450dd added becomeSameAs:
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  5226
%}.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5227
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5228
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5229
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5230
changeClassTo:otherClass
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5231
    "changes the class of the receiver to the argument, otherClass.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5232
     This is only allowed (possible), if the receivers class and the argument
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5233
     have the same structure (i.e. number of named instance variables and
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5234
     type of indexed instance variables). 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5235
     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
  5236
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5237
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5238
    |myClass ok|
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5239
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5240
    "check for UndefinedObject/SmallInteger receiver or newClass"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5241
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5242
    {
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5243
	OBJ other = otherClass;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5244
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5245
	if (__isNonNilObject(self) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5246
	 && __isNonNilObject(other)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5247
	 && (other != UndefinedObject)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5248
	 && (other != SmallInteger)) {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5249
	    ok = true;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5250
	} else {
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5251
	    ok = false;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5252
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5253
    }
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5254
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5255
    ok ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5256
	ok := false.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5257
	myClass := self class.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5258
	myClass flags == otherClass flags ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5259
	    myClass instSize == otherClass instSize ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5260
		"same instance layout and types: its ok to do it"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5261
		ok := true.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5262
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5263
		myClass isPointers ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5264
		    myClass isVariable ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5265
			ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5266
		    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5267
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5268
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5269
	] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5270
	    myClass isPointers ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5271
		"if newClass is a variable class, with instSize <= my instsize,
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5272
		 we can do it (effectively mapping additional instvars into the
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5273
		 variable part) - usefulness is questionable, though"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5274
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5275
		otherClass isPointers ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5276
		    otherClass isVariable ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5277
			otherClass instSize <= (myClass instSize + self basicSize) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5278
			ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5279
			    ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5280
			]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5281
		    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5282
			otherClass instSize == (myClass instSize + self basicSize) 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5283
			ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5284
			    ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5285
			]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5286
		    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5287
		] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5288
		    "it does not make sense to convert pointers to bytes ..."
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5289
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5290
	    ] ifFalse:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5291
		"does it make sense, to convert bits ?"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5292
		"could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5293
		(myClass isBits and:[otherClass isBits]) ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5294
		    ok := true
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5295
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5296
	    ]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5297
	]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5298
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5299
    ok ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5300
	"now, change the receivers class ..."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5301
%{
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5302
	{
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5303
	    OBJ me = self;
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5304
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5305
	    __qClass(me) = otherClass;
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5306
	    __STORE(me, otherClass);
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5307
	    RETURN (me);
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
  5308
	}
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5309
%}.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5310
    ].
1022
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5311
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5312
    "
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5313
     the receiver cannot be represented as a instance of
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5314
     the desired class.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5315
     For example, you cannot change a bitInstance (byteArray etc.) 
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5316
     into a pointer object and vice versa.
f526a827ea1a allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  5317
    "
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5318
    self primitiveFailed
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5319
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5320
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5321
changeClassToThatOf:anObject
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5322
    "changes the class of the receiver to that of the argument, anObject.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5323
     This is only allowed (possible), if the receivers class and the arguments
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5324
     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
  5325
     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
  5326
     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
  5327
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5328
    self changeClassTo:(anObject class)
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5329
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5330
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5331
!Object methodsFor:'testing'!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5332
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5333
? defaultValue
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5334
     "if the receiver is nil, return the defaultValue;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5335
      otherwise, return the receiver.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5336
      This method is only redefined in UndefinedObject - therefore,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5337
      the recevier is retuned here.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5338
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5339
      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
  5340
	  foo ? bar
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5341
      is the same as:
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5342
	  (foo isNil ifTrue:[bar] ifFalse:[foo])
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5343
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5344
      if they are message sends, the equivalent code is:
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5345
	  [
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5346
	      |t1 t2|
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5347
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5348
	      t1 := foo.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5349
	      t2 := bar.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5350
	      t1 isNil ifTrue:[t2] ifFalse:[t1]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5351
	  ] value
1958
d8d575552c87 commentary
Claus Gittinger <cg@exept.de>
parents: 1957
diff changeset
  5352
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5353
      Can be used to provide defaultValues to variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5354
      as in:
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5355
	  foo := arg ? #defaultValue
2147
3579ce76c8c8 comment
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  5356
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  5357
      Note: this method should never be redefined in classes other than UndefinedObject.
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5358
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5359
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5360
    ^ self
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5361
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5362
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5363
     1 ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5364
     nil ? #default
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5365
    "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5366
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5367
    "Created: 4.11.1996 / 20:36:19 / cg"
2148
f0a95dd96db5 comment
Claus Gittinger <cg@exept.de>
parents: 2147
diff changeset
  5368
    "Modified: 11.1.1997 / 14:56:47 / cg"
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5369
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5370
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5371
isArray
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5372
    "return true, if the receiver is some kind of array (or weakArray etc);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5373
     false is returned here - the method is only redefined in Array."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5374
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5375
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5376
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5377
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5378
isAssociation
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5379
    "return true, if the receiver is some kind of association;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5380
     false is returned here - the method is only redefined in Association."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5381
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5382
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5383
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5384
    "Created: 14.5.1996 / 17:03:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5385
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5386
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5387
isBehavior
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5388
    "return true, if the receiver is some kind of class (i.e. behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5389
     false is returned here - the method is only redefined in Behavior."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5390
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5391
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5392
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5393
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5394
isBlock
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5395
    "return true, if the receiver is some kind of block;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5396
     false returned here - the method is only redefined in Block."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5397
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5398
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5399
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5400
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5401
isCharacter
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5402
    "return true, if the receiver is some kind of character;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5403
     false is returned here - the method is only redefined in Character."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5404
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5405
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5406
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5407
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5408
isClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5409
    "return true, if the receiver is some kind of class (real class, 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5410
     not just behavior);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5411
     false is returned here - the method is only redefined in Class."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5412
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5413
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5414
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5415
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5416
isCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5417
    "return true, if the receiver is some kind of collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5418
     false is returned here - the method is only redefined in Collection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5419
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5420
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5421
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5422
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5423
isColor
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5424
    "return true, if the receiver is some kind of color;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5425
     false is returned here - the method is only redefined in Color."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5426
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5427
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5428
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5429
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5430
isContext
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5431
    "return true, if the receiver is some kind of context;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5432
     false returned here - the method is only redefined in Context."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5433
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5434
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5435
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5436
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5437
isExternalStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5438
    "return true, if the receiver is some kind of externalStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5439
     false is returned here - the method is only redefined in ExternalStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5440
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5441
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5442
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5443
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5444
isFileStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5445
    "return true, if the receiver is some kind of fileStream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5446
     false is returned here - the method is only redefined in FileStream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5447
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5448
    ^false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5449
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5450
1887
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5451
isFixedPoint
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5452
    "return true, if the receiver is some kind of fixedPoint number;
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5453
     false is returned here - the method is only redefined in FixedPoint."
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5454
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5455
    ^ false
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5456
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5457
    "Created: 5.11.1996 / 19:23:04 / cg"
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5458
!
364cff2aec4e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1867
diff changeset
  5459
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5460
isFixedSize
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5461
    "return true if the receiver cannot grow easily 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5462
     (i.e. a grow may be expensive, since it involves a become:)"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5463
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5464
    ^ true
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5465
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5466
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5467
isForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5468
    "return true, if the receiver is some kind of form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5469
     false is returned here - the method is only redefined in Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5470
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5471
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5472
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5473
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5474
isFraction
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5475
    "return true, if the receiver is some kind of fraction;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5476
     false is returned here - the method is only redefined in Fraction."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5477
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5478
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5479
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5480
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5481
isImage
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5482
    "return true, if the receiver is some kind of image;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5483
     false is returned here - the method is only redefined in Image."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5484
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5485
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5486
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5487
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5488
isImageOrForm
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5489
    "return true, if the receiver is some kind of image or form;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5490
     false is returned here - the method is only redefined in Image and Form."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5491
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5492
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5493
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5494
2673
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5495
isImmediate
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5496
    "return true if this object has immediate representation"
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5497
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5498
    ^ self class hasImmediateInstances
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5499
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5500
    "Created: 3.6.1997 / 12:00:18 / cg"
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5501
!
f514189f6096 added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 2655
diff changeset
  5502
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5503
isInteger
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5504
    "return true, if the receiver is some kind of integer number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5505
     false is returned here - the method is only redefined in Integer."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5506
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5507
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5508
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5509
2502
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5510
isJavaClass
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5511
    ^ false
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5512
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5513
    "Created: 26.3.1997 / 13:34:54 / cg"
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5514
!
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5515
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5516
isJavaObject
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5517
    ^ false
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5518
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5519
    "Created: 26.3.1997 / 13:34:48 / cg"
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5520
!
8f3bf6043968 added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents: 2480
diff changeset
  5521
1867
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5522
isKindOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5523
    "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
  5524
     subclasses, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5525
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5526
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5527
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5528
	to instances of certain classes and fences you into a specific inheritance 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5529
	hierarchy.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5530
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5531
	(such as #isXXXX, #respondsTo: or #isNumber).
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5532
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5533
	Using #isKindOf: is considered BAD STYLE.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5534
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5535
     Advice2:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5536
	Be aware, that using an #isXXX method is usually much faster than 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5537
	using #isKindOf:; because isKindOf: has to walk up all the superclass 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5538
	hierarchy, comparing every class on the way. 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5539
	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
  5540
	a single function call.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5541
     "
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5542
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5543
%{  /* NOCONTEXT */
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5544
    register OBJ thisClass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5545
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5546
    thisClass = __Class(self);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5547
    while (thisClass != nil) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5548
	if (thisClass == aClass) {
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5549
	    RETURN ( true );
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5550
	}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5551
	thisClass = __ClassInstPtr(thisClass)->c_superclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5552
    }
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5553
%}
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5554
.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5555
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5556
"/  the above code is equivalent to:
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5557
"/
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5558
"/  thisClass := self class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5559
"/  [thisClass notNil] whileTrue:[
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5560
"/      thisClass == aClass ifTrue:[^ true].
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5561
"/      thisClass := thisClass superclass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5562
"/  ]
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
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5567
isLayout
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5568
    "return true, if the receiver is some kind of layout;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5569
     false is returned here - the method is only redefined in Layout."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5570
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5571
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5572
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5573
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5574
isLiteral
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5575
    "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
  5576
     false is returned here - the method is redefined in some classes."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5577
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5578
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5579
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5580
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5581
isMemberOf:aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5582
    "return true, if the receiver is an instance of aClass, false otherwise.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5583
     Advice: 
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5584
	use of this to check objects for certain attributes/protocoll should
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5585
	be avoided; it limits the reusability of your classes by limiting use
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5586
	to instances of a certain class.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5587
	Use check-methods to check an object for a certain attributes/protocol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5588
	(such as #isXXX, #respondsTo: or #isNumber);
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5589
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5590
	Using #isMemberOf: is considered BAD STYLE."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5591
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5592
    ^ (self class) == aClass
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5593
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5594
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5595
isMeta
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5596
    "return true, if the receiver is some kind of metaclass;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5597
     false is returned here - the method is only redefined in Metaclass."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5598
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5599
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5600
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5601
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5602
isMethod
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5603
    "return true, if the receiver is some kind of method;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5604
     false returned here - the method is only redefined in Method."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5605
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5606
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5607
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5608
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5609
isNamespace
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5610
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5611
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5612
    "Created: 11.10.1996 / 18:08:56 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5613
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5614
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5615
isNumber
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5616
    "return true, if the receiver is some kind of number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5617
     false is returned here - the method is only redefined in Number."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5618
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5619
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5620
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5621
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5622
isPoint
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5623
    "return true, if the receiver is some kind of point;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5624
     false is returned here - the method is only redefined in Point."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5625
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5626
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5627
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5628
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5629
isReal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5630
    "return true, if the receiver is some kind of real number;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5631
     false is returned here - the method is only redefined in LimitedPrecisionReal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5632
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5633
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5634
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5635
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5636
isRectangle
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5637
    "return true, if the receiver is some kind of rectangle;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5638
     false is returned here - the method is only redefined in Rectangle."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5639
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5640
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5641
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5642
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5643
isRemoteObject
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5644
    "return true, if the receiver is some kind of remoteObject,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5645
     false if its local - the method is only redefined in RemoteObject."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5646
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5647
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5648
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5649
    "Created: 28.10.1996 / 15:18:45 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5650
    "Modified: 28.10.1996 / 15:20:57 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5651
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5652
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5653
isSequenceable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5654
    "return true, if the receiver is some kind of sequenceable collection;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5655
     false is returned here - the method is only redefined in SequenceableCollection."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5656
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5657
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5658
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5659
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5660
isSequenceableCollection
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5661
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5662
     This method is a historic leftover and will be removed soon ..."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5663
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5664
    self obsoleteMethodWarning:'use #isSequenceable'.
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5665
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5666
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5667
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5668
isSignal
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5669
    "return true, if the receiver is some kind of signal;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5670
     false returned here - the method is only redefined in Signal."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5671
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5672
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5673
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5674
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5675
isStream
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5676
    "return true, if the receiver is some kind of stream;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5677
     false is returned here - the method is only redefined in Stream."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5678
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5679
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5680
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5681
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5682
isString
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5683
    "return true, if the receiver is some kind of string;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5684
     false is returned here - the method is only redefined in String."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5685
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5686
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5687
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5688
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5689
isSymbol
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5690
    "return true, if the receiver is some kind of symbol;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5691
     false is returned here - the method is only redefined in Symbol."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5692
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5693
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5694
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5695
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5696
isText
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5697
    "return true, if the receiver is some kind of text object;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5698
     false is returned here - the method is only redefined in Text."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5699
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5700
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5701
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5702
    "Created: 12.5.1996 / 10:56:50 / cg"
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5703
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5704
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5705
isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5706
    "return true if the receiver has indexed instance variables,
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5707
     false otherwise."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5708
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5709
    ^ self class isVariable
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5710
!
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5711
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5712
isView
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5713
    "return true, if the receiver is some kind of view;
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5714
     false is returned here - the method is only redefined in View."
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5715
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5716
    ^ false
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5717
! !
e92d90126094 added ?;
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  5718
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5719
!Object methodsFor:'user interaction & notifications'!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5720
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5721
activityNotification:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5722
    "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
  5723
     some long-time activity.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5724
     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
  5725
     passing the argument. The handler should show this message whereever it likes,
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5726
     and proceed. If there is no handler, this is simply ignored.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5727
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5728
     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
  5729
     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
  5730
     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
  5731
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5732
    ActivityNotificationSignal isHandled ifTrue:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5733
	^ ActivityNotificationSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5734
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5735
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5736
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5737
     nil activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5738
     self activityNotification:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5739
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5740
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5741
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5742
     ActivityNotificationSignal handle:[:ex |
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5743
	ex errorString printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5744
	ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5745
     ] do:[
861
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5746
	'hello' printNL.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5747
	self activityNotification:'doing some long time computation'.
2b4dc0a4f65a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 859
diff changeset
  5748
	'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5749
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5750
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5751
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5752
    "Modified: 16.12.1995 / 18:23:42 / cg"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5753
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5754
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5755
confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5756
    "launch a confirmer, which allows user to enter yes or no.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5757
     return true for yes, false for no"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5758
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5759
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5760
     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
  5761
     and return true (as if yes was answered)
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5762
     Q: should we ask user by reading Stdin ?
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5763
    "
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5764
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5765
	'*** confirmation requested during initialization:' printCR. 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5766
	aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5767
	'*** I''ll continue, assuming <yes> ...' printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5768
	^ true
925
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5769
    ].
020a15fa450f use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  5770
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5771
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5772
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5773
	Transcript showCR:'continue, assuming <yes>'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5774
	^ true
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5775
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5776
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5777
    ^ Dialog confirm:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5778
        
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5779
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5780
     nil confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5781
     self confirm:'hello'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5782
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5783
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5784
    "Modified: 20.5.1996 / 10:28:40 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5785
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5786
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5787
errorNotify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5788
    "launch a Notifier, showing top stack, telling user something
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5789
     and give user a chance to enter debugger."
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5790
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5791
    ^ self
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5792
	errorNotify:aString 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5793
	from:thisContext sender
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5794
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5795
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5796
     nil errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5797
     self errorNotify:'hello there'
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5798
    "
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5799
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5800
    "Modified: 11.1.1997 / 18:39:20 / cg"
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5801
!
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5802
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5803
errorNotify:aString from:aContext
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5804
    "launch a Notifier, showing top stack (above aContext), 
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5805
     telling user something and give user a chance to enter debugger."
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5806
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5807
    |info con sender action|
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5808
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5809
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5810
	'errorNotification: ' print. aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5811
	^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5812
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5813
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5814
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5815
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5816
	 on systems without GUI, simply show
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5817
	 the message on the Transcript and abort.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5818
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5819
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5820
	AbortSignal raise.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5821
	^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5822
    ].
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5823
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5824
    Processor activeProcessIsSystemProcess ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5825
	action := #debug.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5826
	sender := aContext.
2203
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5827
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5828
	Dialog autoload.        "in case its autoloaded"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5829
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5830
	ErrorSignal handle:[:ex |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5831
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5832
	    "/ a recursive error - quickly enter debugger
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5833
	    "/ this happened, when I corrupted the Dialog class ...
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5834
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  5835
	    ('Object [error]: ' , ex errorString , ' caught in errorNotification') errorPrintCR.
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5836
	    action := #debug.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5837
	    ex return.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5838
	] do:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5839
	    sender := aContext.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5840
	    sender isNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5841
		sender := thisContext sender.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5842
		"/
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5843
		"/ 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
  5844
"/                sender isBlockContext ifTrue:[
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5845
"/                    sender := sender sender
5899dbf1b69c go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  5846
"/                ].
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5847
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5848
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5849
	    "/ skip intermediate (signal & exception) contexts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5850
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5851
	    DebugView notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5852
		sender := DebugView interestingContextFrom:sender
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5853
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5854
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5855
	    "/ show the first 5 contexts
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5856
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5857
	    con := sender.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5858
	    info := aString , Character cr asString , Character cr asString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5859
	    1 to:5 do:[:n |
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5860
		con notNil ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5861
		    info := info , con printString , Character cr asString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5862
		    con := con sender
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5863
		]
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5864
	    ].
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5865
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5866
	    action := Dialog 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5867
			choose:info 
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5868
			label:('Exception [' , Processor activeProcess nameOrId , ']')
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5869
			labels:#('proceed' 'abort' 'debug')
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5870
			values:#(#proceed #abort #debug)
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5871
			default:#debug.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5872
	].
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5873
    ].
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5874
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5875
    action == #debug ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5876
	Debugger enter:sender withMessage:aString
2082
36171caceb24 better errorNotify:
Claus Gittinger <cg@exept.de>
parents: 2043
diff changeset
  5877
    ] ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5878
	action == #abort ifTrue:[
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5879
	    AbortSignal raise
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5880
	]
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5881
    ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5882
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5883
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5884
     nil errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5885
     self errorNotify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5886
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5887
2150
3daace4e5fbc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  5888
    "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
  5889
    "Modified: 8.2.1997 / 12:47:41 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5890
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5891
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5892
information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5893
    "launch an InfoBox, telling user something. 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5894
     These info-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5895
     UserNotification- or InformationSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5896
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5897
    InformationSignal isHandled ifTrue:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5898
	^ InformationSignal raiseRequestWith:self errorString:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5899
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5900
    self notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5901
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5902
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5903
     nil information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5904
     self information:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5905
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5906
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5907
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5908
     InformationSignal handle:[:ex |
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5909
	'no box popped' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5910
	ex proceed.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5911
     ] do:[
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5912
	'hello' printNL.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5913
	self information:'some info'.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5914
	'world' printNL.
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
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5917
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5918
    "Modified: 24.11.1995 / 22:29:49 / cg"
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
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5921
notify:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5922
    "launch a Notifier, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5923
     Use #information: for ignorable messages."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5924
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5925
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5926
	'information: ' print. aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5927
	^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5928
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5929
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5930
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5931
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5932
	 on systems without GUI, simply show
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5933
	 the message on the Transcript.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5934
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5935
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5936
	^ self
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
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5939
    Dialog information:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5940
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5941
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5942
     nil notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5943
     self notify:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5944
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5945
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5946
    "Modified: 20.5.1996 / 10:28:48 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5947
!
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5948
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5949
warn:aString
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5950
    "launch a WarningBox, telling user something.
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5951
     These warn-boxes can be suppressed by handling the 
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5952
     UserNotification- or WarningSignal and proceeding in the handler."
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5953
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5954
    WarningSignal isHandled ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5955
	^ WarningSignal raiseRequestWith:self errorString:aString
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5956
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5957
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5958
    Smalltalk isInitialized ifFalse:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5959
	'warning: ' print. aString printCR.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5960
	^ self
891
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5961
    ].
6807b8576453 handle warnboxes during init
ah
parents: 889
diff changeset
  5962
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5963
    Dialog isNil ifTrue:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5964
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5965
	 on systems without GUI, simply show
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5966
	 the message on the Transcript.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5967
	"
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5968
	Transcript showCR:aString.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5969
	^ self
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5970
    ].
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5971
    Dialog autoload.        "in case its autoloaded"
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5972
    Dialog warn:aString
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
     nil warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5976
     self warn:'hello there'
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5977
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5978
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5979
    "
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5980
     WarningSignal handle:[:ex |
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5981
	ex proceed.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5982
     ] do:[
2647
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5983
	'hello' printNL.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5984
	self warn:'some info'.
1167aaee163e a much faster shallowCopy
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  5985
	'world' printNL.
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5986
     ]
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5987
    "
1417
59e7d3c1df6d showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 1397
diff changeset
  5988
1425
cb86edc25a3b printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 1422
diff changeset
  5989
    "Modified: 20.5.1996 / 10:28:53 / cg"
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5990
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5991
1788
0c71ba975d34 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  5992
!Object class methodsFor:'documentation'!
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5993
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5994
version
2689
ada9b102abcf typo fix
Claus Gittinger <cg@exept.de>
parents: 2673
diff changeset
  5995
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.196 1997-06-16 18:20:55 cg Exp $'
783
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5996
! !
78a9b311241f added #activityNotification:
Claus Gittinger <cg@exept.de>
parents: 782
diff changeset
  5997
Object initialize!