Object.st
author Claus Gittinger <cg@exept.de>
Sun, 03 May 2020 13:20:12 +0200
changeset 25379 609d492f29a7
parent 25252 826c0e1220af
permissions -rw-r--r--
#DOCUMENTATION by cg class: Object comment/format in: #perform:ifNotUnderstood:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22121
60c9ff1ec454 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 22053
diff changeset
     1
"{ Encoding: utf8 }"
60c9ff1ec454 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 22053
diff changeset
     2
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     3
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     4
 COPYRIGHT (c) 1988 by Claus Gittinger
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
     5
	      All Rights Reserved
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     6
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     7
 This software is furnished under a license and may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     8
 only in accordance with the terms of that license and with the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    10
 be provided or otherwise made available to, or used by, any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    11
 other person.  No title to or ownership of the software is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    12
 hereby transferred.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    13
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    14
"{ Package: 'stx:libbasic' }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    15
17261
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
    16
"{ NameSpace: Smalltalk }"
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
    17
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    18
nil subclass:#Object
21317
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    19
	instanceVariableNames:''
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    20
	classVariableNames:'AbortAllSignal AbortSignal ActivityNotificationSignal
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    21
		DebuggerHooks DeepCopyErrorSignal Dependencies
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    22
		ElementOutOfBoundsSignal EnabledBreakPoints ErrorRecursion
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    23
		ErrorSignal FinalizationLobby HaltSignal IndexNotFoundSignal
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    24
		InfoPrinting InformationSignal InternalErrorSignal
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    25
		KeyNotFoundSignal MessageNotUnderstoodSignal
23803
b64bd0c74a03 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23796
diff changeset
    26
		NonIntegerIndexSignal NonWeakDependencies NotFoundSignal Nothing
21317
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    27
		OSSignalInterruptSignal ObjectAttributes
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    28
		ObjectAttributesAccessLock PartialErrorPrintLine
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    29
		PartialInfoPrintLine PrimitiveFailureSignal
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    30
		RecursionInterruptSignal RecursiveStoreStringSignal
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    31
		SubscriptOutOfBoundsSignal SynchronizationSemaphores
23803
b64bd0c74a03 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23796
diff changeset
    32
		UserInterruptSignal UserNotificationSignal WarningSignal'
21317
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    33
	poolDictionaries:''
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
    34
	category:'Kernel-Objects'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    35
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    36
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    37
!Object class methodsFor:'documentation'!
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
    38
5754
333aba8041c2 checkin from browser
tm
parents: 5706
diff changeset
    39
copyright
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    40
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    41
 COPYRIGHT (c) 1988 by Claus Gittinger
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
    42
	      All Rights Reserved
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    43
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    44
 This software is furnished under a license and may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    45
 only in accordance with the terms of that license and with the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    46
 inclusion of the above copyright notice.   This software may not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    47
 be provided or otherwise made available to, or used by, any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    48
 other person.  No title to or ownership of the software is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    49
 hereby transferred.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    50
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    51
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    52
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    53
dependencies
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    54
"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    55
   ST/X dependencies are slightly modified from ST-80's
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    56
   (we think they are better ;-).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    57
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    58
   One problem occuring very often in ST-80 is that some object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    59
   cannot be garbage collected because some dependency is present,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    60
   having the object as a dependent of some other object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    61
   In ST-80, this association remains alive (because a Dictionary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    62
   is used to hold dependents) - even if no other references exist to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    63
   to dependent or the dependee.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    64
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    65
   This means, that in ST-80, a #release is mandatory in order to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    66
   prevent memory leaks.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    67
   We think, that this is a bad solution, since after all, exactly that
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    68
   kind of work should be performed by a garbage collector - you should not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    69
   need to care about dependencies.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    70
   From a philosophical point of view, why should some object depend on
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    71
   something that the programmer considers a dead object ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    72
   (well - worse than that: it seems that some ST-80 code even depends on
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    73
    that behavior)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    74
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    75
   In order to limit the trouble, ST-80 reimplemented the way dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    76
   are stored in the model class - this one keeps the dependents locally,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    77
   so these dependents go away, once the model is reclaimed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    78
   That may make things even more confusing: with models, no #release is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    79
   needed, with general objects it is mandatory.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    80
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    81
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    82
   In ST/X, dependencies are implemented using a WeakDictionary; this means,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    83
   that once the dependee dies, the dependency association is removed automatically,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    84
   and the dependent can be reclaimed by the garbage collector, if no other
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    85
   references exist to the dependent.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    86
   In order to (at least) provide a mechanism for the old behavior
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    87
   (in case your application heavily depends on the ST-80 mechanism), complementary
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    88
   protocol to add nonWeak dependencies is provided
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    89
   (see #addNonWeakDependent / #removeNonWeakDependent).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    90
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    91
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    92
   Caveat:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    93
      since interests are implemented using InterestConverter (which are simply
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    94
      forwarding messages), these must use the nonWeak mechanism (as done in ST-80
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    95
      automatically).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    96
      The reason is that there are usually no direct references to the converters,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    97
      and those would be reclaimed if stored in a weakDictionary.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    98
      This means, that those interests MUST be removed with #retractInterest
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
    99
      (which is bug-compatible to ST-80).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   100
      We rewrite things to provide a more convenient mechanism in the future ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   101
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   102
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   103
   I like to hear comments on the above - do you think its better ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   104
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   105
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   106
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   107
documentation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   108
"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   109
   Object is the superclass of most other classes.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   110
   (except for nil-subclasses, which inherit nothing,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   111
    to catch any message into their #doesNotUnderstand: method)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   112
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   113
   Protocol which is common to every object is defined here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   114
   Also some utility stuff (like notify) and error handling is implemented here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   115
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   116
   Object has no instance variables (and may not get any added). One reason is, that
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   117
   UndefinedObject and SmallInteger are also inheriting from Object - these two cannot
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   118
   have instance variables (due to their implementation).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   119
   The other reason is that the runtime system (VM) knows about the layout of some built-in
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   120
   classes (think of Class, Method, Block and also Integer or Float).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   121
   If you were allowed to add instance variables to Object, the VM had to be recompiled
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   122
   (and also rewritten in some places).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   123
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   124
   [Class variables:]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   125
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   126
	ErrorSignal     <Signal>        Signal raised for error/error: messages
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   127
					also, parent of all other signals.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   128
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   129
	HaltSignal      <Signal>        Signal raised for halt/halt: messages
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   130
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   131
	MessageNotUnderstoodSignal      Signals raised for various error conditions
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   132
	UserInterruptSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   133
	RecursionInterruptSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   134
	ExceptionInterruptSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   135
	SubscriptOutOfBoundsSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   136
	NonIntegerIndexSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   137
	NotFoundSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   138
	KeyNotFoundSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   139
	ElementOutOfBoundsSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   140
	InformationSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   141
	WarningSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   142
	DeepCopyErrorSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   143
	InternalErrorSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   144
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   145
	AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   146
					BUT, the debugger will only raise it if it is handled.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   147
					By handling the abortSignal, you can control where the
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   148
					debuggers abort-function resumes execution in case of
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   149
					an error.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   150
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   151
	ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   152
					an error while handling an error).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   153
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   154
	Dependencies     <WeakDependencyDictionary>
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   155
					keeps track of object dependencies.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   156
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   157
	InfoPrinting     <Boolean>      controls weather informational messages
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   158
					are printed.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   159
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   160
	ActivityNotificationSignal <QuerySignal>
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   161
					 raised on #activityNotification:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   162
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   163
	NonWeakDependencies <Dictionary> keeps track of object dependencies.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   164
					 Dependents stay alive.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   165
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   166
	SynchronizationSemaphores <WeakIdentityDictionary>
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   167
					 Semaphores for per-object-monitor.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   168
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   169
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   170
    [author:]
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   171
	Claus Gittinger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   172
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   173
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   174
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   175
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   176
!Object class methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   177
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   178
initSignals
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   179
    "called only once - initialize signals"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   180
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   181
    "/ notice: the class variables here are a leftover from times
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   182
    "/ when errors where signal-instance, not class based.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   183
    "/ then, signal instances where created here and kept as class vars,
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   184
    "/ to be fetched from the class var or via signal-getter methods.
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
   185
    "/ Nowadays, we use class based exceptions, where the exception class
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   186
    "/ is directly referenced.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   187
    "/ the classvars here are kept for backward compatibility, but they now
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   188
    "/ simply alias the corresponding exception class.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   189
    "/ Old code should be rewritten to access the error class.
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   190
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   191
    ErrorSignal := Error.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   192
    HaltSignal := HaltInterrupt.
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   193
    MessageNotUnderstoodSignal := MessageNotUnderstood.
6000
d6fbafc5879e more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   194
    PrimitiveFailureSignal := PrimitiveFailure.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   195
    InternalErrorSignal := VMInternalError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   196
    UserInterruptSignal := UserInterrupt.
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   197
    RecursionInterruptSignal := RecursionError.
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   198
    NotFoundSignal := NotFoundError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   199
    IndexNotFoundSignal := IndexNotFoundError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   200
    SubscriptOutOfBoundsSignal := SubscriptOutOfBoundsError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   201
    NonIntegerIndexSignal := NonIntegerIndexError.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   202
    KeyNotFoundSignal := KeyNotFoundError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   203
    ElementOutOfBoundsSignal := ElementBoundsError.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   204
    UserNotificationSignal := UserNotification.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
   205
    WarningSignal := Warning.
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
   206
    InformationSignal := UserInformation.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   207
    ActivityNotificationSignal := ActivityNotification.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   208
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   209
    DeepCopyErrorSignal := DeepCopyError.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   210
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   211
    AbortSignal := AbortOperationRequest.
6877
ab4e7d42f9f8 AbortAllOperation - now class based
Claus Gittinger <cg@exept.de>
parents: 6874
diff changeset
   212
    AbortAllSignal := AbortAllOperationRequest.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   213
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   214
    OSSignalInterruptSignal := OSSignalInterrupt.
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   215
    RecursiveStoreStringSignal := RecursiveStoreError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   216
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   217
    "
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   218
     Object initSignals
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   219
    "
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   220
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   221
    "Modified: / 22.1.1998 / 21:23:40 / av"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   222
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   223
    "Modified: / 16.11.2001 / 16:30:08 / cg"
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   224
!
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   225
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   226
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   227
    "called only once - initialize signals"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   228
24497
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   229
    Nothing isNil ifTrue:[
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   230
        Nothing := VoidObject new.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   231
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   232
        ErrorSignal isNil ifTrue:[
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   233
            self initSignals.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   234
            ErrorRecursion := true.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   235
        ].
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   236
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   237
        ObjectAttributes isNil ifTrue:[
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   238
            ObjectAttributes := WeakIdentityDictionary new.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   239
            ObjectAttributesAccessLock := RecursionLock new.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   240
        ].
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   241
        Dependencies isNil ifTrue:[
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   242
            Dependencies := WeakDependencyDictionary new.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   243
        ].
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   244
        NonWeakDependencies isNil ifTrue:[
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   245
            NonWeakDependencies := IdentityDictionary new.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   246
        ].
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   247
        SynchronizationSemaphores isNil ifTrue:[
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   248
            SynchronizationSemaphores := WeakIdentityDictionary new.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   249
        ].
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   250
        FinalizationLobby isNil ifTrue:[
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   251
            FinalizationLobby := Registry new.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   252
        ].
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   253
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   254
        "/ initialize InfoPrinting to the VM's infoPrint setting
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   255
        "/ (which can be turned off via a command line argument)
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   256
        InfoPrinting := ObjectMemory infoPrinting.
b594d2fd5cb4 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24390
diff changeset
   257
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   258
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   259
    "Object initialize"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   260
23652
1b482fb9e84d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23574
diff changeset
   261
    "Modified: / 22-01-1998 / 21:23:40 / av"
1b482fb9e84d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23574
diff changeset
   262
    "Modified: / 03-02-1998 / 18:55:09 / cg"
1b482fb9e84d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23574
diff changeset
   263
    "Modified: / 04-08-1999 / 08:54:06 / stefan"
1b482fb9e84d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23574
diff changeset
   264
    "Modified: / 30-01-2019 / 16:26:31 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   265
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   266
25046
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
   267
7303
98111fb6a285 category
Claus Gittinger <cg@exept.de>
parents: 7285
diff changeset
   268
!Object class methodsFor:'Compatibility-ST80'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   269
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   270
rootError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   271
    "return the signal used for error/error: - handling.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   272
     Same as errorSignal for ST80 compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   273
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   274
    ^ Error
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   275
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   276
    "Created: / 15.1.1998 / 23:47:05 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   277
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   278
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   279
!Object class methodsFor:'Signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   280
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   281
abortAllSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   282
    "return the signal used to abort user actions (much like AbortSignal).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   283
     This signal is supposed to abort multiple operation actions, and get out of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   284
     the loop (such as when confirming multiple class deletions etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   285
15903
7de2ea21e054 AbortSignal -> AbortOperationRequest
Stefan Vogel <sv@exept.de>
parents: 15891
diff changeset
   286
    ^ AbortAllOperationRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   287
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   288
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   289
abortSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   290
    "return the signal used to abort user actions. This signal is only
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   291
     raised if caught (by the debugger), and will lead way out of the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   292
     currently active doIt/printIt or inspectIt. (also some others use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   293
     this for a save abort)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   294
8521
60f0e479ffc1 use class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8502
diff changeset
   295
    ^ AbortOperationRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   296
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   297
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   298
activityNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   299
    "return the signal used for activity notifications.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   300
     A handler for this signal gets all #activityNotification: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   301
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   302
    ^ ActivityNotification
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   303
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   304
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   305
ambiguousMessageSignal
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   306
    "return the signal used for ambiguousMessage: - error handling"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   307
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   308
    ^ AmbiguousMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   309
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   310
    "Created: / 21-07-2010 / 15:39:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   311
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
   312
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   313
conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   314
    "return the signal used for conversion error handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   315
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   316
    ^ ConversionError
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   317
!
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
   318
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   319
deepCopyErrorSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   320
    "return the signal raised when a deepcopy is asked for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   321
     an object which cannot do this (for example, BlockClosures
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   322
     or Contexts)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   323
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   324
    ^ DeepCopyError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   325
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   326
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   327
elementOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   328
    "return the signal used for element error reporting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   329
     (this signal is used for example when a value not in 0..255 is to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   330
      be put into a bytearray)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   331
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   332
    ^ ElementBoundsError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   333
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   334
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   335
errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   336
    "return the signal used for error/error: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   337
7094
617eeaf2f8ba Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 7081
diff changeset
   338
    ^ Error
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   339
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   340
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   341
haltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   342
    "return the signal used for halt/halt: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   343
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   344
    ^ HaltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   345
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   346
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   347
indexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   348
    "return the signal used for bad index error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   349
     This is also the parentSignal of the nonIntegerIndex- and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   350
     subscriptOutOfBoundsSignal"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   351
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   352
    ^ IndexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   353
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   354
    "Created: / 8.11.1997 / 19:15:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   355
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   356
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   357
informationSignal
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   358
    "return the signal used for informations.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   359
     A handler for this signal gets all #information: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   360
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   361
    ^ InformationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   362
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   363
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   364
internalErrorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   365
    "return the signal used to report internal (VM-) errors."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   366
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   367
    ^ VMInternalError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   368
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   369
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   370
keyNotFoundSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   371
    "return the signal used for no such key error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   372
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   373
    ^ KeyNotFoundError
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   374
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   375
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   376
messageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   377
    "return the signal used for doesNotUnderstand: - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   378
15193
e84b5268e918 class: Object
Claus Gittinger <cg@exept.de>
parents: 15128
diff changeset
   379
    ^ MessageNotUnderstood
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   380
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   381
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   382
nonIntegerIndexSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   383
    "return the signal used for bad subscript error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   384
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   385
    ^ NonIntegerIndexSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   386
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   387
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   388
notFoundSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   389
    "return the signal used for no element found error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   390
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   391
    ^ NotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   392
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   393
7644
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   394
notifySignal
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   395
    "return the parent of all notification signals."
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   396
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   397
    ^ Notification
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   398
!
211762a9a39f added notifySignal for VW compatibility
Claus Gittinger <cg@exept.de>
parents: 7621
diff changeset
   399
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   400
osSignalInterruptSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   401
    "return the signal used for OS-signal error reporting;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   402
     This is only raised if handled - otherwise, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   403
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   404
    ^ OSSignalInterrupt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   405
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   406
    "Modified: / 12.6.1998 / 16:27:26 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   407
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   408
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   409
primitiveFailureSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   410
    "return the signal used for primitiveFailed - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   411
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   412
    ^ PrimitiveFailure
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   413
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   414
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   415
privateMethodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   416
    "return the signal used for privateMethod - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   418
    ^ MessageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   419
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   420
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   421
recursionInterruptSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   422
    "return the signal used for recursion overflow error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   423
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   424
    ^ RecursionInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   425
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   426
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   427
recursiveStoreStringSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   428
    "return the notification used to report storeString generation of recursive objects"
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   429
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   430
    ^ RecursiveStoreError
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   431
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   432
    "
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
   433
     RecursiveStoreError handle:[:ex |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   434
	self halt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   435
     ] do:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   436
	|a|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   437
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   438
	a := Array new:1.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   439
	a at:1 put:a.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   440
	a storeOn:Transcript
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   441
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   442
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   443
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   444
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   445
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   446
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   447
     a := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   448
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   449
     a storeOn:Transcript
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   450
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   451
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   452
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   453
subclassResponsibilitySignal
23653
3ac335cea5d1 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23652
diff changeset
   454
    "deprecated - use SubclassResponsibilityError.
3ac335cea5d1 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23652
diff changeset
   455
     obsolete to not show up in selector completion."
3ac335cea5d1 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23652
diff changeset
   456
3ac335cea5d1 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23652
diff changeset
   457
    <resource: #obsolete>
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   458
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   459
    ^ SubclassResponsibilityError
23653
3ac335cea5d1 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23652
diff changeset
   460
3ac335cea5d1 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23652
diff changeset
   461
    "Modified (comment): / 29-01-2019 / 18:50:24 / Stefan Vogel"
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   462
!
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   463
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   464
subscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   465
    "return the signal used for subscript error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   466
     (this signal is used for example when an array is accessed with an
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   467
      index less than 1 or greater than the array size)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   468
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   469
    ^ SubscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   470
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   471
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   472
userInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   473
    "return the signal used for ^C interrupts handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   474
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   475
    ^ UserInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   476
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   477
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   478
userNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   479
    "the parent signal used with information and warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   480
     Handling this allows handling of both information- and warning notifications."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   481
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   482
    ^ UserNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   483
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   484
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
   485
warningSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   486
    "return the signal used for warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   487
     A handler for this signal gets all #warn: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   488
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   489
    ^ WarningSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   490
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   491
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   492
!Object class methodsFor:'info messages'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   493
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   494
infoPrinting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   495
    "return the flag which controls information messages."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   497
    ^ InfoPrinting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   498
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   499
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   500
infoPrinting:aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   501
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   502
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   503
    "turn on/off printing of information messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   504
     If the argument, aBoolean is false, infoPrint will not output
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   505
     messages. The default is true."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   506
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   507
    InfoPrinting := aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   508
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   509
25046
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
   510
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   511
!Object class methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   512
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   513
isAbstract
11221
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   514
    "Return if this class is an abstract class.
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   515
     True is returned for Object here; false for subclasses.
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
   516
     Abstract subclasses must redefine this again."
11221
1e88faaa1249 comment
Claus Gittinger <cg@exept.de>
parents: 11161
diff changeset
   517
8892
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   518
    ^ self == Object
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   519
!
5d05a7f150a5 +isAbstract
Claus Gittinger <cg@exept.de>
parents: 8879
diff changeset
   520
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   521
isBuiltInClass
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
   522
    "return true if this class is known by the run-time-system,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   523
     i.e. you cannot add/remove instance variables without recompiling
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   524
     the VM.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   525
     Here, true is returned for myself, false for subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   526
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   527
    ^ self == Object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   528
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   529
    "Modified: 23.4.1996 / 16:00:07 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   530
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   531
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
   532
21272
f7669b134b8b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 21258
diff changeset
   533
25046
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
   534
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
   535
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
   536
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
   537
14682
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   538
!Object methodsFor:'Compatibility-GNU'!
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   539
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   540
display
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   541
    "print the receiver on the standard output stream (which is not the Transcript).
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   542
     Added for GNU-ST compatibility"
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   543
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   544
    self print
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   545
!
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   546
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   547
displayNl
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   548
    "print the receiver followed by a cr on the standard output stream (which is not the Transcript).
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   549
     Added for GNU-ST compatibility"
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   550
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   551
    self printCR
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   552
! !
6451898ed2a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 14676
diff changeset
   553
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   554
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   555
!Object methodsFor:'Compatibility-ST80'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   556
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   557
isMetaclass
21317
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
   558
    "same as isMeta for ST80/Squeak and VW compatibility.
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
   559
     kept in the libbasic package, because it is used often"
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   560
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   561
    ^ self isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   562
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   563
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7216
diff changeset
   564
!Object methodsFor:'Compatibility-Squeak'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   565
16021
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
   566
isCompiledMethod
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
   567
    "same as isMethod - for squeak compatibility"
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
   568
21317
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
   569
    "/ left in libbasic package, because it is used by refactory code
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
   570
    ^ false
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   571
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   572
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   573
!Object methodsFor:'Compatibility-VW'!
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   574
8637
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   575
isCharacters
21317
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
   576
    "true, if the receiver is a string-like thing.
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
   577
     added for visual works compatibility"
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
   578
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   579
    "/ kept in libbasic package, because it is used in libjava and imap-implementation
8637
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   580
    ^ false
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   581
!
e7e695f53819 *** empty log message ***
penk
parents: 8632
diff changeset
   582
18151
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   583
isSignalledException
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   584
    "VW compatibility"
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   585
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   586
    ^ self isException
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   587
!
abf5900dc119 class: Object
Claus Gittinger <cg@exept.de>
parents: 18149
diff changeset
   588
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   589
keyNotFoundError:aKey
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   590
    "VW compatibility"
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   591
21317
6fac2f179739 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21278
diff changeset
   592
    "/ kept in libbasic package, because it is used by the refactory code
7567
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   593
    self errorKeyNotFound:aKey.
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   594
! !
1c1a49b3ebf0 compatibility
Claus Gittinger <cg@exept.de>
parents: 7566
diff changeset
   595
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   596
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   597
!Object methodsFor:'accessing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   598
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   599
_at:index
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   600
    "this is a synthetic selector, generated by the compiler,
24585
fa8fe00176f5 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24583
diff changeset
   601
     if a construct of the form expr[idx] is parsed.
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   602
     I.e. 
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   603
        foo[n]
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   604
     generates
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   605
        foo _at: n
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   606
    "
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   607
    ^ self at:index
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   608
!
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   609
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   610
_at:index1 at:index2
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   611
    "this is a synthetic selector, generated by the compiler,
24585
fa8fe00176f5 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24583
diff changeset
   612
     if a construct of the form expr[idx] is parsed.
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   613
     I.e. 
24585
fa8fe00176f5 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24583
diff changeset
   614
        foo[n][m]
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   615
     generates
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   616
        foo _at:n at:m
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   617
    "
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   618
    ^ (self at:index1) at:index2
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   619
!
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   620
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   621
_at:index1 at:index2 at:index3
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   622
    "this is a synthetic selector, generated by the compiler,
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   623
     if a construct of the form expr[idx...] is parsed.
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   624
     I.e. 
24585
fa8fe00176f5 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24583
diff changeset
   625
        foo[n][m][o]
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   626
     generates
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   627
        foo _at:n at:m at:o
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   628
    "
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   629
    ^ ((self at:index1) at:index2) at:index3
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   630
!
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   631
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   632
_at:index1 at:index2 at:index3 put:val
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   633
    "this is a synthetic selector, generated by the compiler,
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   634
     if a construct of the form expr[idx...] := val is parsed.
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   635
     I.e. 
24585
fa8fe00176f5 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24583
diff changeset
   636
        foo[n][m][o] := val
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   637
     generates
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   638
        foo _at:n at:m at:o put:val
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   639
    "
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   640
    ^ ((self at:index1) at:index2) at:index3 put:val
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   641
!
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   642
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   643
_at:index1 at:index2 put:val
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   644
    "this is a synthetic selector, generated by the compiler,
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   645
     if a construct of the form expr[idx...] := val is parsed.
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   646
     I.e. 
24585
fa8fe00176f5 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24583
diff changeset
   647
        foo[n][m] := val
24583
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   648
     generates
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   649
        foo _at:n at:m put:val
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   650
    "
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   651
    ^ (self at:index1) at:index2 put:val                   
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   652
!
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   653
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   654
_at:index put:val
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   655
    "this is a synthetic selector, generated by the compiler,
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   656
     if a construct of the form expr[idx...] := val is parsed.
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   657
     I.e. 
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   658
        foo[n] := val
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   659
     generates
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   660
        foo _at:n put:val
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   661
    "
97dfa6eae5bb #REFACTORING by exept
Claus Gittinger <cg@exept.de>
parents: 24561
diff changeset
   662
    ^ self at:index put:val
13320
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   663
!
Claus Gittinger <cg@exept.de>
parents: 13261
diff changeset
   664
14705
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   665
addSlot: slotName
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   666
    "dynamically add a new slot to the receiver.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   667
     The receiver must be a real object, not nil or a smallInteger"
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   668
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   669
    |classGetter myClass anonCls newObj|
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   670
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   671
    myClass := self class.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   672
    classGetter := ('%__get_',slotName,'__') asSymbol.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   673
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   674
    anonCls := self perform:classGetter ifNotUnderstood:nil.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   675
    anonCls isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   676
	anonCls := myClass
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   677
		subclass:(myClass name,'+',slotName) asSymbol
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   678
		instanceVariableNames:slotName
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   679
		classVariableNames:''
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   680
		poolDictionaries:'' category:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   681
		inEnvironment:nil.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   682
	anonCls compile:('%1 ^  %1' bindWith:slotName).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   683
	anonCls compile:('%1:v %1 := v' bindWith:slotName).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   684
	Class withoutUpdatingChangesDo:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   685
	    |m|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   686
	    m := Compiler compile:('__get_',slotName,' ^ #fooBar' bindWith:slotName) forClass:myClass install:false.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   687
	    m literalAt:(m literals indexOf:#fooBar) put:anonCls.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   688
	    myClass addSelector:classGetter withMethod:m.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   689
	].
14705
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   690
    ].
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   691
    newObj := anonCls cloneFrom:self.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   692
    self become:newObj.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   693
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   694
    "
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   695
     |p1 p2 p3|
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   696
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   697
     p1 := Point x:10 y:20.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   698
     p2 := Point x:100 y:200.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   699
     Transcript show:'p1 is '; showCR:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   700
     Transcript show:'p2 is '; showCR:p2.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   701
     p1 addSlot:'z'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   702
     p1 z:30.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   703
     Transcript show:'p1 is '; showCR:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   704
     Transcript show:'p2 is '; showCR:p2.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   705
     ObjectMemory dumpObject:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   706
     ObjectMemory dumpObject:p2.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   707
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   708
     p1 addSlot:'t'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   709
     p1 t:30.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   710
     Transcript show:'p1 is '; showCR:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   711
     ObjectMemory dumpObject:p1.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   712
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   713
     p3 := Point x:110 y:120.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   714
     p3 addSlot:'z'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   715
     p3 addSlot:'t'.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   716
     p1 inspect.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   717
     p2 inspect.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   718
     p3 inspect.
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   719
    "
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   720
!
35456d16bcea class: Object
Claus Gittinger <cg@exept.de>
parents: 14682
diff changeset
   721
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   722
at:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   723
    "return the indexed instance variable with index, anInteger;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   724
     this method can be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   725
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   726
    ^ self basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   727
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   728
24737
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   729
at:index ifAbsent:exceptionalValue
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   730
    "return the indexed instance variable with index, anInteger.
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   731
     If there is no such key, return the value from exceptionalValue.
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   732
     This method is usually be redefined in subclasses."
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   733
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   734
    index <= self size ifTrue:[
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   735
        ^ self basicAt:index
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   736
    ].
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   737
    ^ exceptionalValue value.
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   738
!
c8d6ba88a668 #BUGFIX by exept
Claus Gittinger <cg@exept.de>
parents: 24731
diff changeset
   739
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   740
at:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   741
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   742
     this method can be redefined in subclasses. Returns anObject (sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   743
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   744
    ^ self basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   745
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   746
    "Modified: 19.4.1996 / 11:13:29 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   747
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   748
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   749
basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   750
    "return the indexed instance variable with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   751
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   752
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   753
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   754
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
   755
#ifdef __SCHTEAM__
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   756
    {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   757
	int idx1Based = index.intValue();   // st index is 1 based
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   758
	return context._RETURN( self.basicAt( idx1Based ));
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   759
    }
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   760
    /* NOTREACHED */
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   761
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   762
    REGISTER int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   763
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   764
    REGISTER char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   765
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   766
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   767
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   768
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   769
     * this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   770
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   771
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   772
    if (__isSmallInteger(index)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   773
	myClass = __qClass(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   774
	indx = __intVal(index) - 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   775
	n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   776
	n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   777
	nbytes = __qSize(self) - n /* nInstBytes */;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   778
	pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   779
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   780
	switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   781
	    case __MASKSMALLINT(POINTERARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   782
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   783
		 * pointers
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   784
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   785
		if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   786
		    OBJ *op;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   787
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   788
		    op = (OBJ *)pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   789
		    RETURN ( *op );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   790
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   791
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   792
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   793
	    case __MASKSMALLINT(WKPOINTERARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   794
		if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   795
		    OBJ *op;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   796
		    OBJ el;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   797
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   798
		    op = (OBJ *)pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   799
		    el = *op;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   800
		    el = __WEAK_READ__(self, el);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   801
		    RETURN ( el );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   802
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   803
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   804
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   805
	    case __MASKSMALLINT(BYTEARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   806
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   807
		 * (unsigned) bytes
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   808
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   809
		if ((unsigned)indx < nbytes) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   810
		    unsigned char *cp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   811
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   812
		    cp = (unsigned char *)pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   813
		    RETURN ( __mkSmallInteger( (*cp & 0xFF)) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   814
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   815
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   816
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   817
	    case __MASKSMALLINT(FLOATARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   818
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   819
		 * native floats
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   820
		 */
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
   821
# ifdef __NEED_FLOATARRAY_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   822
		if ((INT)pFirst & (__FLOATARRAY_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   823
		    int delta = __FLOATARRAY_ALIGN - ((INT)pFirst & (__FLOATARRAY_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   824
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   825
		    pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   826
		    nbytes -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   827
		}
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
   828
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   829
		if ((unsigned)indx < (nbytes / sizeof(float))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   830
		    float *fp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   831
		    float f;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   832
		    OBJ v;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   833
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   834
		    fp = (float *)pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   835
		    f = *fp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   836
		    if (f == 0.0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   837
			v = STX__float0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   838
		    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   839
			__qMKSFLOAT(v, f);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   840
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   841
		    RETURN (v);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   842
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   843
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   844
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   845
	    case __MASKSMALLINT(DOUBLEARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   846
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   847
		 * native doubles
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   848
		 */
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   849
# ifdef __NEED_DOUBLE_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   850
		if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   851
		    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   852
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   853
		    pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   854
		    nbytes -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   855
		}
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   856
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   857
		if ((unsigned)indx < (nbytes / sizeof(double))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   858
		    double *dp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   859
		    double d;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   860
		    OBJ v;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   861
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   862
		    dp = (double *)pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   863
		    d = *dp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   864
		    if (d == 0.0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   865
			v = STX__float0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   866
		    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   867
			__qMKFLOAT(v, d);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   868
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   869
		    RETURN (v);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   870
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   871
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   872
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   873
	    case __MASKSMALLINT(WORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   874
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   875
		 * unsigned 16bit ints
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   876
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   877
		/* Notice: the hard coded shifts are by purpose;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   878
		 * it makes us independent of the short-size of the machine
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   879
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   880
		if ((unsigned)indx < (nbytes>>1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   881
		    unsigned short *sp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   882
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   883
		    sp = (unsigned short *)(pFirst + (indx<<1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   884
		    RETURN ( __mkSmallInteger( (*sp & 0xFFFF)) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   885
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   886
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   887
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   888
	    case __MASKSMALLINT(SWORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   889
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   890
		 * signed 16bit ints
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   891
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   892
		/* Notice: the hard coded shifts are by purpose;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   893
		 * it makes us independent of the short-size of the machine
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   894
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   895
		if ((unsigned)indx < (nbytes>>1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   896
		    short *ssp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   897
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   898
		    ssp = (short *)(pFirst + (indx<<1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   899
		    RETURN ( __mkSmallInteger( (*ssp) ));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   900
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   901
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   902
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   903
	    case __MASKSMALLINT(LONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   904
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   905
		 * unsigned 32bit ints
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   906
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   907
		/* Notice: the hard coded shifts are by purpose;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   908
		 * it makes us independent of the int-size of the machine
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   909
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   910
		if ((unsigned)indx < (nbytes>>2)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   911
		    unsigned int32 ul;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   912
		    unsigned int32 *lp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   913
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   914
		    lp = (unsigned int32 *)(pFirst + (indx<<2));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   915
		    ul = *lp;
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   916
# if __POINTER_SIZE__ == 8
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   917
		    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   918
			unsigned INT ull = (unsigned INT)ul;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   919
			RETURN ( __mkSmallInteger(ull) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   920
		    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   921
# else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   922
		    if (ul <= _MAX_INT) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   923
			RETURN ( __mkSmallInteger(ul) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   924
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   925
		    RETURN ( __MKULARGEINT(ul) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   926
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   927
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   928
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   929
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   930
	    case __MASKSMALLINT(SLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   931
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   932
		 * signed 32bit ints
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   933
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   934
		/* Notice: the hard coded shifts are by purpose;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   935
		 * it makes us independent of the int-size of the machine
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   936
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   937
		if ((unsigned)indx < (nbytes>>2)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   938
		    int32 *slp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   939
		    int32 l;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   940
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   941
		    slp = (int32 *)(pFirst + (indx<<2));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   942
		    l = *slp;
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   943
# if __POINTER_SIZE__ == 8
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   944
		    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   945
			INT ll = (INT)l;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   946
			RETURN ( __mkSmallInteger(ll) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   947
		    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   948
# else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   949
		    if (__ISVALIDINTEGER(l)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   950
			RETURN ( __mkSmallInteger(l) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   951
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   952
		    RETURN ( __MKLARGEINT(l) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   953
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   954
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   955
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   956
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   957
	    case __MASKSMALLINT(SLONGLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   958
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   959
		 * signed 64bit longlongs
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   960
		 */
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   961
# ifdef __NEED_LONGLONG_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   962
		if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   963
		    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   964
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   965
		    pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   966
		    nbytes -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   967
		}
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   968
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   969
		/* Notice: the hard coded shifts are by purpose;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   970
		 * it makes us independent of the long/longlong-size of the machine
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   971
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   972
		if ((unsigned)indx < (nbytes>>3)) {
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   973
# if __POINTER_SIZE__ == 8
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   974
		    INT *slp, ll;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   975
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   976
		    slp = (INT *)(pFirst + (indx<<3));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   977
		    ll = *slp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   978
		    if (__ISVALIDINTEGER(ll)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   979
			RETURN ( __mkSmallInteger(ll) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   980
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   981
		    RETURN ( __MKLARGEINT(ll) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   982
# else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   983
		    __int64__ *llp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   984
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   985
		    llp = (__int64__ *)(pFirst + (indx<<3));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   986
		    RETURN (__MKINT64(llp));
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   987
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   988
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   989
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   990
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   991
	    case __MASKSMALLINT(LONGLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   992
		/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   993
		 * unsigned 64bit longlongs
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   994
		 */
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
   995
# ifdef __NEED_LONGLONG_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   996
		if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   997
		    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   998
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
   999
		    pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1000
		    nbytes -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1001
		}
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1002
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1003
		/* Notice: the hard coded shifts are by purpose;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1004
		 * it makes us independent of the long/longlong-size of the machine
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1005
		 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1006
		if ((unsigned)indx < (nbytes>>3)) {
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1007
# if __POINTER_SIZE__ == 8
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1008
		    unsigned INT *ulp, ul;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1009
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1010
		    ulp = (unsigned INT *)(pFirst + (indx<<3));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1011
		    ul = *ulp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1012
		    if (ul <= _MAX_INT) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1013
			RETURN ( __mkSmallInteger(ul) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1014
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1015
		    RETURN ( __MKULARGEINT(ul) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1016
# else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1017
		    __uint64__ *llp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1018
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1019
		    llp = (__uint64__ *)(pFirst + (indx<<3));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1020
		    RETURN (__MKUINT64(llp));
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1021
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1022
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1023
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1024
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1025
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  1026
#endif /* ! __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1027
%}.
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1028
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1029
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1030
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1031
basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1032
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1033
     Returns anObject (sigh).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1034
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1035
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1036
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1037
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1038
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  1039
#ifdef __SCHTEAM__
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1040
    {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1041
	int idx1Based = index.intValue();   // st index is 1 based
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1042
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1043
	self.basicAt_put(idx1Based, anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1044
	return context._RETURN( anObject );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1045
    }
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1046
    /* NOTREACHED */
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1047
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1048
    register int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1049
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1050
    register char *pFirst;
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1051
    /* int nInstBytes, ninstvars, flags; */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1052
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1053
    unsigned int u;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1054
    int val;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1055
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1056
    /* notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1057
       this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1058
       and SmallInteger */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1059
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1060
    if (__isSmallInteger(index)
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1061
     && !__isImmutable(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1062
	indx = __intVal(index) - 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1063
	myClass = __qClass(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1064
	n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1065
	n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1066
	nbytes = __qSize(self) - n /* nInstBytes */;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1067
	pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1068
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1069
	switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1070
	    case __MASKSMALLINT(POINTERARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1071
		if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1072
		    OBJ *op;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1073
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1074
		    op = (OBJ *)pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1075
		    *op = anObject;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1076
		    __STORE(self, anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1077
		    RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1078
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1079
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1080
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1081
	    case __MASKSMALLINT(WKPOINTERARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1082
		if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1083
		    OBJ *op;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1084
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1085
		    op = (OBJ *)pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1086
		    *op = anObject;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1087
		    __STORE(self, anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1088
		    __WEAK_WRITE__(self, anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1089
		    RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1090
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1091
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1092
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1093
	    case __MASKSMALLINT(BYTEARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1094
		if (__isSmallInteger(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1095
		    val = __intVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1096
		    if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1097
			if ((unsigned)indx < nbytes) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1098
			    char *cp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1099
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1100
			    cp = pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1101
			    *cp = val;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1102
			    RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1103
			}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1104
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1105
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1106
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1107
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1108
	    case __MASKSMALLINT(FLOATARRAY):
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1109
# ifdef __NEED_FLOATARRAY_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1110
		if ((INT)pFirst & (__FLOATARRAY_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1111
		    int delta = __FLOATARRAY_ALIGN - ((INT)pFirst & (__FLOATARRAY_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1112
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1113
		    pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1114
		    nbytes -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1115
		}
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1116
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1117
		if ((unsigned)indx < (nbytes / sizeof(float))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1118
		    float *fp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1119
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1120
		    fp = (float *)pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1121
		    if (anObject != nil) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1122
			if (! __isSmallInteger(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1123
			    if (__qIsFloatLike(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1124
				*fp = (float)(__floatVal(anObject));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1125
				RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1126
			    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1127
			    if (__qIsShortFloat(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1128
				*fp = __shortFloatVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1129
				RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1130
			    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1131
			} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1132
			    *fp = (float) __intVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1133
			    RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1134
			}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1135
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1136
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1137
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1138
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1139
	    case __MASKSMALLINT(DOUBLEARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1140
# ifdef __NEED_DOUBLE_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1141
		if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1142
		    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1143
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1144
		    pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1145
		    nbytes -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1146
		}
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1147
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1148
		if ((unsigned)indx < (nbytes / sizeof(double))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1149
		    double *dp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1150
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1151
		    dp = (double *)pFirst + indx;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1152
		    if (anObject != nil) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1153
			if (! __isSmallInteger(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1154
			    if (__qIsFloatLike(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1155
				*dp = __floatVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1156
				RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1157
			    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1158
			    if (__qIsShortFloat(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1159
				*dp = (double)__shortFloatVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1160
				RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1161
			    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1162
			} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1163
			    *dp = (double) __intVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1164
			    RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1165
			}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1166
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1167
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1168
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1169
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1170
	    case __MASKSMALLINT(WORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1171
		if (__isSmallInteger(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1172
		    val = __intVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1173
		    if ((unsigned)val <= 0xFFFF) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1174
			if ((unsigned)indx < (nbytes>>1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1175
			    unsigned short *sp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1176
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1177
			    sp = (unsigned short *)(pFirst + (indx<<1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1178
			    *sp = val;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1179
			    RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1180
			}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1181
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1182
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1183
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1184
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1185
	    case __MASKSMALLINT(SWORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1186
		if (__isSmallInteger(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1187
		    val = __intVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1188
		    if ((val >= -32768) && (val < 32768)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1189
			if ((unsigned)indx < (nbytes>>1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1190
			    short *ssp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1191
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1192
			    ssp = (short *)(pFirst + (indx<<1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1193
			    *ssp = val;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1194
			    RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1195
			}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1196
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1197
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1198
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1199
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1200
	    case __MASKSMALLINT(SLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1201
		if ((unsigned)indx < (nbytes>>2)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1202
		    int32 *slp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1203
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1204
		    slp = (int32 *)(pFirst + (indx<<2));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1205
		    if (__isSmallInteger(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1206
			*slp = __intVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1207
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1208
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1209
		    n = __signedLongIntVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1210
		    /*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1211
		     * zero means failure for an int larger than INT-size bytes
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1212
		     * (would be a smallInteger)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1213
		     */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1214
		    if (n) {
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1215
# if __POINTER_SIZE__ == 8
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1216
			if ((n >= -0x80000000) && (n < 0x80000000))
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1217
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1218
			{
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1219
			    *slp = n;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1220
			    RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1221
			}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1222
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1223
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1224
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1225
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1226
	    case __MASKSMALLINT(LONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1227
		if ((unsigned)indx < (nbytes>>2)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1228
		    unsigned int32 *lp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1229
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1230
		    lp = (unsigned int32 *)(pFirst + (indx<<2));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1231
		    if (anObject == __mkSmallInteger(0)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1232
			*lp = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1233
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1234
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1235
		    u = __longIntVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1236
		    /*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1237
		     * zero means failure for an int larger than 4 bytes
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1238
		     * (would be a smallInteger)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1239
		     */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1240
		    if (u) {
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1241
# if __POINTER_SIZE__ == 8
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1242
			if (u <= 0xFFFFFFFF)
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1243
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1244
			{
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1245
			    *lp = u;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1246
			    RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1247
			}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1248
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1249
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1250
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1251
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1252
	    case __MASKSMALLINT(SLONGLONGARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1253
# ifdef __NEED_LONGLONG_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1254
		if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1255
		    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1256
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1257
		    pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1258
		    nbytes -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1259
		}
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1260
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1261
		if ((unsigned)indx < (nbytes>>3)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1262
		    __int64__ ll;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1263
		    __int64__ *sllp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1264
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1265
		    sllp = (__int64__ *)(pFirst + (indx<<3));
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  1266
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1267
# if __POINTER_SIZE__ == 8
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1268
		    if (__isSmallInteger(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1269
			*sllp = __intVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1270
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1271
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1272
		    n = __signedLongIntVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1273
		    if (n) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1274
			*sllp = n;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1275
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1276
		    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1277
# else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1278
		    if (anObject == __mkSmallInteger(0)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1279
			ll.lo = ll.hi = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1280
			*sllp = ll;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1281
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1282
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1283
		    if (__signedLong64IntVal(anObject, &ll)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1284
			*sllp = ll;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1285
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1286
		    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1287
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1288
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1289
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1290
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1291
	    case __MASKSMALLINT(LONGLONGARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1292
# ifdef __NEED_LONGLONG_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1293
		if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1294
		    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1295
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1296
		    pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1297
		    nbytes -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1298
		}
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1299
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1300
		if ((unsigned)indx < (nbytes>>3)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1301
		    __uint64__ ll;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1302
		    __uint64__ *llp;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1303
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1304
		    llp = (__uint64__ *)(pFirst + (indx<<3));
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1305
# if __POINTER_SIZE__ == 8
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1306
		    if (__isSmallInteger(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1307
			*llp = __intVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1308
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1309
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1310
		    ll = __longIntVal(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1311
		    if (ll) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1312
			*llp = ll;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1313
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1314
		    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1315
# else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1316
		    if (anObject == __mkSmallInteger(0)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1317
			ll.lo = ll.hi = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1318
			*llp = ll;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1319
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1320
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1321
		    if (__unsignedLong64IntVal(anObject, &ll)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1322
			*llp = ll;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1323
			RETURN ( anObject );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1324
		    }
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  1325
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1326
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1327
		break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1328
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1329
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  1330
#endif /* ! __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1331
%}.
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1332
    "/ arrive here only in case of an error
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1333
    self isImmutable ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1334
	self noModificationError
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1335
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1336
    index isInteger ifFalse:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1337
	"/ the index should be an integer number
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1338
	^ self indexNotInteger:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1339
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1340
    (index between:1 and:self size) ifFalse:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1341
	"/ the index is less than 1 or greater than the size of the
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1342
	"/ receiver collection
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1343
	^ self subscriptBoundsError:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1344
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1345
    (self class isFloatsOrDoubles) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1346
	anObject isNumber ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1347
	    ^ self basicAt:index put:(anObject asFloat)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1348
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1349
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1350
    anObject isInteger ifFalse:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1351
	"/ the object to put into the receiver collection
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1352
	"/ should be an integer number
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1353
	^ self elementNotInteger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1354
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1355
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1356
     the object to put into the receiver collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1357
     is not an instance of the expected element class,
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  1358
     or the value is not within the element's valid range.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1359
    "
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  1360
    ^ self elementBoundsError:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1361
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1362
    "Modified: 19.4.1996 / 11:14:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1363
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1364
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1365
byteAt:index
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1366
    "return the byte at index.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1367
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1368
     (i.e. byteArrays, wordArrays, floatArrays etc.).
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1369
     The receiver's indexed instvars are treated as an uninterpreted
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1370
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1371
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1372
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1373
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1374
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1375
    if (__isSmallInteger(index)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1376
	OBJ slf = self;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1377
	if (__isNonNilObject(slf)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1378
	    OBJ cls = __qClass(slf);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1379
	    INT indx = __intVal(index) - 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1380
	    INT nIndex = __byteArraySize(slf);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1381
	    unsigned char *pFirst = __byteArrayVal(slf) + __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1382
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1383
	    switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1384
		case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1385
#ifdef __NEED_DOUBLE_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1386
		    if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1387
			int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1388
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1389
			pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1390
			nIndex -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1391
		    }
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1392
#endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1393
		    goto common;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1394
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1395
		case __MASKSMALLINT(FLOATARRAY):
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1396
#ifdef __NEED_FLOATARRY_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1397
		    if ((INT)pFirst & (__FLOATARRY_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1398
			int delta = __FLOATARRY_ALIGN - ((INT)pFirst & (__FLOATARRY_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1399
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1400
			pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1401
			nIndex -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1402
		    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1403
#endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1404
		    goto common;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1405
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1406
		case __MASKSMALLINT(LONGLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1407
		case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1408
#ifdef __NEED_LONGLONG_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1409
		    if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1410
			int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1411
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1412
			pFirst += delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1413
			nIndex -= delta;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1414
		    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1415
#endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1416
		    goto common;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1417
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1418
		case __MASKSMALLINT(BYTEARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1419
		case __MASKSMALLINT(WORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1420
		case __MASKSMALLINT(LONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1421
		case __MASKSMALLINT(SWORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1422
		case __MASKSMALLINT(SLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1423
	    common:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1424
		    if ((unsigned)indx < (unsigned)nIndex) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1425
			RETURN ( __mkSmallInteger( (INT)(pFirst[indx])) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1426
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1427
		    break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1428
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1429
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1430
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1431
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1432
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1433
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1434
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1435
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1436
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1437
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1438
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1439
     Point new byteAt:1
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1440
     (ByteArray with:1 with:2) byteAt:2
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1441
     (WordArray with:1) byteAt:1
19841
b0023122a5aa #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19802
diff changeset
  1442
     (WordArray with:1) byteAt:2
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1443
     (FloatArray with:1.0) byteAt:2
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1444
     'hello' byteAt:1
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1445
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1446
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1447
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1448
byteAt:index put:byteValue
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1449
    "set the byte at index.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1450
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1451
     (i.e. byteArrays, wordArrays, floatArrays etc.).
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  1452
     The receiver's indexed instvars are treated as an uninterpreted
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1453
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1454
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1455
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1456
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1457
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1458
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1459
    int val, nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1460
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1461
    REGISTER OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1462
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1463
    if (__bothSmallInteger(index, byteValue)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1464
	val = __intVal(byteValue);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1465
	if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1466
	    slf = self;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1467
	    if (__isNonNilObject(slf)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1468
		int nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1469
		cls = __qClass(slf);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1470
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1471
		indx = __intVal(index) - 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1472
		switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1473
		    case __MASKSMALLINT(DOUBLEARRAY):
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1474
# ifdef __NEED_DOUBLE_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1475
			nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1476
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1477
			goto common;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1478
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1479
		    case __MASKSMALLINT(FLOATARRAY):
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1480
# ifdef __NEED_FLOATARRAY_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1481
			nInstBytes = (nInstBytes-1+__FLOATARRAY_ALIGN) &~ (__FLOATARRAY_ALIGN-1);
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1482
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1483
			goto common;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1484
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1485
		    case __MASKSMALLINT(LONGLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1486
		    case __MASKSMALLINT(SLONGLONGARRAY):
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1487
# ifdef __NEED_LONGLONG_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1488
			nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  1489
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1490
			goto common;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1491
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1492
		    case __MASKSMALLINT(BYTEARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1493
		    case __MASKSMALLINT(WORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1494
		    case __MASKSMALLINT(LONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1495
		    case __MASKSMALLINT(SWORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1496
		    case __MASKSMALLINT(SLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1497
		common:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1498
			indx += nInstBytes;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1499
			nIndex = __byteArraySize(slf);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1500
			if ((unsigned)indx < (unsigned)nIndex) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1501
			    __ByteArrayInstPtr(slf)->ba_element[indx] = val;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1502
			    RETURN ( byteValue );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1503
			}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1504
			break;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1505
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1506
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1507
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1508
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1509
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1510
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1511
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1512
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1513
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1514
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1515
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1516
     (ByteArray with:1 with:2) byteAt:2 put:3; yourself
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1517
     'hello' copy byteAt:1 put:105; yourself
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1518
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1519
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1520
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1521
instVarAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1522
    "return a non-indexed instance variable;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1523
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1524
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1525
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1526
%{  /* NOCONTEXT */
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1527
#ifdef __SCHTEAM__
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1528
    return context._RETURN( self.instVarAt(index.intValue()-1) );
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1529
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1530
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1531
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1532
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1533
    if (__isSmallInteger(index)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1534
	myClass = __Class(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1535
	idx = __intVal(index) - 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1536
	/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1537
	 * do not allow returning of non-object fields.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1538
	 * if subclass did not make provisions for that,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1539
	 * we won't do so here ...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1540
	 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1541
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1542
	    if (idx == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1543
		RETURN ( nil )
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1544
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1545
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1546
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1547
	if ((idx >= 0) && (idx < ninstvars)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1548
	    // do not trust the ninstvars slot - verify
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1549
	    if ((__OBJS2BYTES__(ninstvars) + OHDR_SIZE) <= __qSize(self)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1550
		RETURN ( __InstPtr(self)->i_instvars[idx] );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1551
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1552
	    console_printf("[VM] warning: bad ninsts in class\n");
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1553
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1554
    }
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1555
#endif /* not SCHTEAM */
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1556
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1557
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1558
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1559
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1560
instVarAt:index put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1561
    "change a non-indexed instance variable;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1562
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1563
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1564
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1565
%{  /* NOCONTEXT */
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1566
#ifdef __SCHTEAM__
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1567
    self.instVarAt_put(index.intValue()-1, value);
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1568
    return context._RETURN( value );
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1569
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1570
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1571
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1572
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1573
    if (__isSmallInteger(index)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1574
	myClass = __Class(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1575
	idx = __intVal(index) - 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1576
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1577
	/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1578
	 * do not allow setting of non-object fields.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1579
	 * if subclass did not make provisions for that,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1580
	 * we won't do so here ...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1581
	 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1582
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1583
	    if (idx == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1584
		RETURN ( nil )
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1585
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1586
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1587
	if ((idx >= 0) && (idx < ninstvars)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1588
	    // do not trust the ninstvars slot - verify
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1589
	    if ((__OBJS2BYTES__(ninstvars) + OHDR_SIZE) <= __qSize(self)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1590
		__InstPtr(self)->i_instvars[idx] = value;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1591
		__STORE(self, value);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1592
		RETURN ( value );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1593
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1594
	    console_printf("[VM] warning: bad ninsts in class\n");
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1595
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1596
    }
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1597
#endif /* not SCHTEAM */
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1598
%}.
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  1599
    ^ self indexNotIntegerOrOutOfBounds:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1600
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1601
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1602
instVarNamed:name
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1603
    "return a non-indexed instance variables value by name;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1604
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1605
     - use with care if at all (provided for inspectors and memory usage monitor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1606
     Notice, this access is very slow (because the classes instVar-description has to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1607
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1608
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1609
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1610
15449
2a27aa34e65b class: Object
Claus Gittinger <cg@exept.de>
parents: 15439
diff changeset
  1611
    idx := self class instVarIndexFor:name.
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1612
    idx isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1613
	^ self errorKeyNotFound:name.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  1614
    ].
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1615
    ^ self instVarAt:idx.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1616
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1617
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1618
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1619
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1620
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1621
     p := Point x:10 y:20.
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1622
     p instVarNamed:'cx'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1623
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1624
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1625
    "Modified: 19.4.1996 / 11:12:39 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1626
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1627
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1628
instVarNamed:name ifAbsent:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1629
    "return a non-indexed instance variables value by name,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1630
     or the value of exceptionBlock, if there is no such instance variable.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1631
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1632
     - use with care if at all (provided for inspectors and memory usage monitor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1633
     Notice, this access is very slow (because the classes instVar-description has to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1634
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1635
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1636
    |idx|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1637
15449
2a27aa34e65b class: Object
Claus Gittinger <cg@exept.de>
parents: 15439
diff changeset
  1638
    idx := self class instVarIndexFor:name.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1639
    idx isNil ifTrue:[^ exceptionBlock value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1640
    ^ self instVarAt:idx
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1641
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1642
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1643
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1644
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1645
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1646
     p := Point x:10 y:20.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1647
     p instVarNamed:'x'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1648
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1649
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1650
    "Created: 6.7.1996 / 23:02:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1651
    "Modified: 6.7.1996 / 23:03:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1652
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1653
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1654
instVarNamed:name put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1655
    "set a non-indexed instance variable by name;
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1656
     peeking into an object this way is not very object oriented
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1657
     - if at all, use with care (provided for protocol completeness).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1658
     Notice, this access is very slow (because the classes instVar-description has to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1659
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1660
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1661
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1662
15449
2a27aa34e65b class: Object
Claus Gittinger <cg@exept.de>
parents: 15439
diff changeset
  1663
    idx := self class instVarIndexFor:name.
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1664
    idx isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1665
	^ self errorKeyNotFound:name.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  1666
    ].
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1667
    ^ self instVarAt:idx put:value.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1668
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1669
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1670
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1671
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1672
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1673
     p instVarNamed:'x' put:30.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1674
     p
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1675
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1676
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1677
    "Modified: 19.4.1996 / 11:12:49 / cg"
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1678
!
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1679
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1680
instVarNamed:name put:anObject ifAbsent:exceptionBlock
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1681
    "return a non-indexed instance variables value by name,
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1682
     or the value of exceptionBlock, if there is no such instance variable.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1683
     peeking into an object this way is not very object oriented
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1684
     - use with care if at all (provided for inspectors and memory usage monitor).
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1685
     Notice, this access is very slow (because the classes instVar-description has to be
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1686
     parsed ad runtime)"
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1687
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1688
    |idx|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1689
15449
2a27aa34e65b class: Object
Claus Gittinger <cg@exept.de>
parents: 15439
diff changeset
  1690
    idx := self class instVarIndexFor:name.
10918
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1691
    idx isNil ifTrue:[^ exceptionBlock value].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1692
    ^ self instVarAt:idx put:anObject.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1693
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1694
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1695
    "
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1696
     |p|
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1697
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1698
     p := Point x:10 y:20.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1699
     p instVarNamed:'x' put:4711 ifAbsent:[self halt:'no such instvar'].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1700
     p instVarNamed:'bla' put:4712 ifAbsent:[self halt:'no such instvar'].
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1701
     p inspect.
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1702
    "
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1703
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1704
    "Created: 6.7.1996 / 23:02:49 / cg"
a4635305501e #instVarNamed* - raise KeyNotFoundError if an instaver does not exist
Stefan Vogel <sv@exept.de>
parents: 10877
diff changeset
  1705
    "Modified: 6.7.1996 / 23:03:41 / cg"
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1706
!
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1707
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1708
nilAllInstvars
18254
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1709
    "overwrite all inst vars of the object with nil.
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1710
     Used by the crypto package to clear objects with
aba026de53b8 comments
Claus Gittinger <cg@exept.de>
parents: 18240
diff changeset
  1711
     keys when no longer in use."
16230
e5de942a1a19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16229
diff changeset
  1712
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1713
%{  /* NOCONTEXT */
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1714
    int flags;
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1715
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1716
    if (!__isNonNilObject(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1717
	RETURN(self);
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1718
    }
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1719
    /*
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1720
     * bail out for special (weak) objects ..
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1721
     */
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1722
    flags = __intVal(__ClassInstPtr(__qClass(self))->c_flags);
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1723
    if (((flags & ~ARRAYMASK) == 0)
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1724
	&& ((flags & ARRAYMASK) != WKPOINTERARRAY)
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1725
    ) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1726
	bzero((void *)__InstPtr(self)->i_instvars, __qSize(self)-OHDR_SIZE);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1727
	RETURN(self);
16125
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1728
    }
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1729
%}.
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1730
    "/ fail for special objects
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1731
    ^ self primitiveFailed
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1732
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1733
    "
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1734
      'abcdef' copy nilAllInstvars
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1735
      100 factorial nilAllInstvars
2096ee4fa6bd class: Object
Stefan Vogel <sv@exept.de>
parents: 16052
diff changeset
  1736
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1737
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1738
25046
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
  1739
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
  1740
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1741
!Object methodsFor:'attributes access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1742
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1743
objectAttributeAt:attributeKey
22008
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1744
    "return the attribute for a given key or nil if not found.
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1745
     Such attributes behave like dynamically addable slots in languages like JavaScript.
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1746
     They are much more expensive though, because they are not a ''natural'' mechanism in Smalltalk,
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1747
     but instead simulated via an additional objectAttributes collection mechanism, which
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1748
     defaults to using a dictionary holding per instance attributes.
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1749
     So only use it for seldom needed/seldom assigned attributes,
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1750
     and only if it is not easy to add an instance variable or class-private mechanism for that."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1752
    | attrs |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1753
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1754
    attrs := self objectAttributes.
17174
c78f65f2f43d class: Object
Stefan Vogel <sv@exept.de>
parents: 17168
diff changeset
  1755
    attrs size ~~ 0 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1756
	^ attrs at:attributeKey ifAbsent:nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1757
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1758
    ^ nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1759
22008
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1760
    "Created: / 22-01-1998 / 21:29:17 / av"
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1761
    "Modified: / 03-02-1998 / 18:55:55 / cg"
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1762
    "Modified (comment): / 13-07-2017 / 14:26:38 / cg"
23031
9baa6604dedb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23025
diff changeset
  1763
    "Modified: / 28-05-2018 / 16:18:59 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1764
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1765
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1766
objectAttributeAt:attributeKey put:anObject
22008
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1767
    "store the attribute anObject referenced by key into the receiver.
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1768
     Such attributes behave like dynamically addable slots in languages like JavaScript.
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1769
     They are much more expensive though, because they are not a ''natural'' mechanism in Smalltalk,
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1770
     but instead simulated via an additional objectAttributes collection mechanism, which
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1771
     defaults to using a dictionary holding per instance attributes.
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1772
     So only use it for seldom needed/seldom assigned attributes,
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1773
     and only if it is not easy to add an instance variable or class-private mechanism for that."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1774
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1775
    "/ must do this save from being reentered, since the attributes collection
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1776
    "/ is possibly accessed from multiple threads...
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1777
    ObjectAttributesAccessLock critical:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1778
	| attrs |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1779
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1780
	attrs := self objectAttributes.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1781
	"/ only need a WeakIdentityDictionary, if there are any non-symbol keys in
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1782
	"/ it. Start with a regular IDDict, and migrate to WeakIDDict if ever required.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1783
	"/ Typically, this never happens (but does in the UIPainter!!)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1784
	attrs isEmptyOrNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1785
	    attributeKey isSymbol ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1786
		attrs := IdentityDictionary new.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1787
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1788
		attrs := WeakIdentityDictionary new.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1789
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1790
	    attrs at:attributeKey put:anObject.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1791
	    self objectAttributes:attrs.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1792
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1793
	    attributeKey isSymbol ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1794
		attrs isWeakCollection ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1795
		    "first non-symbol attributeKey - convert to WeakIdentityDictionary"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1796
		    attrs := WeakIdentityDictionary new declareAllFrom:attrs.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1797
		    self objectAttributes:attrs.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1798
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1799
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1800
	    attrs at:attributeKey put:anObject.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1801
	].
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1802
    ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1803
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1804
    "Attaching additional attributes (slots) to an arbitrary object:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1805
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1806
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1807
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1808
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1809
     p objectAttributeAt:#color put:#green.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1810
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1811
     p objectAttributeAt:#color
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1812
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1813
22008
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1814
    "Created: / 22-01-1998 / 21:29:25 / av"
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1815
    "Modified: / 03-02-1998 / 18:57:58 / cg"
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1816
    "Modified (comment): / 13-07-2017 / 14:28:44 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1817
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1818
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1819
objectAttributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1820
    "return a Collection of attributes - nil if there is none.
22008
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1821
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1822
     The default implementation here uses a global WeakDictionary to store attributes
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1823
     This may be too slow for high frequency slot access,
22008
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1824
     therefore, some classes may redefine this for better performance.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1825
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1826
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1827
    ^ ObjectAttributes at:self ifAbsent:[nil]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1828
22008
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1829
    "Created: / 22-01-1998 / 21:29:30 / av"
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1830
    "Modified: / 18-02-2000 / 11:34:16 / cg"
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1831
    "Modified (comment): / 13-07-2017 / 14:28:53 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1832
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1833
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1834
objectAttributes:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1835
    "set the collection of attributes.
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1836
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1837
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1838
     attributes which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1839
     Therefore, some classes may redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1840
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1841
    "/ must do this save from being reentered, since the attributes collection
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1842
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1843
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1844
    ObjectAttributesAccessLock critical:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1845
	aCollection isEmptyOrNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1846
	    ObjectAttributes removeKey:self ifAbsent:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1847
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1848
	    ObjectAttributes at:self put:aCollection
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1849
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1850
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1851
22008
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1852
    "Created: / 22-01-1998 / 21:29:35 / av"
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1853
    "Modified: / 03-02-1998 / 18:58:10 / cg"
fa021caa35e0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21810
diff changeset
  1854
    "Modified (comment): / 13-07-2017 / 14:28:58 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1855
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1856
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1857
removeObjectAttribute:attributeKey
19846
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1858
    "remove an object attribute;
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1859
     return the value previously stored there, or nil.
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1860
     (make the argument, anObject be no longer an attribute of the receiver)"
08805f2c0810 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19841
diff changeset
  1861
16291
5fa03fd6dd29 class: Object
Claus Gittinger <cg@exept.de>
parents: 16251
diff changeset
  1862
    "/ must do this save from being reentered, since the attributes collection
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1863
    "/ is possibly accessed from multiple threads.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  1864
    ^ ObjectAttributesAccessLock critical:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1865
	|attrs oldVal|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1866
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1867
	attrs := self objectAttributes.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1868
	attrs notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1869
	    attrs notEmpty ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1870
		oldVal := attrs removeKey:attributeKey ifAbsent:nil.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1871
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1872
	    attrs isEmpty ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1873
		self objectAttributes:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1874
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1875
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1876
	oldVal
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  1877
    ].
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  1878
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  1879
    "Created: / 22-01-1998 / 21:29:39 / av"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  1880
    "Modified: / 18-02-2000 / 11:32:19 / cg"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  1881
    "Modified: / 15-03-2017 / 17:25:12 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1882
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1883
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  1884
25046
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
  1885
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
  1886
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1887
!Object methodsFor:'change & update'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1888
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1889
broadcast:aSelectorSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1890
    "send a message with selector aSelectorSymbol to all my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1891
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1892
    self dependentsDo:[:dependent |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1893
	dependent perform:aSelectorSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1894
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1895
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1896
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1897
broadcast:aSelectorSymbol with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1898
    "send a message with selector aSelectorSymbol with an additional
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1899
     argument anArgument to all my dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1900
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1901
    self dependentsDo:[:dependent |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1902
	dependent perform:aSelectorSymbol with:anArgument
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1903
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1904
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1905
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1906
changeRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1907
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1908
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1909
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1910
    self dependentsDo:[:dependent |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1911
	dependent updateRequest ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1912
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1913
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1914
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1915
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1916
changeRequest:aSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1917
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1918
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1919
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1920
    self dependentsDo:[:dependent |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1921
	(dependent updateRequest:aSymbol) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1922
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1923
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1924
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1925
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1926
changeRequest:aSymbol from:anObject
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1927
    "the receiver wants to change - check if all dependents
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1928
     except anObject grant the request, and return true if so.
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1929
     The argument anObject is typically going to be the one who is
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1930
     about to send the change request."
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1931
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1932
    ^ self changeRequest:aSymbol with:nil from:anObject
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1933
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1934
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1935
changeRequest:aSymbol with:aParameter
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1936
    "the receiver wants to change - check if all dependents
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1937
     grant the request, and return true if so"
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1938
11573
cc09bff8a992 *** empty log message ***
ca
parents: 11551
diff changeset
  1939
    ^ self changeRequest:aSymbol with:aParameter from:self
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1940
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1941
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  1942
changeRequest:aSymbol with:aParameter from:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1943
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1944
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1945
     The argument anObject is typically going to be the one who is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1946
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1947
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1948
    self dependentsDo:[:dependent |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1949
	dependent == anObject ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1950
	    (dependent updateRequest:aSymbol with:aParameter from:anObject) ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1951
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1952
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1953
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1954
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1955
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1956
changeRequestFrom:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1957
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1958
     except anObject grant the request, and return true if so.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1959
     The argument anObject is typically going to be the one who is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1960
     about to send the change request."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1961
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1962
    self dependentsDo:[:dependent |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1963
	dependent == anObject ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1964
	    (dependent updateRequest) ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1965
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1966
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1967
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1968
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1969
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1970
changed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1971
    "notify all dependents that the receiver has changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1972
     Each dependent gets a '#update:'-message with the original
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1973
     receiver as argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1974
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1975
    self changed:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1976
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1977
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1978
changed:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1979
    "notify all dependents that the receiver has changed somehow.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1980
     Each dependent gets a '#update:'-message with aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1981
     as argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1982
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1983
    self changed:aParameter with:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1984
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1985
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1986
changed:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1987
    "notify all dependents that the receiver has changed somehow.
19583
af9f1124bd5a #DOCUMENTATION by Maren
matilk
parents: 19550
diff changeset
  1988
     Each dependent gets an '#update:with:from:'-message, with aParameter
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1989
     and anArgument as arguments."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1990
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  1991
    self dependentsDo:[:dependent |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  1992
	dependent update:aParameter with:anArgument from:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1993
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1994
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1995
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1996
update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1997
    "the message is sent to a dependent, when one of the objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1998
     on whom the receiver depends, has changed. The argument aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1999
     is either the changed object or the argument to the #changed: message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2000
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2001
     Default behavior here is to do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2002
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2003
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2004
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2005
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2006
update:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2007
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2008
     Default is to try update:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2009
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2010
    ^ self update:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2011
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2012
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2013
update:aParameter with:anArgument from:sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2014
    "dependent is notified of some change -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2015
     Default is to try update:with:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2016
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2017
    ^ self update:aParameter with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2018
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2019
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2020
updateRequest
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2021
    "return true if an update request is granted.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2022
     Default here is to grant updates - may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2023
     to lock updates if someone is making other changes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2024
     from within an update. Or if someone has locked its
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2025
     state and does not want others to change things.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2026
     However, these dependents must all honor the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2027
     changeRequest - ifTrue - change protocol. I.e. they
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2028
     must first ask all others via changeRequest, and only do the change
23875
cc97568e92a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23833
diff changeset
  2029
     if it returns true. The dependents must decide in updateRequest and
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2030
     return true if they think a change is ok."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2031
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2032
    ^ true
23875
cc97568e92a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23833
diff changeset
  2033
cc97568e92a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23833
diff changeset
  2034
    "Modified (comment): / 12-03-2019 / 20:52:12 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2035
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2036
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2037
updateRequest:aSymbol
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2038
    "return true if an update request is granted.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2039
     Default here a simple updateRequest"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2040
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2041
    ^ self updateRequest
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2042
!
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2043
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2044
updateRequest:aSymbol with:aParameter
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2045
    "return true if an update request is granted.
23875
cc97568e92a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23833
diff changeset
  2046
     Default here is a simple updateRequest"
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2047
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2048
    ^ self updateRequest:aSymbol
23875
cc97568e92a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23833
diff changeset
  2049
cc97568e92a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23833
diff changeset
  2050
    "Modified (comment): / 12-03-2019 / 20:52:32 / Claus Gittinger"
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2051
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2052
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2053
updateRequest:aSymbol with:aParameter from:sender
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2054
    "return true if an update request is granted.
23875
cc97568e92a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23833
diff changeset
  2055
     Default here is a simple updateRequest"
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2056
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2057
    ^ self updateRequest:aSymbol with:aParameter
23875
cc97568e92a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23833
diff changeset
  2058
cc97568e92a1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23833
diff changeset
  2059
    "Modified (comment): / 12-03-2019 / 20:52:37 / Claus Gittinger"
11551
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2060
!
170f7fae1bfc updateRequest
Claus Gittinger <cg@exept.de>
parents: 11541
diff changeset
  2061
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2062
withoutUpdating:someone do:aBlock
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2063
    "evaluate a block but remove someone from my dependents temporarily"
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2064
23752
e811826de0d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23750
diff changeset
  2065
    (self dependents includesIdentical:someone) ifFalse:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2066
	^ aBlock value.
7177
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2067
    ].
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2068
    self removeDependent:someone.
2bfa42d795a0 added withoutUpdating:do:
martin
parents: 7159
diff changeset
  2069
    ^ aBlock ensure:[ self addDependent:someone ]
23750
be135a7c9e83 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23716
diff changeset
  2070
23752
e811826de0d0 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23750
diff changeset
  2071
    "Modified (format): / 19-02-2019 / 23:43:59 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2072
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2073
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2074
!Object methodsFor:'comparing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2075
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2076
= anObject
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2077
    "return true if the receiver and the arg have the same structure.
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2078
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2079
	This method is partially open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2080
	identical objects are always considered equal.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2081
	redefining it may not work as expected."
14975
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2082
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2083
    ^ self == anObject
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2084
!
0e1b93ce9851 class: Object
Claus Gittinger <cg@exept.de>
parents: 14974
diff changeset
  2085
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2086
== anObject
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2087
    "return true if the receiver and the arg are the same object.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2088
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2089
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2090
	This method is open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2091
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2092
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2093
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  2094
#ifdef __SCHTEAM__
18361
6f4ec9a1b98a comments only
Claus Gittinger <cg@exept.de>
parents: 18352
diff changeset
  2095
    return context._RETURN( (self == anObject) ? STObject.True : STObject.False );
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  2096
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2097
    RETURN ( (self == anObject) ? true : false );
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  2098
#endif
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2099
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2100
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2101
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2102
deepSameContentsAs:anObject
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2103
    "return true if the receiver and the arg have the same contents
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2104
     in both the named instance vars and any indexed instVars.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2105
     This method descends into referenced objects, where #sameContentsAs: does not descend"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2106
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2107
    |myClass val
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2108
     sz "{ Class: SmallInteger }" |
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2109
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2110
    myClass := self class.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2111
    myClass isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2112
	sz := self basicSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2113
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2114
	"compare the indexed variables"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2115
	1 to:sz do:[:i |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2116
	    val := self basicAt:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2117
	    val isLiteral ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2118
		val = (anObject basicAt:i) ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2119
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2120
		(val deepSameContentsAs:(anObject basicAt:i)) ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2121
	    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2122
	]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2123
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2124
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2125
    "compare the instance variables"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2126
    sz := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2127
    1 to:sz do:[:i |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2128
	val := self instVarAt:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2129
	val isLiteral ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2130
	    val = (anObject instVarAt:i) ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2131
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2132
	    (val deepSameContentsAs:(anObject instVarAt:i)) ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2133
	]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2134
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2135
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2136
    ^ true
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2137
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2138
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2139
     #(1 2 3 4) deepSameContentsAs:#[1 2 3 4] asArray
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2140
     (1@2) deepSameContentsAs:(1->2)
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2141
    "
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2142
!
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2143
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2144
hash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2145
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2146
     This hash should return same values for objects with same
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2147
     contents (i.e. use this to hash on structure)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2148
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2149
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2150
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2151
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2152
identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2153
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2154
     This hash should return same values for the same object (i.e. use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2155
     this to hash on identity of objects).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2156
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2157
     We cannot use the Objects address (as other smalltalks do) since
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2158
     no object-table exists and the hashval must not change when objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2159
     are moved by the collector. Therefore we assign each object a unique
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2160
     Id in the object header itself as its hashed upon.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2161
     (luckily we have 11 bits spare to do this - unluckily its only 11 bits).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2162
     Time will show, if 11 bits are enough; if not, another entry in the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2163
     object header will be needed, adding 4 bytes to every object. Alternatively,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2164
     hashed-upon objects could add an instvar containing the hash value."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2165
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2166
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2167
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2168
    REGISTER unsigned INT hash;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2169
    static unsigned nextHash = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2170
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2171
    if (__isNonNilObject(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2172
	hash = __GET_HASH(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2173
	if (hash == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2174
	    /* has no hash yet */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2175
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2176
	    if (++nextHash > __MAX_HASH__) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2177
		nextHash = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2178
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2179
	    hash = nextHash;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2180
	    __SET_HASH(self, hash);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2181
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2182
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2183
	/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2184
	 * now, we got 11 bits for hashing;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2185
	 * make it as large as possible; since most hashers use the returned
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2186
	 * key and take it modulo some prime number, this will allow for
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2187
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2188
	 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2189
	hash = __MAKE_HASH__(hash);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2190
	RETURN ( __mkSmallInteger(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2191
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2192
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2193
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2194
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2195
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2196
identityHashForBinaryStore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2197
    "hash which is usable if the object does not change its class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2198
     and does not #become something else, while the hash is used.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2199
     This is only used by the binary storage mechanism, during the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2200
     object writing phase."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2201
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2202
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2203
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2204
    REGISTER unsigned INT hash, hash1, hash2, sz;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2205
    OBJ o;
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2206
    static unsigned INT nextHash = 0;
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2207
    static unsigned INT nextClassHash = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2208
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2209
    if (__isNonNilObject(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2210
	/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2211
	 * my own identityHash
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2212
	 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2213
	hash1 = __GET_HASH(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2214
	if (hash1 == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2215
	    /* has no hash yet */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2216
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2217
	    if (++nextHash > __MAX_HASH__) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2218
		nextHash = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2219
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2220
	    hash1 = nextHash;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2221
	    __SET_HASH(self, hash1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2222
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2223
	/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2224
	 * my classes identityHash
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2225
	 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2226
	o = __qClass(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2227
	hash2 = __GET_HASH(o);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2228
	if (hash2 == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2229
	    /* has no hash yet */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2230
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2231
	    if (++nextClassHash > __MAX_HASH__) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2232
		nextClassHash = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2233
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2234
	    hash2 = nextClassHash;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2235
	    __SET_HASH(o, hash2);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2236
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2237
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2238
	/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2239
	 * some bits of my size
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2240
	 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2241
	sz = __qSize(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2242
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2243
	/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2244
	 * now, we got 11 + 11 + 8 bits for hashing;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2245
	 * make it as large as possible; since most hashers use the returned
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2246
	 * key and take it modulo some prime number, this will allow for
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2247
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2248
	 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2249
	hash = (hash1 << 11) | hash2;           /* 22 bits */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2250
	hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2251
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2252
	while ((hash & 0x20000000) == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2253
	    hash <<= 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2254
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2255
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2256
	RETURN ( __mkSmallInteger(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2257
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2258
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2259
    "never reached, since UndefinedObject and SmallInteger are not hashed upon in binary storage"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2260
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2261
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2262
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2263
sameContentsAs:anObject
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2264
    "return true if the receiver and the arg have the same contents
7121
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2265
     in both the named instance vars and any indexed instVars.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2266
     The code here only checks if values present in the receiver are also
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2267
     present in the arg, not vice versa.
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2268
     I.e. the argument may be bigger and/or have more instance variables."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2269
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2270
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2271
     sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2273
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2274
    myClass isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2275
	sz := self basicSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2276
	anObject basicSize >= sz ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2277
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2278
	"compare the indexed variables"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2279
	1 to:sz do:[:i |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2280
	    (self basicAt:i) == (anObject basicAt:i) ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2281
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2282
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2283
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2284
    "compare the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2285
    sz := myClass instSize.
12997
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2286
    anObject class instSize >= sz ifFalse:[^ false].
7121
5ce61b826f0e sameContentsAs: comment.
Claus Gittinger <cg@exept.de>
parents: 7112
diff changeset
  2287
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2288
    1 to:sz do:[:i |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2289
	(self instVarAt:i) == (anObject instVarAt:i) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2290
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2291
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2292
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2293
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2294
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2295
     #(1 2 3 4) sameContentsAs:#[1 2 3 4] asArray
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2296
     (1@2) sameContentsAs:(1->2)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2297
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2298
12997
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2299
    "Created: / 21-04-1998 / 15:56:40 / cg"
11e3305c4a0c changed: #sameContentsAs:
sr
parents: 12841
diff changeset
  2300
    "Modified: / 05-08-2010 / 16:44:09 / sr"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2301
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2302
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2303
~= anObject
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2304
    "return true if the receiver and the arg do not have the same structure.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2305
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2306
	This method is partially open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2307
	identical objects are never considered unequal.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2308
	redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2309
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2310
    ^ (self = anObject) not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2311
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2313
~~ anObject
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2314
    "return true if the receiver and the arg are not the same object.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2315
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2316
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2317
	This method is open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2318
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2319
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2320
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  2321
#ifdef __SCHTEAM__
18361
6f4ec9a1b98a comments only
Claus Gittinger <cg@exept.de>
parents: 18352
diff changeset
  2322
    return context._RETURN( (self == anObject) ? STObject.False : STObject.True );
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  2323
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2324
    RETURN ( (self == anObject) ? false : true );
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  2325
#endif
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2326
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2327
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2328
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2329
!Object methodsFor:'converting'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2330
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2331
-> anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2332
    "return an association with the receiver as key and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2333
     the argument as value"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2334
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2335
    ^ Association key:self value:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2336
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2337
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2338
as:aSimilarClass
16052
04691ede1f57 class: Object
Claus Gittinger <cg@exept.de>
parents: 16021
diff changeset
  2339
    "If the receiver's class is not aSimilarClass,
04691ede1f57 class: Object
Claus Gittinger <cg@exept.de>
parents: 16021
diff changeset
  2340
     create and return an instance of aSimilarClass that has the same contents
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2341
     as the receiver.
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2342
     Otherwise, return the receiver."
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2343
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2344
    self class == aSimilarClass ifTrue:[^ self].
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2345
    ^ aSimilarClass newFrom:self
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2346
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2347
    "
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2348
     #[1 2 3 4] as:ByteArray
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2349
     #[1 2 3 4] as:Array
10539
05541b0358c2 changed #as: comment
Stefan Vogel <sv@exept.de>
parents: 10532
diff changeset
  2350
     #[81 82 83 84] as:String
05541b0358c2 changed #as: comment
Stefan Vogel <sv@exept.de>
parents: 10532
diff changeset
  2351
     #[81 82 83 84] as:Symbol
16052
04691ede1f57 class: Object
Claus Gittinger <cg@exept.de>
parents: 16021
diff changeset
  2352
     'hello' as:Unicode16String
10062
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2353
    "
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2354
!
c84adfadde12 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10032
diff changeset
  2355
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2356
asCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2357
    "return myself as a Collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2358
     Redefined in collection to return themself."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2359
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2360
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2361
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2362
17261
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2363
asLink
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2364
    "return a valueLink for the receiver.
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2365
     Used to make sure the receiver can be added to a linked list"
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2366
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2367
    ^ ValueLink value:self
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2368
!
a9bf1e05e5a2 class: Object
Claus Gittinger <cg@exept.de>
parents: 17176
diff changeset
  2369
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2370
asSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2371
    "return myself as a SequenceableCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2372
     Redefined in SequenceableCollection"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2373
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2374
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2375
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2376
14355
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2377
asString
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2378
    ^ self printString
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2379
!
b5ed6aa393f7 added: #asUnicode16String
Stefan Vogel <sv@exept.de>
parents: 14296
diff changeset
  2380
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2381
asValue
20381
5d8c4d076dfe #OTHER by mawalch
mawalch
parents: 20351
diff changeset
  2382
    "return a valueHolder for the receiver"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2383
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2384
    ^ ValueHolder with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2385
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2386
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2387
!Object methodsFor:'copying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2388
24817
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2389
clone
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2390
    ^ self shallowCopy
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2391
!
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2392
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2393
cloneFrom:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2394
    "Helper for copy:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2395
     copy all instance variables from anObject into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2396
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2397
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2398
    self cloneFrom:anObject performing:#yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2399
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2400
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2401
     |x|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2402
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2403
     x := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2404
     x cloneFrom:#(1 2 3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2405
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2406
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2407
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2408
cloneFrom:anObject performing:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2409
    "Helper for copy:
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2410
     for each instance variable from anObject, send it aSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2411
     and store the result into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2412
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2413
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2414
    |myClass sz "{ Class: SmallInteger }" t |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2415
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2416
    myClass := self class.
14532
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2417
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2418
    "process the named instance variables"
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2419
    sz := myClass instSize.
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2420
    1 to:sz do:[:i |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2421
	t := anObject instVarAt:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2422
	aSymbol ~~ #yourself ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2423
	    t := t perform:aSymbol
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2424
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2425
	self instVarAt:i put:t
14532
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2426
    ].
f15633aab0fe class: Object
Stefan Vogel <sv@exept.de>
parents: 14527
diff changeset
  2427
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2428
    myClass isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2429
	sz := self basicSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2430
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2431
	"process the indexed instance variables"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2432
	1 to:sz do:[:i |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2433
	    t := anObject basicAt:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2434
	    aSymbol ~~ #yourself ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2435
		t := t perform:aSymbol.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2436
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2437
	    self basicAt:i put:t.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2438
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2439
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2440
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2441
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2442
cloneInstanceVariablesFrom:aPrototype
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2443
    "Shallow copy variables from a prototype into myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2444
     This copies instVars by name - i.e. same-named variables are
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2445
     copied, others are not.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2446
     The variable slots are copied as available
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2447
     (i.e. the min of both indexed sizes is used)."
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2448
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  2449
    |myClass prototypesClass myInfo prototypesInfo
19272
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2450
     sz "{ Class: SmallInteger }"|
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2451
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2452
    myClass := self class.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2453
    prototypesClass := aPrototype class.
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2454
    (myClass == prototypesClass
19272
07c01cb9c96f #REFACTORING
Stefan Vogel <sv@exept.de>
parents: 18984
diff changeset
  2455
     or:[myClass isSubclassOf:prototypesClass]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2456
	"/ can do better, if my class is a subclass of the prototype's class
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2457
	sz := prototypesClass instSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2458
	1 to: sz do:[:index |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2459
	    self instVarAt:index put:(aPrototype instVarAt:index)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2460
	]
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2461
    ] ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2462
	"/ map instvars by name
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2463
	myInfo := myClass instanceVariableOffsets.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2464
	prototypesInfo := prototypesClass instanceVariableOffsets.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2465
	myInfo keysAndValuesDo:[:name :index | |varIndexAssoc|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2466
	    varIndexAssoc := prototypesInfo at:name ifAbsent:[].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2467
	    varIndexAssoc notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2468
		self instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value))
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2469
	    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2470
	]
14676
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2471
    ].
07174f47f540 class: Object
Claus Gittinger <cg@exept.de>
parents: 14661
diff changeset
  2472
    myClass isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2473
	prototypesClass isVariable ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2474
	    sz := self basicSize min:aPrototype basicSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2475
	    1 to:sz do:[:index |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2476
		self basicAt:index put:(aPrototype basicAt:index)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2477
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2478
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2479
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2480
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2481
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2482
     Class withoutUpdatingChangesDo:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2483
	|point3D|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2484
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2485
	point3D := Point subclass:#Point3D
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2486
	   instanceVariableNames:'z'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2487
	   classVariableNames:''
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2488
	   poolDictionaries:''
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2489
	   category:'testing'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2490
	   inEnvironment:nil.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2491
	 (point3D new cloneInstanceVariablesFrom:1@2) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2492
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2493
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2494
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2495
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2496
     Class withoutUpdatingChangesDo:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2497
	 Point variableSubclass:#Point3D_test
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2498
	   instanceVariableNames:'z'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2499
	   classVariableNames:''
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2500
	   poolDictionaries:''
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2501
	   category:'testing'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2502
	 (((Smalltalk at:#Point3D_test) new:2) cloneInstanceVariablesFrom:#(1 2 3)) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2503
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2504
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2505
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2506
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2507
     |someObject|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2508
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2509
     Class withoutUpdatingChangesDo:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2510
	 Object subclass:#TestClass1
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2511
	   instanceVariableNames:'foo bar'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2512
	   classVariableNames:''
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2513
	   poolDictionaries:''
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2514
	   category:'testing'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2515
	 someObject := TestClass1 new.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2516
	 someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2517
	 Object subclass:#TestClass2
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2518
	   instanceVariableNames:'bar foo'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2519
	   classVariableNames:''
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2520
	   poolDictionaries:''
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2521
	   category:'testing'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2522
	 (TestClass2 new cloneInstanceVariablesFrom:someObject) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2523
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2524
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2525
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2526
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2527
     |top b b1|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2528
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2529
     top := StandardSystemView new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2530
     top extent:100@100.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2531
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2532
     b := Button in:top.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2533
     b label:'hello'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2534
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2535
     b1 := ArrowButton new cloneInstanceVariablesFrom:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2536
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2537
     top open.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2538
     b1 inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2539
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2540
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2541
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2542
copy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2543
    "return a copy of the receiver - defaults to shallowcopy here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2544
     Notice, that copy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2545
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2546
    ^ self shallowCopy postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2547
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2548
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2549
copyToLevel:level
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2550
    "a controlled deepCopy, where the number of levels can be specified.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2551
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2552
	 This method DOES NOT handle cycles/self-refs and does NOT preserve object identity;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2553
	 i.e. identical references in the source are copied multiple times into the copy."
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2554
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2555
    |newObject newLevel class sz "{Class: SmallInteger}" newInst|
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2556
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2557
    newObject := self copy.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2558
    newObject == self ifTrue: [^ self].   "copy of nil, true, false, ... is self"
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2559
    level == 1 ifTrue:[^ newObject].
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2560
    newLevel := level - 1.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2561
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2562
    class := newObject class.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2563
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2564
    "process the named instance variables"
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2565
    sz := class instSize.
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2566
    1 to:sz do:[:i |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2567
	newInst := newObject instVarAt:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2568
	newInst notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2569
	    newObject instVarAt:i put:(newInst copyToLevel:newLevel).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2570
	].
14534
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2571
    ].
5c9bbb0cc2ba class: Object
Stefan Vogel <sv@exept.de>
parents: 14532
diff changeset
  2572
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2573
    class isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2574
	sz := newObject basicSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2575
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2576
	"process the indexed instance variables"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2577
	1 to:sz do:[:i |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2578
	    newInst := newObject basicAt:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2579
	    newInst notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2580
		newObject basicAt:i put:(newInst copyToLevel:newLevel).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2581
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2582
	]
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2583
    ].
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2584
    ^ newObject
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2585
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2586
    "
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2587
     |a b|
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2588
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2589
     a := #(
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2590
	    '1.1'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2591
	    '1.2'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2592
	    '1.3'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2593
	    (
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2594
		'1.41'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2595
		'1.42'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2596
		'1.43'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2597
		    (
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2598
			'1.441'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2599
			'1.442'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2600
			'1.443'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2601
			( '1.4441' '1.4442' '1.4443' )
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2602
			'1.445'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2603
		    )
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2604
		'1.45'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2605
	    )
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2606
	    '1.5'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2607
	   ).
6962
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2608
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2609
      b := a copyToLevel:1.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2610
      self assert: ( (a at:1) == (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2611
      self assert: ( (a at:4) == (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2612
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2613
      b := a copyToLevel:2.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2614
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2615
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2616
      self assert: ( ((a at:4) at:1) == ((b at:4) at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2617
      self assert: ( ((a at:4) at:4) == ((b at:4) at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2618
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2619
      b := a copyToLevel:3.
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2620
      self assert: ( (a at:1) ~~ (b at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2621
      self assert: ( (a at:4) ~~ (b at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2622
      self assert: ( ((a at:4) at:1) ~~ ((b at:4) at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2623
      self assert: ( ((a at:4) at:4) ~~ ((b at:4) at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2624
      self assert: ( (((a at:4) at:4) at:1) == (((b at:4) at:4)at:1) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2625
      self assert: ( (((a at:4) at:4) at:4) == (((b at:4) at:4)at:4) ).
eab0d4c42375 copyToLevel: example and comment
Claus Gittinger <cg@exept.de>
parents: 6961
diff changeset
  2626
    "
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2627
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2628
24817
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2629
copyTwoLevel
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2630
    "one more level than a shallowCopy"
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2631
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2632
    ^ self copyToLevel:2
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2633
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2634
    "
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2635
     |original copy elL1 elL2 elL3 copyOfElL1|
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2636
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2637
     original := Array new:3.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2638
     original at:1 put:1234.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2639
     original at:2 put:'hello'.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2640
     original at:3 put:(elL1 := Array new:3).
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2641
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2642
     elL1 at:1 put:1234.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2643
     elL1 at:2 put:'hello'.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2644
     elL1 at:3 put:(elL2 := Array new:3).
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2645
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2646
     elL2 at:1 put:1234.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2647
     elL2 at:2 put:'hello'.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2648
     elL2 at:3 put:(elL3 := Array new:3).
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2649
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2650
     elL3 at:1 put:1234.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2651
     elL3 at:2 put:'hello'.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2652
     elL3 at:3 put:(Array new:3).
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2653
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2654
     copy := original copyTwoLevel.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2655
     self assert:((original at:2) ~~ (copy at:2)).
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2656
     self assert:((original at:3) ~~ (copy at:3)).
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2657
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2658
     copyOfElL1 := copy at:3.
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2659
     self assert:((elL1 at:2) == (copyOfElL1 at:2)).
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2660
     self assert:((elL1 at:3) == (copyOfElL1 at:3)).
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2661
    "
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2662
!
8c5a036c4d3b #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24813
diff changeset
  2663
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2664
deepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2665
    "return a copy of the object with all subobjects also copied.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2666
     This method DOES handle cycles/self-refs and preserves object identity;
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  2667
     however the receiver's class is not copied (to avoid the 'total' copy).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2668
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2669
     This deepCopy is a bit slower than the old (unsecure) one, since it
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2670
     keeps track of already copied objects. If you are sure, that your
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2671
     copied object does not include duplicates (or you do not care) and
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2672
     no cycles are involved, you can use the old simpleDeepCopy,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2673
     which avoids this overhead (but may run into trouble).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2674
     Notice, that deepCopy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2675
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2676
    ^ self deepCopyUsing:(IdentityDictionary new)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2677
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2678
    "an example which is not handled by the old deepCopy:
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2679
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2680
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2681
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2682
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2683
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2684
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2685
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2686
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2687
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2688
     a := Color black onDevice:Screen current.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2689
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2690
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2691
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2692
    "Modified: 27.3.1996 / 16:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2693
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2694
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2695
deepCopyError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2696
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2697
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2698
    "raise a signal, that deepCopy is not allowed for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2699
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  2700
    ^ DeepCopyError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2701
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2702
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2703
deepCopyUsing:aDictionary
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2704
    "a helper for deepCopy; return a copy of the object with
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2705
     all subobjects also copied. If the to-be-copied object is in the dictionary,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2706
     use the value found there. The class of the receiver is not copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2707
     This method DOES handle cycles/self references."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2708
10941
f80dfc67dc51 deepCopy change
ab
parents: 10922
diff changeset
  2709
    ^ self deepCopyUsing:aDictionary postCopySelector:#postDeepCopyFrom:.
f80dfc67dc51 deepCopy change
ab
parents: 10922
diff changeset
  2710
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2711
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2712
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2713
     |a b c copyOfC|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2714
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2715
     a := Array with:'hello' with:'world' with:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2716
     b := 99 @ 999.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2717
     a at:3 put:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2718
     c := Array with:a with:b with:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2719
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2720
     Transcript showCR: (c at:1) == (c at:3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2721
     copyOfC := c deepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2722
     Transcript showCR: (copyOfC at:1) == (copyOfC at:3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2723
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2724
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2725
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2726
deepCopyUsing:aDictionary postCopySelector:postCopySelector
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2727
    "a helper for deepCopy; return a copy of the object with
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  2728
     all subobjects also copied. If the to-be-copied object is in the dictionary,
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2729
     use the value found there. The class of the receiver is not copied.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2730
     This method DOES handle cycles/self references."
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2731
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2732
    |myClass aCopy
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2733
     basicSize "{ Class: SmallInteger }"
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2734
     instSize  "{ Class: SmallInteger }"
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2735
     iOrig iCopy|
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2736
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2737
    myClass := self class.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2738
    myClass isVariable ifTrue:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2739
	basicSize := self basicSize.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2740
	aCopy := self speciesForCopy basicNew:basicSize.
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2741
    ] ifFalse:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2742
	basicSize := 0.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2743
	aCopy := self speciesForCopy basicNew
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2744
    ].
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2745
    aCopy setHashFrom:self.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2746
    aDictionary at:self put:aCopy.
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2747
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2748
    "
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2749
     copy the instance variables
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2750
    "
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2751
    instSize := myClass instSize.
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2752
    1 to:instSize do:[:i |
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2753
	(self skipInstvarIndexInDeepCopy:i) ifFalse:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2754
	    iOrig := self instVarAt:i.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2755
	    iOrig notNil ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2756
		iCopy := aDictionary at:iOrig ifAbsent:Nothing.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2757
		iCopy == Nothing ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2758
		    iCopy := iOrig deepCopyUsing:aDictionary postCopySelector:postCopySelector
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2759
		].
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2760
		aCopy instVarAt:i put:iCopy
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2761
	    ]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2762
	]
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2763
    ].
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2764
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2765
    "
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2766
     copy indexed instvars - if any
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2767
    "
14527
b933e9f1e53d class: Object
Stefan Vogel <sv@exept.de>
parents: 14499
diff changeset
  2768
    basicSize ~~ 0 ifTrue:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2769
	myClass isBits ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2770
	    "block-copy indexed instvars"
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2771
	    aCopy replaceFrom:1 to:basicSize with:self startingAt:1
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2772
	] ifFalse:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2773
	    "individual deep copy the indexed variables"
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2774
	    1 to:basicSize do:[:i |
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2775
		iOrig := self basicAt:i.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2776
		iOrig notNil ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2777
		    "/ used to be dict-includesKey-ifTrue[dict-at:],
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2778
		    "/ changed to use dict-at:ifAbsent:, to avoid double lookup in dictionary
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2779
		    iCopy := aDictionary at:iOrig ifAbsent:Nothing.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2780
		    iCopy == Nothing ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2781
			iCopy := iOrig deepCopyUsing:aDictionary postCopySelector:postCopySelector
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2782
		    ].
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2783
		    aCopy basicAt:i put:iCopy
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2784
		]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2785
	    ]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  2786
	]
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2787
    ].
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2788
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2789
    aCopy perform:postCopySelector withOptionalArgument:self and:aDictionary.
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2790
    ^ aCopy
13515
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2791
2c1e968842cb changed: #deepCopyUsing:postCopySelector:
Claus Gittinger <cg@exept.de>
parents: 13500
diff changeset
  2792
    "Modified: / 21-07-2011 / 13:30:52 / cg"
23652
1b482fb9e84d #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23574
diff changeset
  2793
    "Modified: / 30-01-2019 / 16:27:21 / Claus Gittinger"
10954
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2794
!
b0d7bbc8673d deepCopyUsing:postCopySelector: in libbasic
sr
parents: 10941
diff changeset
  2795
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2796
setHashFrom:anObject
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2797
    "set my identity-hash key to be the same as anObjects hash key.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2798
     This is an ST/X speciality, which is NOT available in other (especially OT based)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2799
     Smalltalks, and may not be available in future ST/X versions.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2800
     DO NEVER use this for normal application code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2801
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2802
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2803
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2804
    REGISTER unsigned h;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2805
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2806
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2807
	h = __GET_HASH(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2808
	__SET_HASH(self, h);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2809
	RETURN (self);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2810
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2811
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2812
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2813
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2814
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2815
shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2816
    "return a copy of the object with shared subobjects (a shallow copy)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2817
     i.e. the copy shares referenced instvars with its original."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2818
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2819
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2820
    int ninsts, spc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2821
    int sz;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2822
    OBJ theCopy;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2823
    OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2824
    int flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2825
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2826
    cls = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2827
    flags = __intVal(__ClassInstPtr(cls)->c_flags);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2828
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2829
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2830
     * bail out for special objects ..
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2831
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2832
    if (((flags & ~ARRAYMASK) == 0)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2833
     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2834
	sz = __qSize(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2835
	__PROTECT__(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2836
	__qNew(theCopy, sz);    /* OBJECT ALLOCATION */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2837
	__UNPROTECT__(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2838
	if (theCopy) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2839
	    cls = __qClass(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2840
	    spc = __qSpace(theCopy);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2841
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2842
	    theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2843
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2844
	    sz = sz - OHDR_SIZE;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2845
	    if (sz) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2846
		char *src, *dst;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2847
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2848
		src = (char *)(__InstPtr(self)->i_instvars);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2849
		dst = (char *)(__InstPtr(theCopy)->i_instvars);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2850
#ifdef bcopy4
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2851
		{
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2852
		    /* care for odd-number of longs */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2853
		    int nW = sz >> 2;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2854
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2855
		    if (sz & 3) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2856
			nW++;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2857
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2858
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2859
		    bcopy4(src, dst, nW);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2860
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2861
#else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2862
		bcopy(src, dst, sz);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2863
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2864
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2865
		flags &= ARRAYMASK;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2866
		if (flags == POINTERARRAY) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2867
		    ninsts = __BYTES2OBJS__(sz);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2868
		} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2869
		    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2870
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2871
		if (ninsts) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2872
		    do {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2873
			OBJ el;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2874
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2875
			el = __InstPtr(theCopy)->i_instvars[ninsts-1];
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2876
			__STORE_SPC(theCopy, el, spc);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2877
		    } while (--ninsts);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2878
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2879
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2880
	    RETURN (theCopy);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2881
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2882
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2883
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2884
    "/ fallBack for special objects & memoryAllocation failure case
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2885
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2886
    ^ self slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2887
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2888
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2889
simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2890
    "return a copy of the object with all subobjects also copied.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  2891
     This method does NOT handle cycles - but is included to allow this
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2892
     slightly faster copy in situations where it is known that
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2893
     no recursive references occur (LargeIntegers for example).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2894
     NOTICE: you will run into trouble, when trying this with recursive
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2895
     objects (usually recursionInterrupt or memory-alert).
8383
dea5311899c5 comments in copy methods
Claus Gittinger <cg@exept.de>
parents: 8377
diff changeset
  2896
     This method corresponds to the 'traditional' deepCopy found in the Blue book."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2897
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2898
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2899
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2900
    (myClass := self class) isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2901
	aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2902
    ] ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2903
	aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2904
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2905
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2906
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2907
    aCopy cloneFrom:self performing:#simpleDeepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2908
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2909
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2910
    "a bad example (but ST/X should survive ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2911
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2912
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2913
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2914
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2915
     a simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2916
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2917
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2918
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2919
skipInstvarIndexInDeepCopy:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2920
    "a helper for deepCopy; only indices for which this method returns
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2921
     false are copied in a deep copy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2922
     The default is false here - which means that everything is copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2923
     Can be redefined in subclasses for partial copies"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2924
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2925
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2926
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2927
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2928
slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2929
    "return a copy of the object with shared subobjects (a shallow copy)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2930
     i.e. the copy shares referenced instvars with its original.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2931
     This method is only invoked as a fallback from #shallowCopy."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2932
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2933
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2934
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2935
    (myClass := self class) isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2936
	aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2937
    ] ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  2938
	aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2939
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2940
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2941
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2942
    aCopy cloneFrom:self performing:#yourself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2943
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2944
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2945
24171
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2946
!Object methodsFor:'copying-private'!
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2947
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2948
postCopy
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2949
    "this is for compatibility with ST-80 code, which uses postCopy for
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2950
     cleanup after copying, while ST/X passes the original in postCopyFrom:
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2951
     (see there)"
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2952
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2953
    ^ self
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2954
!
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2955
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2956
postDeepCopy
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2957
    "allows for cleanup after deep copying.
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2958
     To be redefined in subclasses."
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2959
!
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2960
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2961
postDeepCopyFrom:aSource
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2962
    "allows for cleanup after deep copying"
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2963
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2964
    ^ self postDeepCopy
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2965
! !
5c4b8d65c2dc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24140
diff changeset
  2966
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2967
!Object methodsFor:'debugging'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2968
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2969
assert:aBooleanOrBlock
13800
2f04da6f127e comment/format in: #assert:
Stefan Vogel <sv@exept.de>
parents: 13710
diff changeset
  2970
    "fail and report an error, if the argument does not evaluate to true"
6964
a9ecdb3f1e52 comments
Claus Gittinger <cg@exept.de>
parents: 6963
diff changeset
  2971
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2972
    "{ Pragma: +optSpace }"
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2973
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2974
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2975
24137
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  2976
    "/ do not use assert:message: - otherwise the shown context (where the assert is) is wrong
23561
617af27ed42f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23553
diff changeset
  2977
    aBooleanOrBlock value == true ifTrue:[^ self].
24137
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  2978
    (Smalltalk ignoreAssertions) ifTrue:[^ self].
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  2979
    "/ could still be a block or false.
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  2980
    aBooleanOrBlock value == true ifTrue:[ ^ self].
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  2981
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  2982
    AssertionFailedError raiseRequestWith:self errorString:'Assertion failed' in:(thisContext sender)
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2983
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2984
    "
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2985
     self assert:false
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  2986
    "
13039
43313704ee61 changed: #assert:
Claus Gittinger <cg@exept.de>
parents: 12997
diff changeset
  2987
43313704ee61 changed: #assert:
Claus Gittinger <cg@exept.de>
parents: 12997
diff changeset
  2988
    "Modified: / 20-08-2010 / 17:13:06 / cg"
23523
758189afd094 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23514
diff changeset
  2989
    "Modified: / 08-11-2018 / 11:36:40 / Claus Gittinger"
23561
617af27ed42f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23553
diff changeset
  2990
    "Modified: / 12-12-2018 / 18:19:08 / Stefan Vogel"
7621
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2991
!
42fb582ea36b allow for blocks in assert
Claus Gittinger <cg@exept.de>
parents: 7600
diff changeset
  2992
19287
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  2993
assert:aBooleanOrBlock description:messageIfFailing
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  2994
    "fail, if the argument does not evaluate to true and report an error"
6961
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2995
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2996
    "{ Pragma: +optSpace }"
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  2997
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2998
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  2999
24594
9d184fa30487 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24585
diff changeset
  3000
    "/ sorry for the code duplication
24137
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  3001
    "/ do not use assert:message: - otherwise the shown context (where the assert is) is wrong
11141
b96ed3ac5825 assertions can be globally disabled
Claus Gittinger <cg@exept.de>
parents: 11132
diff changeset
  3002
    aBooleanOrBlock == true ifTrue:[^ self].
24137
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  3003
    (Smalltalk ignoreAssertions) ifTrue:[^ self].
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  3004
    "/ could still be a block or false.
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  3005
    aBooleanOrBlock value == true ifTrue:[ ^ self].
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3006
24137
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  3007
    AssertionFailedError raiseRequestWith:self errorString:messageIfFailing in:(thisContext sender)
19287
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3008
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3009
    "
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3010
     self assert:false description:'xxx'
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3011
    "
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3012
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3013
    "Modified (comment): / 06-03-2012 / 11:26:48 / cg"
23523
758189afd094 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23514
diff changeset
  3014
    "Modified: / 08-11-2018 / 11:36:44 / Claus Gittinger"
19287
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3015
!
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3016
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3017
assert:aBooleanOrBlock message:messageIfFailing
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3018
    "fail, if the argument does not evaluate to true and report an error"
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3019
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3020
    "{ Pragma: +optSpace }"
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3021
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3022
    <resource: #skipInDebuggersWalkBack>
7e945c7dc124 #REFACTORING
Claus Gittinger <cg@exept.de>
parents: 19272
diff changeset
  3023
24594
9d184fa30487 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24585
diff changeset
  3024
    "/ sorry for the code duplication
9d184fa30487 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24585
diff changeset
  3025
    "/ do not use assert:description: - otherwise the shown context (where the assert is) is wrong
22687
2e2336c993fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22661
diff changeset
  3026
    aBooleanOrBlock == true ifTrue:[^ self].
2e2336c993fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22661
diff changeset
  3027
    (Smalltalk ignoreAssertions) ifTrue:[^ self].
2e2336c993fc #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22661
diff changeset
  3028
    "/ could still be a block or false.
24137
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  3029
    aBooleanOrBlock value == true ifTrue:[ ^ self].
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  3030
21ddb11c85ee fix: wrong context was presented in assert: and assert:description:
Claus Gittinger <cg@exept.de>
parents: 24025
diff changeset
  3031
    AssertionFailedError raiseRequestWith:self errorString:messageIfFailing in:(thisContext sender)
11662
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  3032
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  3033
    "
08309a406658 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11634
diff changeset
  3034
     self assert:false message:'xxx'
10651
b205dbfea7e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10576
diff changeset
  3035
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3036
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3037
    "Modified (comment): / 06-03-2012 / 11:26:48 / cg"
23757
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3038
    "Modified: / 20-02-2019 / 14:17:28 / Stefan Vogel"
6961
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  3039
!
096ca5ceb662 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6954
diff changeset
  3040
23569
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3041
assertNotNil
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3042
    "fail and report an error, if the receiver is nil"
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3043
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3044
    "/ intentionally left empty
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3045
    ^ self
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3046
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3047
    "
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3048
     self assertNotNil
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3049
    "
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3050
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3051
    "Created: / 18-12-2018 / 15:39:28 / Claus Gittinger"
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3052
!
4e1dba6192e5 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23561
diff changeset
  3053
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3054
basicInspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3055
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3056
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3057
    "launch an inspector on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3058
     this method should NOT be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3059
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3060
    Inspector isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3061
	"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3062
	 for systems without GUI
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3063
	"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3064
	self warn:'No Inspector defined (Inspector is nil).'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3065
    ] ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3066
	Inspector openOn:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3067
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3068
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3069
    "Modified: 18.5.1996 / 15:43:25 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3070
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3071
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3072
breakPoint:someKey
6954
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3073
    "{ Pragma: +optSpace }"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3074
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3075
    "Like halt, but disabled by default.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3076
     Can be easily enabled.
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3077
     Can be filtered on the arguments value (typically: a symbol).
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3078
     Code with breakpoints may be even checked into the source repository"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3079
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3080
    "Example:   nil breakPoint:#stefan"
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3081
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3082
    <resource: #skipInDebuggersWalkBack>
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3083
20807
fd862f559394 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20779
diff changeset
  3084
    "/ don't send #breakPoint:info: here - ask cg why.
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3085
    (self isBreakPointEnabled:someKey) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3086
	^ HaltSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3087
	    raiseRequestWith:someKey
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3088
	    errorString:('Breakpoint encountered: %1' bindWith:someKey)
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3089
    ].
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3090
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3091
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3092
     nil breakPoint:#stefan
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3093
     nil breakPoint:#stefan info:'Hello'
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3094
     Smalltalk enableBreakPoint:#stefan.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3095
     Smalltalk disableBreakPoint:#stefan.
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3096
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3097
     EncounteredBreakPoints.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3098
     Smalltalk enableBreakPoint:#cg.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3099
     Smalltalk disableBreakPoint:#cg.
22520
82adfdc24246 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22384
diff changeset
  3100
     Smalltalk enableBreakPoint:#expecco.
82adfdc24246 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22384
diff changeset
  3101
     Smalltalk disableBreakPoint:#cg.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3102
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3103
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3104
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3105
breakPoint:someKey info:infoString
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3106
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3107
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3108
    "Like halt, but disabled by default.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3109
     Can be easily enabled.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3110
     Can be filtered on the arguments value (typically: a symbol).
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3111
     Code with breakpoints may be even checked into the source repository"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3112
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3113
    "Example:   nil breakPoint:#stefan"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3114
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3115
    <resource: #skipInDebuggersWalkBack>
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3116
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3117
    (self isBreakPointEnabled:someKey) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3118
	^ HaltSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3119
	    raiseRequestWith:someKey
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3120
	    errorString:(infoString bindWith:someKey)
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3121
    ].
6954
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3122
!
c3408e945eb5 oops - breakpoint lost
Claus Gittinger <cg@exept.de>
parents: 6950
diff changeset
  3123
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3124
debuggingCodeFor:someKey is:aBlock
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3125
    "{ Pragma: +optSpace }"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3126
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3127
    "aBlock is evaluated if breakPoints for somekey are enabled.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3128
     Allows for debugging code to be enabled/disabled via the breakpoint browser.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3129
     Can be easily enabled.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3130
     Can be filtered on the arguments value (typically: a symbol).
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3131
     Code with breakpoints may be even checked into the source repository"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3132
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3133
    "Example:   nil debuggingCodeFor:#cg is:[ self halt ]"
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3134
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3135
    <resource: #skipInDebuggersWalkBack>
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3136
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3137
    (self isBreakPointEnabled:someKey) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3138
	aBlock value
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3139
    ].
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3140
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3141
    "
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3142
     Smalltalk disableBreakPoint:#cg.
12340
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  3143
     nil debuggingCodeFor:#cg is:[ Transcript showCR:'here is some debug message for cg' ].
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  3144
     nil debuggingCodeFor:#stefan is:[ Transcript showCR:'here is some debug message for sv' ].
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3145
     Smalltalk enableBreakPoint:#cg.
12340
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  3146
     nil debuggingCodeFor:#cg is:[ Transcript showCR:'here is some debug message for cg' ].
e9ea989ffe01 comment/format in: #debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 12328
diff changeset
  3147
     nil debuggingCodeFor:#stefan is:[ Transcript showCR:'here is some debug message for sv' ].
11244
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3148
     Smalltalk disableBreakPoint:#cg.
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3149
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3150
    "
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3151
!
7ecd4a866064 debuggingCodeFor:is:
Claus Gittinger <cg@exept.de>
parents: 11236
diff changeset
  3152
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3153
disableAllBreakPoints
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3154
    "disable all parametrized breakPoints (with any key as parameter)"
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3155
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3156
    EnabledBreakPoints := nil
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3157
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3158
    "
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3159
     nil enableBreakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3160
     nil breakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3161
     nil disableAllBreakPoints.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3162
     nil breakPoint:#cg.
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3163
    "
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3164
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3165
    "Created: / 06-03-2012 / 15:32:28 / cg"
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3166
!
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3167
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3168
disableBreakPoint:someKey
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3169
    "disable parametrized breakPoints with someKey as parameter"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3170
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3171
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3172
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3173
    EnabledBreakPoints notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3174
	EnabledBreakPoints remove:someKey ifAbsent:[].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3175
	EnabledBreakPoints := EnabledBreakPoints asNilIfEmpty.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3176
    ].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3177
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3178
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3179
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3180
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3181
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3182
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3183
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3184
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3185
    "Modified (comment): / 06-03-2012 / 15:31:51 / cg"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3186
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3187
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3188
enableBreakPoint:someKey
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3189
    "enable parametrized breakPoints with someKey as parameter"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3190
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3191
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3192
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3193
    EnabledBreakPoints isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3194
	EnabledBreakPoints := Set new.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3195
    ].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3196
    EnabledBreakPoints add:someKey.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3197
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3198
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3199
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3200
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3201
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3202
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3203
    "
14046
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3204
541f46216cb4 added: #disableAllBreakPoints
Claus Gittinger <cg@exept.de>
parents: 13990
diff changeset
  3205
    "Modified (comment): / 06-03-2012 / 15:31:47 / cg"
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3206
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3207
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3208
halt
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3209
    "{ Pragma: +optSpace }"
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3210
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3211
    "enter debugger with halt-message.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3212
     The error is reported by raising the HaltSignal exception."
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3213
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3214
    <resource: #skipInDebuggersWalkBack>
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3215
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3216
    Smalltalk ignoreHalt ifTrue:[^ self].
14830
ac68533e9c43 class: Object
Claus Gittinger <cg@exept.de>
parents: 14778
diff changeset
  3217
    "/ don't send #halt: here - ask cg why.
14974
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3218
    HaltInterrupt raiseRequestWith:#halt.
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3219
    ^ self
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3220
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3221
    "
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3222
	(3 halt * 5)
14974
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3223
    "
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3224
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3225
    "Modified: / 02-08-1999 / 17:00:29 / stefan"
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3226
    "Modified: / 18-11-2010 / 11:21:51 / cg"
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3227
!
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3228
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3229
halt:aString
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3230
    "{ Pragma: +optSpace }"
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3231
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3232
    "enter debugger with halt-message.
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3233
     The error is reported by raising the HaltSignal exception."
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3234
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3235
    <resource: #skipInDebuggersWalkBack>
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3236
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3237
    Smalltalk ignoreHalt ifTrue:[^ self].
14974
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3238
    HaltInterrupt raiseRequestWith:#halt: errorString:aString.
2f05d233c309 class: Object
Stefan Vogel <sv@exept.de>
parents: 14965
diff changeset
  3239
    ^ self
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3240
13136
e7d331537665 changed:
Claus Gittinger <cg@exept.de>
parents: 13099
diff changeset
  3241
    "Modified: / 18-11-2010 / 11:22:16 / cg"
11048
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3242
!
feed33f1f796 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11045
diff changeset
  3243
22025
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3244
haltIfNil
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3245
    "halt if the receiver is nil"
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3246
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3247
    <resource: #skipInDebuggersWalkBack>
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3248
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3249
    ^ self
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3250
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3251
    "
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3252
     3 haltIfNil
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3253
     nil haltIfNil
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3254
    "
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3255
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3256
    "Created: / 17-07-2017 / 10:51:56 / cg"
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3257
!
5178bff40e4d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22011
diff changeset
  3258
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3259
isBreakPointEnabled:someKey
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3260
    "{ Pragma: +optSpace }"
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3261
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3262
    "controls which breakpoints to be enabled."
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3263
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3264
"/    something = OperatingSystem getLoginName ifTrue:[^ true].
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3265
"/    something = 'testThis' ifTrue:[^ true].
11044
fa13d9423e71 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11025
diff changeset
  3266
    EncounteredBreakPoints notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3267
	EncounteredBreakPoints add:someKey
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  3268
    ].
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  3269
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  3270
    ^ (EnabledBreakPoints notNil and:[ EnabledBreakPoints includes:someKey ])
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3271
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3272
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3273
     nil enableBreakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3274
     nil breakPoint:#cg.
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3275
     nil disableBreakPoint:#cg
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3276
     nil breakPoint:#cg.
11045
85315d8893e4 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11044
diff changeset
  3277
85315d8893e4 allow for encounteredBreakPoints to be monitored
Claus Gittinger <cg@exept.de>
parents: 11044
diff changeset
  3278
     EncounteredBreakPoints := Set new.
11025
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3279
    "
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3280
!
f99538ebf2a3 breakpoints improved
Claus Gittinger <cg@exept.de>
parents: 11021
diff changeset
  3281
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3282
mustBeBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3283
    "this message is sent by the VM, if a non-Boolean receiver is encountered
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3284
     in an if* or while* message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3285
     Caveat: for now, this is only sent by the interpreter;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3286
     both the JIT and the stc compiler treat it as undefined."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3287
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3288
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3289
23018
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  3290
    self proceedableError:'Non boolean receiver - proceed for truth'.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3291
    ^ true
23018
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  3292
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  3293
    "Modified: / 24-05-2018 / 21:03:06 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3294
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3295
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3296
mustBeKindOf:aClass
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3297
    "for compatibility & debugging support:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3298
     check if the receiver isKindOf:aClass and raise an error if not.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3299
     Notice:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3300
	it is VERY questionable, if it makes sense to add manual
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3301
	type checks to a dynamically typed language like smalltalk.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3302
	It will, at least, slow down performance,
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3303
	make your code less reusable and clutter your code with stupid sends
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3304
	of this selector. Also, read the comment in isKindOf:, regarding the
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3305
	use of isXXX check methods.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3306
     You see: The author does not like this at all ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3307
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3308
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  3309
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3310
    (self isKindOf:aClass) ifFalse:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3311
	ArgumentError raiseErrorString:'argument is not of expected type'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3312
    ]
24269
ee85a531ef4a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24258
diff changeset
  3313
ee85a531ef4a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24258
diff changeset
  3314
    "Modified (format): / 06-06-2019 / 23:21:03 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3315
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3316
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3317
obsoleteFeatureWarning
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3318
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3319
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3320
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3321
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3322
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3323
     Hopefully, this warning message is annoying enough for you to change the code... ;-)."
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3324
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3325
    self obsoleteFeatureWarning:nil from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3326
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3327
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3328
obsoleteFeatureWarning:message
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3329
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3330
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3331
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3332
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3333
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3334
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3335
     This message is intended for application developers, so its printed as info message."
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3336
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3337
    self obsoleteFeatureWarning:message from:thisContext sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3338
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3339
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3340
obsoleteFeatureWarning:message from:aContext
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3341
    "{ Pragma: +optSpace }"
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3342
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3343
    "in methods which are going to be changed, a send to
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3344
     this method is used to tell programmers that some feature/semantics is
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3345
     used which is going to be changed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3346
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3347
     This message is intended for application developers, so its printed as info message."
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3348
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3349
    |spec sender|
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3350
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3351
    spec := aContext methodPrintString.
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3352
    sender := aContext sender.
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3353
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3354
    ('WARNING: the ''' , spec , ''' semantics will be changed.') infoPrintCR.
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3355
    ('         Its behavior may be different in future ST/X versions.') infoPrintCR.
11527
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3356
    ('         called from ' , sender printString) infoPrintCR.
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3357
    ((sender selector ? '') startsWith:'perform:') ifTrue:[
d8f1c75ee4d2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11401
diff changeset
  3358
    ('         called from ' , sender sender printString) infoPrintCR.
7204
e968d9923408 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 7202
diff changeset
  3359
    ].
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3360
    message notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3361
	'------>  ' infoPrint. message infoPrintCR
6950
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3362
    ]
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3363
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3364
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3365
     Object obsoleteFeatureWarning:'foo' from:thisContext sender sender
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3366
    "
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3367
!
a59ced87dbbf +obsoleteFeatureWarning
Claus Gittinger <cg@exept.de>
parents: 6949
diff changeset
  3368
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3369
obsoleteMethodWarning
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3370
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3371
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3372
    "in methods which are going to be obsoleted, a self send to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3373
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3374
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3375
     Find all methods which will be obsolete soon by looking at senders of this message.
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3376
     Hopefully, this warning message is annoying enough for you to change the code... ;-)"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3377
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3378
    self obsoleteMethodWarning:nil from:thisContext sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3379
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3380
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3381
obsoleteMethodWarning:message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3382
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3383
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3384
    "in methods which are going to be obsoleted, a self send to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3385
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3386
     used which is going to be removed in later ST/X versions.
6963
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3387
     Find all methods which will be obsolete soon by looking at senders of this message.
711b3bf3b38a comments
Claus Gittinger <cg@exept.de>
parents: 6962
diff changeset
  3388
     Hopefully, this warning message is annoying enough for you to change the code... ;-)"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3389
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3390
    self obsoleteMethodWarning:message from:thisContext sender
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3391
!
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3392
16470
94bfe026a2cc class: Object
Claus Gittinger <cg@exept.de>
parents: 16408
diff changeset
  3393
obsoleteMethodWarning:messageOrNil from:aContext
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3394
    "{ Pragma: +optSpace }"
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3395
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3396
    "in methods which are going to be obsoleted, a self-send to
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3397
     this method is used to tell programmers that a method is
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3398
     used which is going to be removed in later ST/X versions.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3399
     Find all methods which will be obsolete soon by looking at senders of this message.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3400
     Hopefully, this warning message is annoying enough for you to change the code... ;-).
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3401
     This message is intended for application developers, so its printed as info message."
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3402
16470
94bfe026a2cc class: Object
Claus Gittinger <cg@exept.de>
parents: 16408
diff changeset
  3403
    |spec sender message|
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3404
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3405
    Smalltalk isSmalltalkDevelopmentSystem ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3406
	"ignore in production systems"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3407
	^ self.
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3408
    ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3409
16470
94bfe026a2cc class: Object
Claus Gittinger <cg@exept.de>
parents: 16408
diff changeset
  3410
    message := messageOrNil ? 'Obsolete method called'.
94bfe026a2cc class: Object
Claus Gittinger <cg@exept.de>
parents: 16408
diff changeset
  3411
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3412
    spec := aContext methodPrintString.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3413
    sender := aContext sender.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3414
    ('WARNING: the ''' , spec , ''' method is obsolete.') infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3415
    ('         And may not be present in future ST/X versions.') infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3416
    ('         called from ' , sender printString) infoPrintCR.
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3417
    (sender selector startsWith:'perform:') ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3418
	sender := sender sender.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3419
	(sender selector startsWith:'perform:') ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3420
	    sender := sender sender.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3421
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3422
	('         called from ' , sender printString) infoPrintCR.
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3423
    ].
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3424
    message notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3425
	'------>  ' infoPrint. message infoPrintCR
16383
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3426
    ].
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3427
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3428
    "CG: care for standalone non-GUI progs, which have no userPreferences class"
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3429
    (Smalltalk isInitialized
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3430
    and:[ UserPreferences notNil
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  3431
    and:[ UserPreferences current haltInObsoleteMethod]]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3432
	"/ cg: nice try, stefan, but I don't want halts in system processes (fly by help and others)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3433
	Processor activeProcess isSystemProcess ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3434
	    (message , ' - please fix this now (no halt in system process)') infoPrintCR
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3435
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3436
	    "/ please check for the sender of the obsoleteMethodWarning,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3437
	    "/ and fix the code there.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3438
	    "/ ObsoleteMethodCallWarning ignoreWarningFrom:thisContext
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3439
	    ObsoleteMethodCallWarning raiseRequestErrorString:(message , ' - please fix this now!!')
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3440
	].
15716
72e323fea23f class: Object
Claus Gittinger <cg@exept.de>
parents: 15683
diff changeset
  3441
    ].
8829
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3442
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3443
    "
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3444
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
9e640b6c0679 No obsolete messages in standalone apps
Stefan Vogel <sv@exept.de>
parents: 8827
diff changeset
  3445
    "
9509
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3446
bfb55a08130d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9442
diff changeset
  3447
    "Modified: / 10-08-2006 / 13:13:11 / cg"
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3448
!
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3449
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3450
todo
21278
2b9580d3cabc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21272
diff changeset
  3451
    "used to mark code pieces that have to be implemented.
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3452
     Halts when reached in development mode;
21278
2b9580d3cabc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21272
diff changeset
  3453
     ignored in deployed production code."
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3454
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3455
    <resource: #skipInDebuggersWalkBack>
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3456
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3457
    self halt:'more work needed here'.
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3458
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3459
    "
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3460
     example:
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3461
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3462
	...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3463
	self todo.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3464
	...
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3465
    "
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3466
!
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3467
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3468
todo:aBlock
21278
2b9580d3cabc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21272
diff changeset
  3469
    "used to mark code pieces that have to be implemented.
2b9580d3cabc #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21272
diff changeset
  3470
     The coe in aBlock is ignored."
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3471
12341
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3472
    <resource: #skipInDebuggersWalkBack>
47a2bade1cbd added: #todo
Claus Gittinger <cg@exept.de>
parents: 12340
diff changeset
  3473
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3474
"/    self halt.
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3475
"/    aBlock value.
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3476
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3477
    "
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3478
     example:
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3479
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3480
	...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3481
	self todo:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3482
	    code which needs more work ...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3483
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3484
	...
10558
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3485
    "
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3486
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3487
    "Created: / 25-05-2007 / 21:34:39 / cg"
Claus Gittinger <cg@exept.de>
parents: 10539
diff changeset
  3488
    "Modified: / 29-05-2007 / 12:11:33 / cg"
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3489
!
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3490
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3491
tracePoint:someKey
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3492
    "{ Pragma: +optSpace }"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3493
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3494
    "Like transcript show, but disabled by default.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3495
     Can be easily enabled.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3496
     Can be filtered on the arguments value (typically: a symbol).
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3497
     Code with tracepoints may be even checked into the source repository"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3498
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3499
    "Example:   nil tracePoint:#stefan"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3500
23757
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3501
    (self isBreakPointEnabled:someKey) ifFalse:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3502
	^ self.
23757
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3503
    ].
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3504
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3505
    Transcript showCR:('Tracepoint (at %1 for %3 from %2)'
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3506
			    bindWith:(Timestamp now printString)
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3507
			    with:(thisContext sender printString)
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3508
			    with:someKey)
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3509
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3510
    "
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3511
     nil tracePoint:#stefan
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3512
     nil tracePoint:#stefan message:'Hello'
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3513
     Smalltalk enableBreakPoint:#stefan.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3514
     Smalltalk disableBreakPoint:#stefan.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3515
    "
15723
2997392ee626 class: Object
Claus Gittinger <cg@exept.de>
parents: 15716
diff changeset
  3516
2997392ee626 class: Object
Claus Gittinger <cg@exept.de>
parents: 15716
diff changeset
  3517
    "Modified: / 28-08-2013 / 21:41:54 / cg"
23757
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3518
    "Modified: / 20-02-2019 / 14:19:28 / Stefan Vogel"
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3519
!
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3520
15804
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3521
tracePoint:someKey message:messageBlockOrString
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3522
    "{ Pragma: +optSpace }"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3523
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3524
    "Like transcript show, but disabled by default.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3525
     Can be easily enabled.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3526
     Can be filtered on the arguments value (typically: a symbol).
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3527
     Code with tracepoints may be even checked into the source repository"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3528
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3529
    "Example:   nil tracePoint:#stefan"
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3530
23757
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3531
    (self isBreakPointEnabled:someKey) ifFalse:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3532
	^ self.
23757
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3533
    ].
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3534
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3535
    Transcript showCR:('Tracepoint: %4 (at %1 for %3 from %2)'
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3536
			    bindWith:(Timestamp now printString)
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3537
			    with:(thisContext sender printString)
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3538
			    with:someKey
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3539
			    with:messageBlockOrString value)
15804
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3540
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3541
    "
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3542
     Smalltalk enableBreakPoint:#stefan.
15804
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3543
     nil tracePoint:#stefan.
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3544
     nil tracePoint:#stefan message:'Hello'.
cc01a011076e class: Object
Stefan Vogel <sv@exept.de>
parents: 15797
diff changeset
  3545
     nil tracePoint:#stefan message:['Hello from block'].
15683
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3546
     Smalltalk disableBreakPoint:#stefan.
d72a36fe05b0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15645
diff changeset
  3547
    "
15723
2997392ee626 class: Object
Claus Gittinger <cg@exept.de>
parents: 15716
diff changeset
  3548
2997392ee626 class: Object
Claus Gittinger <cg@exept.de>
parents: 15716
diff changeset
  3549
    "Modified: / 28-08-2013 / 21:41:47 / cg"
23757
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  3550
    "Modified: / 20-02-2019 / 14:19:47 / Stefan Vogel"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3551
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3552
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3553
!Object methodsFor:'dependents access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3554
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3555
addDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3556
    "make the argument, anObject be a dependent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3557
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3558
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3559
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3560
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3561
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3562
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3563
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3564
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3565
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3566
    [
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3567
	|deps dep|
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3568
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3569
	deps := self dependents.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3570
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3571
	"/ to save a fair amount of memory in case of
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3572
	"/ many dependencies, we store a single dependent in
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3573
	"/ a WeakArray, and switch to a WeakSet if more dependents are
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3574
	"/ added.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3575
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3576
	(deps isEmptyOrNil) ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3577
	    self dependents:(WeakArray with:anObject)
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3578
	] ifFalse:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3579
	    deps class == WeakArray ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3580
		dep := deps at:1.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3581
		dep ~~ anObject ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3582
		    (dep isNil or:[dep class == SmallInteger "old dependent already collected"]) ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3583
			deps at:1 put:anObject
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3584
		    ] ifFalse:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3585
			self dependents:(WeakIdentitySet with:dep with:anObject)
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3586
		    ]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3587
		]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3588
	    ] ifFalse:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3589
		deps add:anObject
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3590
	    ]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3591
	]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3592
    ] ensure:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3593
	wasBlocked ifFalse:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3594
	    OperatingSystem unblockInterrupts
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3595
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3596
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3597
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3598
    "Modified: / 27-10-1997 / 19:35:52 / cg"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3599
    "Modified: / 15-03-2017 / 17:17:44 / stefan"
22535
c200e13cb030 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 22529
diff changeset
  3600
    "Modified (comment): / 07-02-2018 / 11:45:32 / stefan"
23753
3dd790938ee8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23752
diff changeset
  3601
    "Modified: / 19-02-2019 / 23:45:03 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3602
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3603
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3604
breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3605
    "remove all dependencies from the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3606
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3607
    self dependents:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3608
    self nonWeakDependents:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3609
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3610
    "Modified: / 19.4.1996 / 10:55:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3611
    "Created: / 27.2.1998 / 11:26:11 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3612
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3613
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3614
breakDependentsRecursively
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3615
    "remove all dependencies from the receiver and
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3616
     recursively from all objects referred to by the receiver."
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3617
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3618
    self breakDependents.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3619
    1 to:self class instSize do:[:idx |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3620
	(self instVarAt:idx) breakDependentsRecursively.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3621
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3622
    1 to:self basicSize do:[:idx |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3623
	(self basicAt:idx) breakDependentsRecursively.
8542
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3624
    ]
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3625
!
38f9d04fe40a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8521
diff changeset
  3626
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3627
dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3628
    "return a Collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3629
     The default implementation here uses a global WeakDictionary to store
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3630
     dependents
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3631
     This may be too slow for high frequency change&update,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3632
     therefore, some classes (Model) redefine this for better performance.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3633
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3634
23553
32d6256affcf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23544
diff changeset
  3635
    ^ Dependencies at:self ifAbsent:#()
32d6256affcf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23544
diff changeset
  3636
32d6256affcf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23544
diff changeset
  3637
    "
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3638
	#(1 2 3) dependents
23553
32d6256affcf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23544
diff changeset
  3639
    "
32d6256affcf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23544
diff changeset
  3640
32d6256affcf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23544
diff changeset
  3641
    "Modified: / 26-01-1998 / 11:18:15 / cg"
32d6256affcf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23544
diff changeset
  3642
    "Modified (comment): / 03-12-2018 / 17:54:14 / Stefan Vogel"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3643
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3644
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3645
dependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3646
    "set the collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3647
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3648
     dependents which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3649
     Therefore, some classes (Model) redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3650
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3651
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3652
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3653
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3654
    "/ faster execution (and to avoid creation of garbage blocks).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3655
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3656
    (OperatingSystem blockInterrupts) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3657
	"/ the common case - already blocked
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3658
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3659
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3660
	    Dependencies removeKey:self ifAbsent:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3661
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3662
	    Dependencies at:self put:aCollection
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3663
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3664
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3665
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3666
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3667
    [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3668
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3669
	    Dependencies removeKey:self ifAbsent:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3670
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3671
	    Dependencies at:self put:aCollection
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3672
	].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3673
    ] ensure:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3674
	OperatingSystem unblockInterrupts
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3675
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3676
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3677
    "Modified: 30.1.1997 / 21:22:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3678
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3679
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3680
dependentsDo:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3681
    "evaluate aBlock for all of my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3682
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3683
    |deps nwDeps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3684
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3685
    deps := self dependents.
23753
3dd790938ee8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23752
diff changeset
  3686
    deps notEmptyOrNil ifTrue:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3687
	deps do:[:d |
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3688
		    (d notNil and:[d class ~~ SmallInteger]) ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3689
			aBlock value:d
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3690
		    ]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3691
		]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3692
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3693
    nwDeps := self nonWeakDependents.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3694
    (nwDeps ~~ deps and:[nwDeps notNil]) ifTrue:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  3695
	nwDeps do:aBlock
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3696
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3697
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3698
    "Modified: / 30-01-1998 / 14:03:40 / cg"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3699
    "Modified: / 15-03-2017 / 17:15:09 / stefan"
23753
3dd790938ee8 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23752
diff changeset
  3700
    "Modified: / 19-02-2019 / 23:44:42 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3701
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3702
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3703
myDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3704
    "same as dependents - ST-80 compatibility"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3705
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3706
    ^ self dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3707
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3708
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3709
release
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3710
    "remove all references to objects that may refer to self.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3711
     Subclasses may redefine this method but should do a 'super release'."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3712
21382
3e2fd51cbc0c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21375
diff changeset
  3713
    <modifier: #super> "must be called if redefined"
3e2fd51cbc0c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21375
diff changeset
  3714
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3715
    self breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3716
21382
3e2fd51cbc0c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21375
diff changeset
  3717
    "Modified: / 27-02-1998 / 11:29:35 / stefan"
3e2fd51cbc0c #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21375
diff changeset
  3718
    "Modified: / 08-02-2017 / 00:23:42 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3719
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3720
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3721
removeDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3722
    "make the argument, anObject be independent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3723
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3724
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3725
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3726
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3727
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3728
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3729
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3730
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3731
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3732
    [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3733
	|deps n dep|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3734
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3735
	deps := self dependents.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3736
	deps notEmptyOrNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3737
	    "/ to save a fair amount of memory in case of
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3738
	    "/ many dependencies, we store a single dependent in
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3739
	    "/ a WeakArray, and switch to a WeakSet if more dependents are
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3740
	    "/ added. Here we have to do the inverse ...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3741
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3742
	    ((deps class == WeakArray) or:[deps class == Array]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3743
		((dep := deps at:1) == anObject
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3744
		  or:[dep isNil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3745
		  or:[dep class == SmallInteger]]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3746
		    self dependents:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3747
		]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3748
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3749
		dep := deps remove:anObject ifAbsent:[].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3750
		"if dep is nil, nothing has changed"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3751
		dep notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3752
		    (n := deps size) == 0 ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3753
			self dependents:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3754
		    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3755
			n == 1 ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3756
			    dep := deps firstIfEmpty:nil.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3757
			    dep notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3758
				deps := (deps isWeakCollection ifTrue:[WeakArray] ifFalse:[Array]) with:dep
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3759
			    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3760
				deps := nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3761
			    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3762
			    self dependents:deps.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3763
			]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3764
		    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3765
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3766
	    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3767
	]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3768
    ] ensure:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3769
	wasBlocked ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3770
	    OperatingSystem unblockInterrupts
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3771
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3772
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3773
13500
51b2e6c6c2ac changed:
Claus Gittinger <cg@exept.de>
parents: 13488
diff changeset
  3774
    "Modified: / 05-07-2011 / 22:49:31 / cg"
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3775
    "Modified (format): / 15-03-2017 / 17:20:23 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3776
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3777
7266
f2b64d3b43cf method category rename
Claus Gittinger <cg@exept.de>
parents: 7261
diff changeset
  3778
!Object methodsFor:'dependents access (non weak)'!
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3779
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3780
addNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3781
    "make the argument, anObject be a nonWeak dependent of the receiver.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  3782
     Be careful: this nonWeakDependency will prevent the dependent from being
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3783
     garbage collected unless the dependency is removed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3784
     This is a private mechanism, for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3785
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3786
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3787
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3788
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3789
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3790
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3791
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3792
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3793
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3794
    [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3795
	|deps dep|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3796
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3797
	deps := self nonWeakDependents.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3798
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3799
	"/ to save a fair amount of memory in case of
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3800
	"/ many dependencies, we store a single dependent in
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3801
	"/ an Array, and switch to a Set if more dependents are
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3802
	"/ added.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3803
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3804
	deps isEmptyOrNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3805
	    anObject notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3806
		self nonWeakDependents:(Array with:anObject).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3807
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3808
		"adding nil causes problems when adding the next one
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3809
		 (see below: trying to add nil to IdentitySet)"
9442
f564054eaf6a do not add nil as dependent
Stefan Vogel <sv@exept.de>
parents: 9405
diff changeset
  3810
"/                self halt:'try to add nil to list of dependents'.
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3811
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3812
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3813
	    deps class == Array ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3814
		dep := deps at:1.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3815
		dep ~~ anObject ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3816
		    self nonWeakDependents:(IdentitySet with:dep with:anObject)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3817
		]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3818
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3819
		deps add:anObject
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3820
	    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3821
	]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3822
    ] ensure:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3823
	wasBlocked ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3824
	    OperatingSystem unblockInterrupts
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3825
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3826
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3827
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3828
    "Created: / 19-04-1996 / 10:54:08 / cg"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3829
    "Modified: / 30-01-1998 / 14:03:08 / cg"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3830
    "Modified: / 15-03-2017 / 17:18:11 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3831
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3832
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3833
nonWeakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3834
    "return a Collection of nonWeakDependents - empty if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3835
     This is a private mechanism for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3836
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3837
    NonWeakDependencies isNil ifTrue:[^ #()].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3838
    ^ NonWeakDependencies at:self ifAbsent:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3839
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3840
    "Created: / 19.4.1996 / 10:55:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3841
    "Modified: / 30.1.1998 / 14:06:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3842
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3843
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3844
nonWeakDependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3845
    "set the collection of nonWeak dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3846
     This is a private helper for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3847
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3848
    [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3849
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3850
	    NonWeakDependencies removeKey:self ifAbsent:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3851
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3852
	    NonWeakDependencies at:self put:aCollection
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3853
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3854
    ] valueUninterruptably
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3855
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3856
    "Created: 19.4.1996 / 11:07:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3857
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3858
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3859
removeNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3860
    "remove a nonWeak dependency from the receiver to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3861
     (i.e. make it independent of the receiver)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3862
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3863
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3864
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3865
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3866
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3867
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3868
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3869
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3870
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3871
    [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3872
	|deps n|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3873
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3874
	deps := self nonWeakDependents.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3875
	deps notEmptyOrNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3876
	    deps class == Array ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3877
		(deps at:1) == anObject ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3878
		    self nonWeakDependents:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3879
		]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3880
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3881
		deps remove:anObject ifAbsent:[].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3882
		(n := deps size) == 0 ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3883
		    self nonWeakDependents:nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3884
		] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3885
		    n == 1 ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3886
			self nonWeakDependents:(Array with:(deps first))
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3887
		    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3888
		]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3889
	    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3890
	]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3891
    ] ensure:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3892
	wasBlocked ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3893
	    OperatingSystem unblockInterrupts
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3894
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3895
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3896
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3897
    "Created: / 19-04-1996 / 11:44:44 / cg"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3898
    "Modified: / 30-01-1998 / 14:04:01 / cg"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  3899
    "Modified: / 15-03-2017 / 17:19:38 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3900
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3901
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3902
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  3903
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3904
!Object methodsFor:'displaying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3905
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3906
ascentOn:aGC
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3907
    "when displayed via displayOn:, some objects assume that the given y coordinate
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3908
     is the baseline (strings, text etc. do), while others assume that the topY
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3909
     coordinate is given by y.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3910
     In other words: some draw above the given y coordinate.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3911
     This method returns the number of pixels by which the receiver will draw above
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3912
     the given y coordinate."
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3913
11065
17c01b01000f Simplify (and speed up) #ascentOn:
Stefan Vogel <sv@exept.de>
parents: 11048
diff changeset
  3914
    ^ aGC fontAscent
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3915
!
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3916
22523
6ef85a264c28 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22521
diff changeset
  3917
classDisplayString
6ef85a264c28 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22521
diff changeset
  3918
    "used by walkbacks and inspectors;
6ef85a264c28 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22521
diff changeset
  3919
     same as self class displayString for smalltalk objects;
6ef85a264c28 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22521
diff changeset
  3920
     redefinable for proxy objects to not display the className of the proxy,
6ef85a264c28 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22521
diff changeset
  3921
     but the classname of the remote object (-> JavaObject)"
6ef85a264c28 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22521
diff changeset
  3922
6ef85a264c28 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22521
diff changeset
  3923
    ^ self class displayString.
6ef85a264c28 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22521
diff changeset
  3924
!
6ef85a264c28 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22521
diff changeset
  3925
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  3926
displayOn:aGCOrStream
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3927
    "Compatibility
21525
fd6b13ad5e79 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21480
diff changeset
  3928
       append a printed desription on some stream (Dolphin,  Squeak)
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3929
     OR:
21525
fd6b13ad5e79 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21480
diff changeset
  3930
       display the receiver in a graphicsContext at 0@0 (ST80).
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  3931
     This method allows for any object to be displayed in some view
24356
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3932
     (although the fallBack is to display its printString ...)
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3933
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3934
     Notice: displayString and displayOn: are for developers, debugging and inspectors,
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3935
     whereas printString and printOn: are for the program to print data."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3936
23544
b2e68ae391bf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23523
diff changeset
  3937
    aGCOrStream isStream ifFalse:[
24356
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3938
        "/ what a kludge - Dolphin and Squeak mean: printOn: a stream;
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3939
        "/ old ST80 means: draw-yourself on a GC.
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3940
        self obsoleteFeatureWarning:'displayOn: should not be used to display objects in a GC'.
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3941
        self displayOn:aGCOrStream x:0 y:0.
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3942
        ^ self.
23544
b2e68ae391bf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23523
diff changeset
  3943
    ].
b2e68ae391bf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23523
diff changeset
  3944
    self printOn:aGCOrStream.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3945
21525
fd6b13ad5e79 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21480
diff changeset
  3946
    "Created: / 29-05-1996 / 16:28:58 / cg"
21528
cecce0ae3ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 21525
diff changeset
  3947
    "Modified (format): / 22-02-2017 / 17:03:14 / cg"
23544
b2e68ae391bf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23523
diff changeset
  3948
    "Modified: / 23-11-2018 / 14:54:12 / Stefan Vogel"
24356
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  3949
    "Modified (comment): / 25-06-2019 / 10:47:18 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3950
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3951
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3952
displayOn:aGC at:aPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3953
    "ST-80 Compatibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3954
     display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3955
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3956
23544
b2e68ae391bf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23523
diff changeset
  3957
    self displayOn:aGC x:(aPoint x) y:(aPoint y).
b2e68ae391bf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23523
diff changeset
  3958
b2e68ae391bf #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 23523
diff changeset
  3959
    "Modified: / 23-11-2018 / 14:54:34 / Stefan Vogel"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3960
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3961
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3962
displayOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3963
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3964
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3965
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3966
    self displayOn:aGC x:x y:y opaque:false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3967
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3968
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3969
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3970
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3971
displayOn:aGc x:x y:y opaque:opaque
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3972
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3973
     for any object to be displayed in a ListView - for example.
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  3974
     The fallBack here shows the receiver's displayString.
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3975
     Notice, that the string is displayed on the baseLine;
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3976
     ask using #ascentOn: if required"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3977
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3978
    |s yBaseline|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3979
15368
1509922b75ec class: Object
Claus Gittinger <cg@exept.de>
parents: 15362
diff changeset
  3980
    s := self isString ifTrue:[self] ifFalse:[self displayString].
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  3981
    yBaseline := y "+ aGc font ascent".
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3982
    opaque ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3983
	aGc displayOpaqueString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3984
    ] ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  3985
	aGc displayString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3986
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3987
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3988
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3989
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3990
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3991
displayOpaqueOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3992
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3993
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3994
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3995
    self displayOn:aGC x:x y:y opaque:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3996
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3997
    "Modified: / 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3998
    "Created: / 26.10.1997 / 15:01:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3999
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4000
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4001
displayString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4002
    "return a string used when displaying the receiver in a view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4003
     for example an Inspector. This is usually the same as printString,
14292
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  4004
     but sometimes redefined for a better look.
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  4005
24356
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  4006
     Notice: displayString and displayOn: are for developers, debugging and inspectors,
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  4007
     whereas printString and printOn: are for the program to print data.
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  4008
14292
1cbc2d35aa17 Implement #displayOn: instead of #displayString
Stefan Vogel <sv@exept.de>
parents: 14272
diff changeset
  4009
     Note: the base method (used by the inspector) is #displayOn:.
24354
030089a76309 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24319
diff changeset
  4010
           So you should implement #displayOn: instead of #displayString in subclasses."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4011
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  4012
    |s|
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  4013
24354
030089a76309 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24319
diff changeset
  4014
    "/ attention: TextStream is not present in ultra-mini standalone apps (WriteStream is in libbasic)
030089a76309 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24319
diff changeset
  4015
    s := (TextStream ? CharacterWriteStream ? WriteStream) on:(String new:32).
7081
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  4016
    self displayOn:s.
4e1ae4a0b3c1 added ascentOn: (display-ascent);
Claus Gittinger <cg@exept.de>
parents: 7048
diff changeset
  4017
    ^ s contents
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4018
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4019
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4020
     #(1 2 3) printString
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4021
     #(1 2 3) displayString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4022
     #(1 2 3) storeString
24354
030089a76309 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24319
diff changeset
  4023
     #hello printString
030089a76309 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24319
diff changeset
  4024
     #hello displayString
030089a76309 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24319
diff changeset
  4025
     #hello storeString
030089a76309 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24319
diff changeset
  4026
    "
030089a76309 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 24319
diff changeset
  4027
24356
3da92afe1944 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24354
diff changeset
  4028
    "Modified (comment): / 25-06-2019 / 10:47:29 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4029
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4030
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4031
heightOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4032
    "return the height of the receiver, if it is to be displayed on aGC"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4033
20222
a1883a86603d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20214
diff changeset
  4034
    ^ aGC deviceFont heightOf:(self displayString)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4035
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4036
16010
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4037
printStringForPrintIt
24659
c42004494020 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24624
diff changeset
  4038
    "for compatibility (used to be displayString), 
c42004494020 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24624
diff changeset
  4039
     the printIt menu function now sends this message, 
c42004494020 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24624
diff changeset
  4040
     allowing for more fine-grain control over what is printed."
16010
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4041
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4042
    ^ self displayString
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4043
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4044
    "
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4045
     #(1 2 3) printString
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4046
     #(1 2 3) printStringForPrintIt
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4047
     #(1 2 3) storeString
24659
c42004494020 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24624
diff changeset
  4048
c42004494020 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24624
diff changeset
  4049
     'hello' printString       
c42004494020 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24624
diff changeset
  4050
     'hello' printStringForPrintIt  
c42004494020 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24624
diff changeset
  4051
     'hello' storeString           
16010
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4052
    "
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4053
!
6bb36b8b4f4a class: Object
Claus Gittinger <cg@exept.de>
parents: 15943
diff changeset
  4054
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4055
widthFrom:startIndex to:endIndex on:aGC
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4056
    "return the width of the receiver, if it is to be displayed on aGC"
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4057
20222
a1883a86603d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20214
diff changeset
  4058
    ^ aGC deviceFont widthOf:(self displayString) from:startIndex to:endIndex
6654
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4059
!
a760031ee530 +widthFrom:to:on:
Michael Beyl <mb@exept.de>
parents: 6652
diff changeset
  4060
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4061
widthOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4062
    "return the width of the receiver, if it is to be displayed on aGC"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4063
20222
a1883a86603d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20214
diff changeset
  4064
    ^ aGC deviceFont widthOf:(self displayString)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4065
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4066
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4067
!Object methodsFor:'double dispatching'!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4068
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4069
equalFromComplex:aComplex
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4070
    "adding this method here allows for any non-number to be compared to a complex
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4071
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4072
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4073
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4074
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4075
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4076
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4077
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4078
equalFromFixedPoint:aFixedPoint
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4079
    "adding this method here allows for any non-number to be compared to a fixedPoint
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4080
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4081
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4082
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4083
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4084
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4085
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4086
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4087
equalFromFloat:aFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4088
    "adding this method here allows for any non-number to be compared to a float
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4089
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4090
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4091
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4092
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4093
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4094
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4095
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4096
equalFromFraction:aFraction
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4097
    "adding this method here allows for any non-number to be compared to a fraction
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4098
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4099
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4100
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4101
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4102
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4103
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4104
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4105
equalFromInteger:anInteger
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4106
    "adding this method here allows for any non-number to be compared to an integer
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4107
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4108
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4109
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4110
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4111
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4112
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4113
7455
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4114
equalFromLargeFloat:aLargeFloat
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4115
    "adding this method here allows for any non-number to be compared to a largeFloat
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4116
     and return false from this comparison.
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4117
     Reason: we want to be able to put both numbers and non-numbers into a collection
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4118
     which uses #= (i.e. a Set or Dictionary)."
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4119
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4120
    ^ false
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4121
!
6abc135763f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7402
diff changeset
  4122
7359
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4123
equalFromLongFloat:aLongFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4124
    "adding this method here allows for any non-number to be compared to a longFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4125
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4126
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4127
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4128
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4129
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4130
!
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4131
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4132
equalFromShortFloat:aShortFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4133
    "adding this method here allows for any non-number to be compared to a shortFloat
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4134
     and return false from this comparison.
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4135
     Reason: we want to be able to put both numbers and non-numbers into a collection
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4136
     which uses #= (i.e. a Set or Dictionary)."
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4137
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4138
    ^ false
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4139
! !
67d55d0086fb storing short floats fixed
Claus Gittinger <cg@exept.de>
parents: 7345
diff changeset
  4140
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4141
!Object methodsFor:'encoding & decoding'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4142
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4143
decodeAsLiteralArray
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4144
    "given a literalEncoding in the receiver,
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4145
     create & return the corresponding object.
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4146
     The inverse operation to #literalArrayEncoding."
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4147
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4148
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4149
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4150
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4151
encodeOn:anEncoder with:aParameter
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4152
    "not used any longer. Kept for backward comaptibility"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4153
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4154
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4155
8404
c0bd2a56dc3b *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 8397
diff changeset
  4156
    self acceptVisitor:anEncoder with:aParameter
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4157
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4158
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4159
encodingVectorForInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4160
    "OBSOLETE, use elementDescriptorForInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4161
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4162
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4163
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4164
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4165
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4166
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4167
      #(1 2 3 nil true symbol) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4168
      Dictionary new encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4169
      (5 @ nil) encodingVectorForInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4170
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4171
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4172
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4173
encodingVectorForNonNilInstanceVariables
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4174
    "OBSOLETE, use elementDescriptorForNonNilInstanceVariables"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4175
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4176
    <resource: #obsolete>
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4177
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4178
    ^ self elementDescriptorForInstanceVariablesMatching:[:varVal | varVal notNil].
6718
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4179
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4180
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4181
      #(1 2 3 nil true symbol) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4182
      (5 @ nil) encodingVectorForNonNilInstanceVariables
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4183
    "
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4184
!
6d91ccd79d53 Encoding stuff
Stefan Vogel <sv@exept.de>
parents: 6716
diff changeset
  4185
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4186
fromLiteralArrayEncoding:aSpecArray
8798
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4187
    "read my attributes from aSpecArray.
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4188
     Recursively decodes arguments and stores them using the setters
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4189
     as coming from the literal array encoded specArray."
8798
73676c762813 comment
Claus Gittinger <cg@exept.de>
parents: 8789
diff changeset
  4190
23221
637fe0932dff Work around stc bug (cascade)
Stefan Vogel <sv@exept.de>
parents: 23219
diff changeset
  4191
    |sel litVal val msg
637fe0932dff Work around stc bug (cascade)
Stefan Vogel <sv@exept.de>
parents: 23219
diff changeset
  4192
     stop "{ Class:SmallInteger }" |
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4193
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4194
    stop := aSpecArray size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4195
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4196
    2 to:stop by:2 do:[:i|
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4197
	sel := aSpecArray at:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4198
	litVal := aSpecArray at:i + 1.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4199
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4200
	(self respondsTo:sel) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4201
	    val := litVal decodeAsLiteralArray.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4202
	    self perform:sel with:val
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4203
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4204
	    "/ that's a debug halt,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4205
	    "/ it should probably be removed (to simply ignore unhandled attributes)...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4206
	    "/ for now, it is left in, in order to easily find incompatibilities between
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4207
	    "/ VW and ST/X.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4208
	    self breakPoint:#cg.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4209
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4210
	    msg := '%1: unhandled literalArrayEncoding attribute: %2'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4211
			bindWith:self class name
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4212
			with:sel.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4213
	    UnhandledAttributeInLiteralArrayErrorSignal isHandled ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4214
		|ex|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4215
		ex := UnhandledAttributeInLiteralArrayErrorSignal new.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4216
		ex
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4217
		    badLiteralArray:self;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4218
		    parameter:sel;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4219
		    notify:msg.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4220
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4221
		msg infoPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4222
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4223
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4224
    ]
23219
a043f994d4bc #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23034
diff changeset
  4225
a043f994d4bc #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23034
diff changeset
  4226
    "Modified: / 19-07-2018 / 12:12:14 / Stefan Vogel"
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4227
    "Modified (comment): / 09-08-2018 / 17:32:30 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4228
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4229
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4230
literalArrayEncoding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4231
    "generate a literalArrayEncoding array for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4232
     This uses #literalArrayEncodingSlotOrder which defines the slots and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4233
     order and #skippedInLiteralEncoding which defines slots to skip.
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4234
     In addition, an object may define virtualSlotsInLiteralEncoding for slots
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4235
     which are not really instvars, but should be fetched via getters.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4236
     For most subclasses, there is no need to redefine those."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4237
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4238
    |names encoding cls skipped slots virtualSlots|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4239
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4240
    self isLiteral ifTrue:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4241
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4242
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4243
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4244
    slots    := self literalArrayEncodingSlotOrder.
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4245
    virtualSlots := self virtualSlotsInLiteralEncoding.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4246
    skipped  := self skippedInLiteralEncoding.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4247
    cls      := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4248
    names    := cls allInstVarNames.
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4249
    encoding := OrderedCollection new:(1 + (2 * (slots size + virtualSlots size - skipped size))).
8839
c4471cb2799f stefan: bitte vor Einchecken Testen !
Claus Gittinger <cg@exept.de>
parents: 8833
diff changeset
  4250
    encoding add:cls name.
8832
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4251
8210e23f6c32 Speed up #literalArrayEncoding
Stefan Vogel <sv@exept.de>
parents: 8829
diff changeset
  4252
    slots do:[:instSlot |
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4253
	|value nm enc|
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4254
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4255
	nm := names at:instSlot.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4256
	(skipped includes:nm) ifFalse:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4257
	    (value := self instVarAt:instSlot) notNil ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4258
		(enc := value literalArrayEncoding) notNil ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4259
		    encoding add:(nm asMutator).
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4260
		    encoding add:enc
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4261
		]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4262
	    ]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4263
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4264
    ].
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4265
    virtualSlots do:[:vSlotName |
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4266
	|value|
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4267
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4268
	(skipped includes:vSlotName) ifFalse:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4269
	    (value := self perform:vSlotName) notNil ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4270
		encoding add:(vSlotName asMutator).
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4271
		encoding add:value literalArrayEncoding
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4272
	    ]
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4273
	]
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4274
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4275
    ^ encoding asArray
8841
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4276
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4277
    "
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4278
	(1 -> 2) literalArrayEncoding
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4279
	DebugView menuSpec decodeAsLiteralArray literalArrayEncoding  =
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  4280
	   DebugView menuSpec
8841
d5acf50ec5a6 Comment
Stefan Vogel <sv@exept.de>
parents: 8839
diff changeset
  4281
    "
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4282
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4283
    "Modified (comment): / 09-08-2018 / 17:31:51 / Claus Gittinger"
23716
bd9d42709b9b #BUGFIX by sr
sr
parents: 23661
diff changeset
  4284
    "Modified: / 11-02-2019 / 16:50:30 / sr"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4285
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4286
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4287
literalArrayEncodingSlotOrder
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4288
    "define the order in which inst-slots are saved when generating
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4289
     a literalArrayEncoding"
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4290
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4291
    ^ 1 to:self class instSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4292
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4293
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4294
postDecodeFrom:aDecoder aspect:aspectSymbol
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4295
    "invoked by xmlDecoder (and others in the future), after an
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4296
     object has been decoded (i.e. its instance variables have been restored)"
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4297
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4298
    ^ self
7112
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4299
!
6299f5d9129c added postDecodeFrom - to allow for an object to
martin
parents: 7094
diff changeset
  4300
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4301
skippedInLiteralEncoding
23270
194ed0e9c2c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 23262
diff changeset
  4302
    "return the inst-slots which are skipped when generating a literalArrayEncoding;
24504
a3b2ffb4a2d5 #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 24497
diff changeset
  4303
     (to skip the ones with default or irrelevant values.)"
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
  4304
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4305
    ^ #()
23270
194ed0e9c2c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 23262
diff changeset
  4306
194ed0e9c2c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 23262
diff changeset
  4307
    "Modified (comment): / 09-08-2018 / 17:16:44 / Claus Gittinger"
23271
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4308
!
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4309
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4310
virtualSlotsInLiteralEncoding
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4311
    "defines additional virtual slots in the literalEncoding.
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4312
     These are not instvars, but accessed via getters and setters during
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4313
     store and load.
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4314
     Use this when flags encode values which were previously encoded as boolean instvars,
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4315
     to remain backward compatible"
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4316
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4317
    ^ #()
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4318
676915d2e795 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23270
diff changeset
  4319
    "Created: / 09-08-2018 / 17:22:04 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4320
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4321
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4322
!Object methodsFor:'error handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4323
16012
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4324
abortOperation
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4325
    "{ Pragma: +optSpace }"
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4326
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4327
    "raise the AbortOperationRequest signal.
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4328
     This will unwind and bring the current thread back to the event-handling loop,
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4329
     effectively aborting any current menu, user, doIt, printIt or other operation."
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4330
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4331
    <resource: #skipInDebuggersWalkBack>
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4332
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4333
    ^ AbortOperationRequest raise
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4334
!
10e4d76d9a0c class: Object
Claus Gittinger <cg@exept.de>
parents: 16011
diff changeset
  4335
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4336
ambiguousMessage:aMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4337
    "this message is sent by the system in case that it
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4338
     is not clear which method to execute in response to
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4339
     aMessage.
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4340
     Such situation may occur when a current selector namespace
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4341
     imports two namespaces and both define a method with the
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4342
     requested selector."
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4343
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4344
    <context: #return>
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4345
    <resource: #skipInDebuggersWalkBack>
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4346
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4347
    ^ AmbiguousMessage raiseRequestWith:aMessage
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4348
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4349
    "Created: / 21-07-2010 / 15:44:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4350
    "Modified (comment): / 02-11-2012 / 10:14:42 / cg"
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4351
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  4352
23275
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4353
argumentError
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4354
    "{ Pragma: +optSpace }"
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4355
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4356
    "report an error that some bad argument was given to a methof.
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4357
     The error is reported by raising the ArgumentError exception."
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4358
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4359
    <resource: #skipInDebuggersWalkBack>
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4360
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4361
    ^ ArgumentError raiseRequestWith:nil
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4362
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4363
    "Created: / 14-08-2018 / 10:49:35 / Claus Gittinger"
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4364
!
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4365
23276
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4366
argumentError:msg
23275
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4367
    "{ Pragma: +optSpace }"
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4368
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4369
    "report an error that some bad argument was given to a methof.
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4370
     The error is reported by raising the ArgumentError exception."
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4371
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4372
    <resource: #skipInDebuggersWalkBack>
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4373
23276
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4374
    ^ ArgumentError raiseRequestErrorString:msg
23275
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4375
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4376
    "Created: / 14-08-2018 / 10:49:52 / Claus Gittinger"
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4377
!
1e851692e326 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23271
diff changeset
  4378
23276
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4379
argumentError:msg with:aValue
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4380
    "{ Pragma: +optSpace }"
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4381
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4382
    "report an error that some bad argument was given to a methof.
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4383
     The error is reported by raising the ArgumentError exception."
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4384
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4385
    <resource: #skipInDebuggersWalkBack>
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4386
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4387
    ^ ArgumentError raiseRequestWith:aValue errorString:msg
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4388
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4389
    "Created: / 14-08-2018 / 10:52:20 / Claus Gittinger"
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4390
!
5f38bb055bbe #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23275
diff changeset
  4391
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4392
cannotSendMessage:aMessage to:someReceiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4393
    "this message is sent by the runtime system (VM),
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4394
     when a message is sent to some object, whose class is not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4395
     a valid behavior (see documentation in Behavior)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4396
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4397
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4398
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4399
    ^ VMInternalError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4400
	  raiseWith:someReceiver
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4401
	  errorString:('bad class in send of #' , aMessage selector)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4402
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4403
    "Modified: 23.1.1997 / 00:05:39 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4404
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4405
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4406
conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4407
    "return the signal used for conversion error handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4408
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4409
    ^ self class conversionErrorSignal
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4410
!
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4411
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4412
doesNotUnderstand:aMessage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4413
    "this message is sent by the runtime system (VM) when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4414
     a message is not understood by some object (i.e. there
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4415
     is no method for that selector). The original message has
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4416
     been packed into aMessage (i.e. the receiver, selector and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4417
     any arguments) and the original receiver is then sent the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4418
     #doesNotUnderstand: message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4419
     Here, we raise another signal which usually enters the debugger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4420
     You can of course redefine #doesNotUnderstand: in your classes
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4421
     to implement message delegation,
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  4422
     or handle the MessageNotUnderstood exception gracefully."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4423
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4424
    <context: #return>
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4425
    <resource: #skipInDebuggersWalkBack>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4426
8500
10d47cede03c Speed up MessageNotUnderstood exception sending by layz computation
Stefan Vogel <sv@exept.de>
parents: 8481
diff changeset
  4427
    ^ MessageNotUnderstood raiseRequestWith:aMessage
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4428
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4429
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4430
elementBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4431
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4432
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4433
    "report an error that badElement is out of bounds
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4434
     (i.e. cannot be put into that collection).
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4435
     The error is reported by raising the ElementBoundsError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4436
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4437
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4438
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4439
    ^ ElementBoundsError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4440
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4441
    "Modified: 8.5.1996 / 09:12:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4442
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4443
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4444
elementBoundsError:aValue
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4445
    "{ Pragma: +optSpace }"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4446
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4447
    "report an error that aValue is not valid as element
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4448
     (i.e. cannot be put into that collection).
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4449
     The error is reported by raising the ElementBoundsError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4450
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4451
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4452
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4453
    ^ ElementBoundsError raiseWith:aValue
7215
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4454
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4455
    "Modified: 8.5.1996 / 09:12:45 / cg"
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4456
!
733294e1a8cc correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents: 7211
diff changeset
  4457
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4458
elementNotCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4459
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4460
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4461
    "report an error that object to be stored is no Character.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4462
     (usually when storing into Strings).
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4463
     The error is reported by raising the ElementBoundsError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4464
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4465
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4466
21375
811ebd679ae7 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21351
diff changeset
  4467
    ^ ElementBoundsError raiseErrorString:' - element must be a character'
811ebd679ae7 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21351
diff changeset
  4468
811ebd679ae7 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21351
diff changeset
  4469
    "Modified: / 08-05-1996 / 09:12:49 / cg"
811ebd679ae7 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21351
diff changeset
  4470
    "Modified: / 07-02-2017 / 20:09:42 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4471
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4472
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4473
elementNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4474
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4475
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4476
    "report an error that object to be stored is not Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4477
     (in collections that store integers only).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4478
     The error is reported by raising the ElementOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4479
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4480
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4481
21375
811ebd679ae7 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21351
diff changeset
  4482
    ^ ElementBoundsError raiseErrorString:' - element must be an integer'
811ebd679ae7 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21351
diff changeset
  4483
811ebd679ae7 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21351
diff changeset
  4484
    "Modified: / 08-05-1996 / 09:12:51 / cg"
811ebd679ae7 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 21351
diff changeset
  4485
    "Modified: / 07-02-2017 / 20:09:58 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4486
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4487
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4488
error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4489
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4490
20253
da66d4066959 #OTHER by mawalch
mawalch
parents: 20222
diff changeset
  4491
    "report error that an error occurred.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4492
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4493
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4494
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4495
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4496
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4497
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4498
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4499
    Error raiseWith:#error:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4500
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4501
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4502
     nil error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4503
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4505
    "Modified: / 8.5.1996 / 09:13:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4506
    "Modified: / 2.8.1999 / 17:00:19 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4507
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4508
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4509
error:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4510
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4511
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4512
    "Raise an error with error message aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4513
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4514
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4515
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4516
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4517
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4518
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4519
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4520
    Error raiseWith:#error: errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4521
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4522
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4523
      nil error:' bad bad bad'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4524
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4525
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4526
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4527
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4528
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4529
error:aString mayProceed:mayProceed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4530
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4531
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4532
    "enter debugger with error-message aString.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4533
     The error is reported by raising either the
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4534
     non-proceedable Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4535
     or the ProceedableError exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4536
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4537
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4538
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4539
    mayProceed ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4540
	^ ProceedableError raiseRequestWith:#error: errorString:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4541
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4542
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4543
    Error raiseWith:#error: errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4544
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4545
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4546
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4547
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4548
errorInvalidFormat
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4549
    "{ Pragma: +optSpace }"
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4550
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4551
    "report an error that some conversion to/from string representation failed
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4552
     typically when converting numbers, date, time etc."
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4553
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4554
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4555
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4556
6900
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4557
    ^ ConversionError raiseErrorString:'invalid format'
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4558
!
3b1eafe032b2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6884
diff changeset
  4559
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4560
errorKeyNotFound:aKey
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4561
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4562
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4563
    "report an error that a key was not found in a collection.
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4564
     The error is reported by raising the KeyNotFoundError exception."
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4565
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4566
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4567
24561
835db9da5790 #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 24520
diff changeset
  4568
    |info|
835db9da5790 #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 24520
diff changeset
  4569
835db9da5790 #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 24520
diff changeset
  4570
    aKey class == Character ifTrue:[
835db9da5790 #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 24520
diff changeset
  4571
        info := aKey storeString.
835db9da5790 #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 24520
diff changeset
  4572
    ] ifFalse:[
835db9da5790 #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 24520
diff changeset
  4573
        info := aKey printString.
835db9da5790 #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 24520
diff changeset
  4574
    ].
835db9da5790 #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 24520
diff changeset
  4575
    ^ KeyNotFoundError raiseRequestWith:aKey errorString:(' ', info)
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4576
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  4577
    "
18685
8cce79003d52 class: Object
Claus Gittinger <cg@exept.de>
parents: 18620
diff changeset
  4578
     Dictionary new at:#nonExistentElement
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4579
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4580
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4581
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4582
errorNotFound
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4583
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4584
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4585
    "report an error that no element was found in a collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4586
     The error is reported by raising the NotFoundSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4587
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4588
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4589
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4590
    ^ NotFoundError raiseRequestWith:nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4591
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4592
    "Modified: / 8.5.1996 / 09:13:11 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4593
    "Modified: / 26.7.1999 / 10:51:50 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4594
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4595
6874
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4596
errorNotFound:errorString
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4597
    "{ Pragma: +optSpace }"
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4598
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4599
    "report an error that no element was found in a collection.
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4600
     The error is reported by raising the NotFoundSignal exception."
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4601
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4602
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4603
10837
63d19c75d762 changed #errorNotFound: raise it proceedable
Stefan Vogel <sv@exept.de>
parents: 10834
diff changeset
  4604
    ^ NotFoundError raiseRequestErrorString:errorString
6874
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4605
!
c539a4c44df1 +errorNotFound:
Claus Gittinger <cg@exept.de>
parents: 6845
diff changeset
  4606
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4607
errorSignal
11132
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4608
    "return the signal used for error/error: handling"
e5bd3a66ca80 conversion errors (specific error classes)
Claus Gittinger <cg@exept.de>
parents: 11068
diff changeset
  4609
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4610
    ^ self class errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4611
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4612
    "Created: / 19.6.1998 / 02:32:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4613
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4614
24977
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4615
errorUnsupported:what
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4616
    "{ Pragma: +optSpace }"
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4617
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4618
    "report an error that some functionality is not supported"
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4619
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4620
    <resource: #skipInDebuggersWalkBack>
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4621
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4622
    ^ UnimplementedFunctionalityError raiseRequestErrorString:what
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4623
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4624
     "
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4625
      self errorUnsupported:'foobar'
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4626
     "
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4627
!
32eaed5d822c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24945
diff changeset
  4628
24731
d43c5f381c46 #DOCUMENTATION by Stefan Reise
sr
parents: 24692
diff changeset
  4629
handlerForSignal:exceptionCreator context:theContext originator:originator
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4630
    " should never be invoked for non-blocks/non-exceptions/non-signals"
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4631
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4632
    thisContext isRecursive ifTrue:[^ nil].
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4633
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4634
    'Warning: handlerForSignal invoked for: ' print. self printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4635
    '         context: ' print. theContext printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4636
    '         originator: ' print. originator printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4637
    '         sender: ' print. thisContext sender printCR.
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4638
7566
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4639
    "/ MiniDebugger enter:thisContext withMessage:'oops' mayProceed:true.
f691eac0f114 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7562
diff changeset
  4640
    self error:'this method should only be invoked for blocks, exceptions and signals'.
24731
d43c5f381c46 #DOCUMENTATION by Stefan Reise
sr
parents: 24692
diff changeset
  4641
d43c5f381c46 #DOCUMENTATION by Stefan Reise
sr
parents: 24692
diff changeset
  4642
    "Modified (format): / 06-09-2019 / 15:47:38 / Stefan Reise"
7322
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4643
!
178e33c2a376 catch non-block/non-signal/non-exception being
Claus Gittinger <cg@exept.de>
parents: 7320
diff changeset
  4644
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4645
indexNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4646
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4647
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4648
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4649
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4650
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4651
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4652
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4653
6946
905fcfc8699b signal-classVars replaced by error-class access
Claus Gittinger <cg@exept.de>
parents: 6932
diff changeset
  4654
    ^ NonIntegerIndexError raiseRequestWith:nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4655
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4656
    "Modified: / 8.5.1996 / 09:13:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4657
    "Modified: / 26.7.1999 / 10:57:43 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4658
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4659
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4660
indexNotInteger:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4661
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4662
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4663
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4664
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4665
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4666
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4667
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4668
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4669
    ^ NonIntegerIndexError raiseRequestWith:anIndex
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4670
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4671
    "Created: / 16.5.1998 / 19:39:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4672
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4673
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4674
indexNotIntegerOrOutOfBounds:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4675
    "{ Pragma: +optSpace }"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4676
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4677
    "report an error that index is either non-integral or out of bounds"
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4678
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4679
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4680
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4681
    index isInteger ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4682
	^ self indexNotInteger:index
7216
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4683
    ].
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4684
    ^ self subscriptBoundsError:index
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4685
!
59bfa2ffdcf7 utility
Claus Gittinger <cg@exept.de>
parents: 7215
diff changeset
  4686
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4687
integerCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4688
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4689
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4690
    "generated when a variable declared with an integer type gets a bad value assigned"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4691
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4692
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4693
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4694
"/    ^ self error:'bad assign of ' , self printString ,
24390
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  4695
"/                  ' (' , self className , ') to integer-typed variable'
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4696
    ^ InvalidTypeError
24390
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  4697
        raiseRequestErrorString:(
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  4698
            'bad assign of ' , self printString ,
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  4699
                  ' (' , self className , ') to integer-typed variable')
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4700
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4701
    "Modified: / 02-11-2012 / 10:25:36 / cg"
24390
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  4702
    "Modified (comment): / 28-06-2019 / 09:04:45 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4703
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4704
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4705
invalidCodeObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4706
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4707
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4708
    "this is sent by VM if it encounters some non-method for execution"
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4709
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4710
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4711
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4712
    "/ self error:'not an executable code object'
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4713
    ^ ExecutionError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4714
	raiseRequestErrorString:'not an executable code object'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4715
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4716
    "Created: / 01-08-1997 / 00:16:44 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4717
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4718
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4719
mustBeRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4720
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4722
    "report an argument-not-rectangle-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4723
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4724
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4725
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4726
    "/ ^ self error:'argument must be a Rectangle'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4727
    ^ InvalidTypeError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4728
	raiseRequestErrorString:'argument must be a Rectangle'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4729
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4730
    "Modified: / 02-11-2012 / 10:24:53 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4731
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4732
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4733
mustBeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4734
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4735
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4736
    "report an argument-not-string-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4737
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4738
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4739
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4740
    "/ ^ self error:'argument must be a String'
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4741
    ^ InvalidTypeError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4742
	raiseRequestErrorString:'argument must be a String'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4743
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4744
    "Modified: / 02-11-2012 / 10:24:35 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4745
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4746
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4747
notIndexed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4748
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4749
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4750
    "report an error that receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4751
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4752
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4753
    <context: #return>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4754
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4755
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  4756
    ^ SubscriptOutOfBoundsError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4757
	raiseRequestErrorString:'receiver has no indexed variables'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4758
14539
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4759
    "
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4760
     1234 at:4
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4761
    "
9cc7e1ad8b52 class: Object
Claus Gittinger <cg@exept.de>
parents: 14534
diff changeset
  4762
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4763
    "Modified: 26.7.1996 / 16:43:13 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4764
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4765
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4766
notYetImplemented
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4767
    "{ Pragma: +optSpace }"
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4768
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4769
    "report an error that some functionality is not yet implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4770
     This is here only for compatibility - it has the same meaning as shouldImplement."
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4771
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4772
    <resource: #skipInDebuggersWalkBack>
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4773
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4774
    |sender|
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4775
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4776
    sender := thisContext sender.
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4777
25061
9f5f2ff8c7d5 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 25046
diff changeset
  4778
    ^ UnimplementedFunctionalityError new
9f5f2ff8c7d5 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 25046
diff changeset
  4779
        parameter:(Message selector:sender selector arguments:sender args);
9f5f2ff8c7d5 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 25046
diff changeset
  4780
        lineNumber:sender lineNumber;
9f5f2ff8c7d5 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 25046
diff changeset
  4781
        raise.
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4782
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4783
    "Modified: / 02-11-2012 / 10:24:12 / cg"
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4784
!
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
  4785
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4786
primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4787
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4788
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4789
    "report an error that some primitive code failed.
22139
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4790
     The error is reported by raising the PrimitiveFailure exception."
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4791
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4792
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4793
22139
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4794
    ^ self primitiveFailed:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4795
6005
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4796
    "
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  4797
     1234 primitiveFailed
22139
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4798
    "
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4799
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4800
    "
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4801
     ExternalBytes new basicAt:40
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4802
    "
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4803
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4804
    "
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4805
     [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4806
	ExternalBytes new   basicAt:40
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4807
     ] on:PrimitiveFailure do:[:ex|
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4808
	ex inspect
8324
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4809
     ]
c6e8039f0d83 Set message as parameter in #primitiveFailed
Stefan Vogel <sv@exept.de>
parents: 8322
diff changeset
  4810
    "
22139
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4811
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4812
    "Modified (comment): / 01-08-2017 / 13:50:18 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4813
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4814
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4815
primitiveFailed:messageString
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4816
    "{ Pragma: +optSpace }"
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4817
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4818
    "report an error that some primitive code failed.
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4819
     The error is reported by raising the PrimitiveFailureSignal exception."
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4820
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4821
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4822
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4823
    |sender selector|
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4824
22139
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4825
    "loop to take care of super sends"
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4826
    sender := thisContext sender.
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4827
    [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4828
	selector := sender selector.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4829
	selector == #primitiveFailed: or:[selector == #primitiveFailed]
15891
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4830
    ] whileTrue:[sender := sender sender].
22552f0cd4e4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15854
diff changeset
  4831
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4832
    ^ PrimitiveFailure
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4833
	raiseRequestWith:(Message selector:selector arguments:sender args)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4834
	errorString:messageString
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4835
	in:sender.
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4836
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4837
    "
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4838
     1234 primitiveFailed:'this is a test'
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4839
    "
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4840
22139
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4841
    "
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4842
     ExternalBytes new basicAt:40
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4843
    "
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4844
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4845
    "
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4846
     [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4847
	ExternalBytes new   basicAt:40
22139
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4848
     ] on:PrimitiveFailure do:[:ex|
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4849
	ex inspect
22139
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4850
     ]
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4851
    "
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4852
c51e2379b743 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22121
diff changeset
  4853
    "Modified (format): / 01-08-2017 / 13:51:21 / cg"
8977
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4854
!
fff5644c031d #primitiveFailed: remember the message implementing the failure
Stefan Vogel <sv@exept.de>
parents: 8975
diff changeset
  4855
22998
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4856
proceedableError:errorMessage
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4857
    "Report a proceedable error.
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4858
     A handler can provide a default value"
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4859
22998
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4860
    <resource: #skipInDebuggersWalkBack>
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4861
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4862
    ^ self error:errorMessage mayProceed:true
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4863
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4864
    "Created: / 24-05-2018 / 13:45:58 / Claus Gittinger"
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4865
!
597975de8f85 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22949
diff changeset
  4866
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4867
shouldImplement
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4868
    "{ Pragma: +optSpace }"
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4869
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4870
    "report an error that this message/functionality should be implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4871
     This is send by automatically generated method bodies or inside as-yet-uncoded
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4872
     branches of existing methods."
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4873
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4874
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4875
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4876
    |sender|
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4877
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4878
    sender := thisContext sender.
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4879
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4880
    ^ UnimplementedFunctionalityError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4881
	raiseRequestWith:(Message selector:sender selector arguments:sender args)
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4882
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4883
     "
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4884
      self shouldImplement
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4885
     "
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4886
!
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4887
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4888
shouldImplement:what
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4889
    "{ Pragma: +optSpace }"
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4890
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4891
    "report an error that this message/functionality should be implemented.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4892
     This is send by automatically generated method bodies or inside as-yet-uncoded
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4893
     branches of existing methods."
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4894
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4895
    <resource: #skipInDebuggersWalkBack>
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4896
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4897
    |sender|
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4898
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4899
    sender := thisContext sender.
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4900
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4901
    ^ UnimplementedFunctionalityError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4902
	    raiseRequestWith:(Message selector:sender selector arguments:sender args)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4903
	    errorString:what
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4904
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4905
     "
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4906
      self shouldImplement:'foobar'
9216
6396192d71c6 use UnimplementedFunctionalityError in #subclassResponsibility
Stefan Vogel <sv@exept.de>
parents: 9203
diff changeset
  4907
     "
22557
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4908
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4909
    "Modified (format): / 27-02-2018 / 11:12:19 / stefan"
6815
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4910
!
71582d439a74 Define #shouldImplement
Stefan Vogel <sv@exept.de>
parents: 6805
diff changeset
  4911
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4912
shouldNeverBeReached
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4913
    "report an error that this point may never be reached."
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4914
14499
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4915
    <resource: #skipInDebuggersWalkBack>
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4916
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4917
    ^ ExecutionError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4918
	raiseRequestErrorString:'Oops, this may never reached. Something somewhere was terribly wrong.'.
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4919
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4920
    "Modified: / 20-04-2005 / 18:59:28 / janfrog"
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4921
!
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4922
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4923
shouldNeverBeSent
20351
1ae3d30c0149 #OTHER by mawalch
mawalch
parents: 20319
diff changeset
  4924
    "report an error that this message may never be sent to the receiver"
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4925
14499
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4926
    <resource: #skipInDebuggersWalkBack>
6ed948158d25 class: Object
Claus Gittinger <cg@exept.de>
parents: 14478
diff changeset
  4927
22557
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4928
    |sender|
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4929
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4930
    sender := thisContext sender.
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4931
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4932
    ^ MethodNotAppropriateError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4933
	    raiseRequestWith:(Message selector:sender selector arguments:sender args)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4934
	    errorString:'this message may never be sent to me'.
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4935
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4936
    "Modified: / 20-04-2005 / 18:59:28 / janfrog"
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4937
    "Modified: / 02-11-2012 / 10:10:42 / cg"
22557
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4938
    "Modified (format): / 27-02-2018 / 11:24:57 / stefan"
23390
630f605b9960 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23276
diff changeset
  4939
    "Modified: / 25-09-2018 / 17:02:30 / Claus Gittinger"
11976
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4940
!
2c8e5e4f97f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11790
diff changeset
  4941
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4942
shouldNotImplement
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4943
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4944
12841
d804b0f27fe7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12733
diff changeset
  4945
    "report an error that this message should not be implemented -
12733
48cc66ac5d52 comment/format in: #shouldNotImplement
Claus Gittinger <cg@exept.de>
parents: 12718
diff changeset
  4946
     i.e. that a method is invoked which is not appropriate for the receiver."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4947
22557
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4948
    |sender|
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4949
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4950
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4951
22557
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4952
    sender := thisContext sender.
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4953
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  4954
    ^ MethodNotAppropriateError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4955
	    raiseRequestWith:(Message selector:sender selector arguments:sender args)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  4956
	    errorString:'method/functionality is not appropriate for class'.
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4957
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  4958
    "Modified: / 02-11-2012 / 10:02:25 / cg"
22557
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4959
    "Modified (format): / 27-02-2018 / 11:25:13 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4960
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4961
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4962
subclassResponsibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4963
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4964
12321
ff74d7eab313 added: #shouldImplement:
Claus Gittinger <cg@exept.de>
parents: 12288
diff changeset
  4965
    "report an error that this message should have been reimplemented in a subclass"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4966
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4967
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4968
10877
0666d48f91d1 show the affected method-selector in the subclassResponsibility
Claus Gittinger <cg@exept.de>
parents: 10856
diff changeset
  4969
    ^ SubclassResponsibilityError raiseRequestWith:thisContext sender selector
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4970
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4971
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4972
subclassResponsibility:msg
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4973
    "{ Pragma: +optSpace }"
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4974
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4975
    "report an error that this message should have been reimplemented in a subclass"
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4976
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4977
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4978
22557
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4979
    ^ SubclassResponsibilityError raiseRequestWith:thisContext sender selector errorString:msg
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4980
2d92bc17b35d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22550
diff changeset
  4981
    "Modified: / 27-02-2018 / 11:09:32 / stefan"
6721
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4982
!
e5f47c6e2f40 #subclassResponsibility & #subclassResponsibility:
Claus Gittinger <cg@exept.de>
parents: 6718
diff changeset
  4983
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4984
subscriptBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4985
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4986
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4987
    "report an error that some index is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4988
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4989
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4990
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4991
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  4992
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4993
    ^ SubscriptOutOfBoundsSignal raiseRequestWith:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4994
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4995
    "Modified: / 26.7.1996 / 16:45:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4996
    "Modified: / 26.7.1999 / 10:58:27 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4997
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4998
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4999
subscriptBoundsError:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5000
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5001
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5002
    "report an error that anIndex is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5003
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5004
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5005
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  5006
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  5007
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5008
    ^ SubscriptOutOfBoundsError
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5009
	raiseRequestWith:anIndex
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5010
	errorString:('subscript (' , anIndex printString , ') out of bounds')
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5011
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  5012
    "Modified: / 17.11.2001 / 22:49:56 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5013
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5014
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5015
typeCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5016
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5017
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5018
    "generated when a variable declared with a type hint gets a bad
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5019
     value assigned"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5020
11021
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  5021
    <resource: #skipInDebuggersWalkBack>
05de2ecc5763 skip in debugger stuff
Claus Gittinger <cg@exept.de>
parents: 10954
diff changeset
  5022
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  5023
"/    ^ self error:'bad assign of ' , self printString ,
24390
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  5024
"/                  ' (' , self className , ') to typed variable'
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  5025
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  5026
    ^ InvalidTypeError
24390
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  5027
        raiseRequestErrorString:
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  5028
            ('bad assign of ' , self printString ,
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  5029
                  ' (' , self className , ') to typed variable')
14478
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  5030
4ff5aab56d26 more specific error reporting for type errors
Claus Gittinger <cg@exept.de>
parents: 14369
diff changeset
  5031
    "Modified: / 02-11-2012 / 10:19:15 / cg"
24390
bd4a21acf389 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 24356
diff changeset
  5032
    "Modified: / 28-06-2019 / 09:05:14 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5033
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5034
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5035
!Object methodsFor:'error handling - debugger'!
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5036
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5037
addDebuggerHook:aBlock
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5038
    "add a debugger hook. Any registered hook is evaluated with the exception as
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  5039
     argument before a real debugger is entered.
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5040
     Hooks can be used for two purposes:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5041
	- record exception information in a log file
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5042
	- filter exceptions and either decide to ignore them or to open an alternative
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5043
	  debugger (depending on the exception type, maybe)"
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5044
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5045
    DebuggerHooks isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5046
	DebuggerHooks := OrderedCollection new.
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5047
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5048
    DebuggerHooks add:aBlock
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5049
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5050
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5051
     Object addDebuggerHook:[:ex | AbortSignal raise].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5052
     (1 / (1-1)).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5053
     Object removeDebuggerHook:(DebuggerHooks first).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5054
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5055
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5056
     Object addDebuggerHook:[:ex | Transcript showCR:ex ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5057
     (1 / (1-1)).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5058
     Object removeDebuggerHook:(DebuggerHooks first).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5059
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5060
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5061
     Object addDebuggerHook:[:ex | ex suspendedContext fullPrintAllOn:Transcript ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5062
     (1 / (1-1)).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5063
     Object removeDebuggerHook:(DebuggerHooks first).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5064
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5065
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5066
     Object addDebuggerHook:[:ex | '/tmp/stx.log' asFilename
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5067
				   appendingFileDo:[:s |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5068
					s nextPutLine:'----------------------'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5069
					(Timestamp now printOn:s). s cr.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5070
					ex suspendedContext fullPrintAllOn:s
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5071
				   ]].
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5072
     (1 / (1-1)).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5073
     Object removeDebuggerHook:(DebuggerHooks first).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5074
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5075
!
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5076
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5077
appropriateDebugger:aSelector
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5078
    "return an appropriate debugger to use.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5079
     If there is already a debugger active on the stack, and it is
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5080
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5081
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5082
    "{ Pragma: +optSpace }"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5083
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5084
    |context|
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5085
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5086
    (Processor isNil
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5087
     or:[Processor activeProcessIsSystemProcess
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5088
     or:[Smalltalk isInitialized not]]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5089
	"DebugView cannot run without system processes"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5090
	^ MiniDebugger
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5091
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5092
    (Screen isNil or:[Screen default isNil or:[Screen default isOpen not]]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5093
	Debugger isNil ifTrue:[^ nil].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5094
	^ MiniDebugger
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5095
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5096
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5097
    context := thisContext.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5098
    [(context := context findNextContextWithSelector:aSelector or:nil or:nil) notNil] whileTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5099
	((context receiver class == Debugger)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5100
	 and:[context selector == aSelector]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5101
	    "we are already in some Debugger"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5102
	    (Debugger == MiniDebugger) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5103
		"we are already in the MiniDebugger"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5104
		ErrorRecursion ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5105
		    Smalltalk fatalAbort:'recursive error ...'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5106
		]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5107
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5108
	    MiniDebugger isNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5109
		Smalltalk fatalAbort:'no debugger'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5110
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5111
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5112
	    "ok, an error occurred while in the graphical debugger;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5113
	     lets try MiniDebugger"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5114
	    ^ MiniDebugger
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5115
	].
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5116
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5117
    "not within Debugger - no problem"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5118
    ^ Debugger
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5119
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5120
    "Modified: / 19-05-1999 / 18:05:00 / cg"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5121
    "Modified (format): / 15-03-2017 / 17:37:08 / stefan"
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5122
!
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5123
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5124
openDebuggerOnException:ex
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5125
    "{ Pragma: +optSpace }"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5126
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5127
    "enter the debugger on some unhandled exception"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5128
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5129
    |msgString debugger|
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5130
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5131
    msgString := ex descriptionForDebugger.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5132
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5133
    "
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  5134
     if there is no debugger, ask for ignore or exit.
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5135
     Exit will terminate the application.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5136
     ignore will raise an AbortOperationRequest.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5137
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5138
    Debugger isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5139
	msgString := 'Error: ' , msgString.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5140
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5141
	thisContext isRecursive ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5142
	    msgString errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5143
	    Smalltalk fatalAbort:'recursive unhandled exception'
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5144
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5145
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5146
	Smalltalk isStandAloneApp ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5147
	    (ex creator == NoHandlerError) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5148
		(HaltInterrupt handles:ex exception) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5149
		    "/ 'Halt ignored' infoPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5150
		    ^ nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5151
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5152
		"don't output the message, if the exception is a UserInterrupt (CTRL-C)"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5153
		(ex exception creator == UserInterrupt) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5154
		    ex description errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5155
		    OperatingSystem exit:130.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5156
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5157
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5158
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5159
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5160
	(Dialog notNil and:[Screen default notNil]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5161
	    self
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5162
		errorNotify:msgString
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5163
		from:ex suspendedContext
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5164
		allowDebug:false
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5165
		mayProceed:ex willProceed.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5166
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5167
	    "/ arrive here if proceeded...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5168
	    ^ nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5169
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5170
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5171
	"don't output the message, if the exception is a UserInterrupt (CTRL-C)"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5172
	(ex creator == NoHandlerError
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5173
	 and:[ex exception creator == UserInterrupt]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5174
	    OperatingSystem exit:130.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5175
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5176
	msgString _errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5177
	'Backtrace:' _errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5178
	'' _errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5179
	thisContext fullPrintAll.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5180
	OperatingSystem exit:1
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5181
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5182
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5183
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5184
     find an appropriate debugger to use
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5185
    "
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5186
    debugger := self appropriateDebugger:(thisContext selector).
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5187
    debugger isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5188
	^ AbortOperationRequest raiseRequest
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5189
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5190
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5191
    "/ call any registered debug hooks.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5192
    "/ These may record or further filter the exception. Each hook gets the exception object and may send any
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5193
    "/ ex-message (ex proceed, ex return etc.) or raise an Abort signal.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5194
    "/ However, the real intent for hooks is to allow saving exceptions in a log file...
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5195
    DebuggerHooks notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5196
	DebuggerHooks do:[:eachHook |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5197
	    eachHook value:ex.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5198
	].
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5199
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5200
    ^ debugger enterException:ex.
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5201
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5202
    "Modified: / 05-12-2011 / 11:53:10 / cg"
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5203
!
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5204
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5205
removeDebuggerHook:aBlock
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5206
    "remove a debugger hook."
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5207
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5208
    DebuggerHooks notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5209
	DebuggerHooks removeIdentical:aBlock.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5210
	DebuggerHooks isNil ifTrue:[ DebuggerHooks := nil ].
16311
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5211
    ].
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5212
! !
b4c21b57dfc6 class: Object
Claus Gittinger <cg@exept.de>
parents: 16291
diff changeset
  5213
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5214
!Object methodsFor:'evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5215
20061
473654cd3470 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20027
diff changeset
  5216
_evaluate_
473654cd3470 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20027
diff changeset
  5217
    "return the receiver itself.
473654cd3470 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20027
diff changeset
  5218
     - compatibility with LazyValue"
473654cd3470 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20027
diff changeset
  5219
473654cd3470 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20027
diff changeset
  5220
    ^ self
473654cd3470 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20027
diff changeset
  5221
!
473654cd3470 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20027
diff changeset
  5222
22639
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5223
asCollectionDo:aBlock
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5224
    "enumerate myself as a Collection.
22711
6b2b3dfe9836 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 22687
diff changeset
  5225
     Redefined in Collection."
22639
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5226
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5227
    ^ aBlock value:self
22711
6b2b3dfe9836 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 22687
diff changeset
  5228
6b2b3dfe9836 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 22687
diff changeset
  5229
    "Modified (comment): / 26-04-2018 / 14:20:22 / stefan"
22639
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5230
!
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5231
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5232
doIfNotNil:aBlock
23262
c0fce9983f8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23251
diff changeset
  5233
    "if I am a collection, then enumerate myself into aBlock.
c0fce9983f8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23251
diff changeset
  5234
     if I am nil, then do nothing.
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5235
     Otherwise, evaluate aBlock with myself as argument.
24624
d43c1cf3a830 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24599
diff changeset
  5236
     Return the receiver.
22711
6b2b3dfe9836 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 22687
diff changeset
  5237
     Redefined in Collection and UndefinedObject."
22639
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5238
24624
d43c1cf3a830 #QUALITY by exept
Claus Gittinger <cg@exept.de>
parents: 24599
diff changeset
  5239
    aBlock value:self
22639
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5240
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5241
    "Created: / 20-03-2018 / 15:39:37 / stefan"
22711
6b2b3dfe9836 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 22687
diff changeset
  5242
    "Modified (comment): / 26-04-2018 / 14:20:13 / stefan"
23262
c0fce9983f8f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23251
diff changeset
  5243
    "Modified (comment): / 05-08-2018 / 11:26:13 / Claus Gittinger"
22639
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5244
!
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
  5245
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5246
value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5247
    "return the receiver itself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5248
     This allows every object to be used where blocks or valueHolders
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5249
     are typically used, and allows for valueHolders and blocks to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5250
     used interchangably in some situations.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5251
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5252
     Time will show, if this is a good idea or leads to sloppy programming
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5253
     style ... (the idea was borrowed from the Self language).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5254
20807
fd862f559394 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20779
diff changeset
  5255
     WARNING: don't 'optimize' away ifXXX: blocks
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5256
	      (i.e. do NOT replace
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5257
			foo ifTrue:[var1] ifFalse:[var2]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5258
	       by:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5259
			foo ifTrue:var1 ifFalse:var2
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5260
	      )
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5261
	      - the compilers will only generate inline code for the if,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5262
		iff the argument(s) are blocks - otherwise, a true send is
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5263
		generated.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5264
	      This 'optimization' will work semantically correct,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5265
	      but execute SLOWER instead.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5266
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5267
	      Using constants (foo ifTrue:1 ifFalse:2) does not introduce a performance penalty."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5268
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5269
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5270
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5271
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5272
     #(1 2 3 4) indexOf:5 ifAbsent:0
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5273
     #(1 2 3 4) indexOf:5 ifAbsent:[0]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5274
     1 > 2 ifTrue:['yes'] ifFalse:['no']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5275
     1 > 2 ifTrue:'yes' ifFalse:'no'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5276
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5277
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5278
    "DO NOT DO THIS (its slower)
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  5279
     (1 > 4) ifTrue:a ifFalse:b
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5280
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5281
     USE (the compiler optimizes blocks in if/while):
7458
b0ca7546cbd6 CG: comment in value
Stefan Vogel <sv@exept.de>
parents: 7455
diff changeset
  5282
     (1 > 4) ifTrue:[a] ifFalse:[b]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5283
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5284
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5285
    "Modified: 3.5.1996 / 11:57:08 / cg"
20184
71a792aae4d5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20121
diff changeset
  5286
!
71a792aae4d5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20121
diff changeset
  5287
22602
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5288
valueWithOptionalArgument:arg
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5289
    "see comment in #value.
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5290
     The arg is ignored here
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5291
     (equivalent to sending this message to a 0-arg Block)"
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5292
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5293
     ^ self value
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5294
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5295
    "
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5296
	[ 'abc' ] valueWithOptionalArgument:1
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5297
	'abc' valueWithOptionalArgument:1
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5298
	'abc' asValue valueWithOptionalArgument:1
22602
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5299
    "
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5300
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5301
    "Created: / 08-03-2018 / 11:34:51 / stefan"
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5302
!
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5303
20184
71a792aae4d5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20121
diff changeset
  5304
valueWithPossibleArguments:argArray
71a792aae4d5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20121
diff changeset
  5305
    "see comment in #value.
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  5306
     The argArray is ignored here
20184
71a792aae4d5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20121
diff changeset
  5307
     (equivalent to sending this message to a 0-arg Block)"
71a792aae4d5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20121
diff changeset
  5308
22602
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5309
     ^ self value
20184
71a792aae4d5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20121
diff changeset
  5310
71a792aae4d5 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 20121
diff changeset
  5311
    "
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5312
	[ 'abc' ] valueWithPossibleArguments:#(1 2 3)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5313
	'abc' valueWithPossibleArguments:#(1 2 3)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5314
	'abc' asValue valueWithPossibleArguments:#(1 2 3)
22602
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5315
    "
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5316
720e9d06bab7 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22557
diff changeset
  5317
    "Modified: / 08-03-2018 / 11:55:05 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5318
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5319
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5320
!Object methodsFor:'finalization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5321
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5322
disposed
22549
e899d82b6215 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22540
diff changeset
  5323
    "OBSOLETE INTERFACE: please redefine #finalize instead.
e899d82b6215 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22540
diff changeset
  5324
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5325
     this is invoked for objects which have been registered
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5326
     in a Registry, when the original object dies.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5327
     Subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5328
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5329
    <resource: #obsolete>
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5330
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5331
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5332
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5333
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5334
executor
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5335
    "Return the object which does the finalization for me.
21810
b66021c7e3b1 #OTHER by mawalch
mawalch
parents: 21666
diff changeset
  5336
     This interface is also VW & Squeak compatible,"
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5337
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5338
    "for now, send #shallowCopyForFinalization, to be compatible with
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5339
     classes designed for old ST/X versions"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5340
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5341
    ^ self shallowCopyForFinalization
21810
b66021c7e3b1 #OTHER by mawalch
mawalch
parents: 21666
diff changeset
  5342
b66021c7e3b1 #OTHER by mawalch
mawalch
parents: 21666
diff changeset
  5343
    "Modified (comment): / 15-06-2017 / 01:46:54 / mawalch"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5344
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5345
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5346
finalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5347
    "answer a Registry used for finalization.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5348
     Use a generic Registry for any object.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5349
     Subclasses using their own Registry should redefine this"
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5350
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5351
    ^ FinalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5352
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5353
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5354
finalize
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5355
    "this is invoked for executor objects which have been registered
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5356
     in a Registry, when the original object dies.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5357
     Subclasses may redefine this method
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5358
     This interface is also VW-compatible"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5359
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5360
    "send #disposed for compatibility with existing classes that still
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5361
     implement the obsolete #disposed message"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5362
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  5363
    ^ self disposed
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5364
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5365
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5366
reRegisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5367
    "re-register mySelf for later finalization.
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5368
     This will create a new executor, which will receive a #finalize message when
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5369
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5370
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5371
    self finalizationLobby registerChange:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5372
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5373
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5374
registerForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5375
    "register mySelf for later finalization.
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5376
     Once registered, the executor of the receiver will receive a #finalize message when
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5377
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5378
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5379
    self finalizationLobby register:self
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5380
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5381
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5382
shallowCopyForFinalization
22550
35e87af3c989 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22549
diff changeset
  5383
    "OBSOLETE INTERFACE: please redefine #executor instead.
20121
08e27f11a8c9 #OTHER by mawalch
mawalch
parents: 20061
diff changeset
  5384
     This is used to acquire a copy to be used for finalization -
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5385
     (the copy will be sent a #finalize message; see the documentation in the Registry class)
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5386
     This method can be redefined for more efficient copying - especially for large objects."
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5387
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5388
    <resource: #obsolete>
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5389
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5390
    ^ self shallowCopy
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5391
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5392
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5393
unregisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5394
    "unregister mySelf from later finalization"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5395
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  5396
    self finalizationLobby unregister:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5397
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5398
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5399
!Object methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5400
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5401
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5402
    "just to ignore initialize to objects which do not need it"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5403
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5404
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5405
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5406
20317
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5407
!Object methodsFor:'inspecting'!
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5408
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5409
inspectorExtraMenuOperations
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5410
    "extra operation-menu entries to be shown in an inspector.
20319
f89e5761fc88 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20318
diff changeset
  5411
     Answers a collection of pairs contining aString and action aBlock.
20317
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5412
     aString is the label of the menu item.
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5413
     aBlock is evaluated when the menu item is selected.
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5414
     To be redefined in objects which think that it makes sense to offer
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5415
     often used operations in an inspector.
20318
02c60c6bb541 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20317
diff changeset
  5416
     See SerialPort as an example."
20317
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5417
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5418
    ^ OrderedCollection new.
a7438ad8a1fe #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20303
diff changeset
  5419
! !
17677
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  5420
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5421
!Object methodsFor:'interrupt handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5422
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5423
childSignalInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5424
    "death of a child process (unix process) - do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5425
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5426
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5427
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5428
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5429
customInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5430
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5431
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5432
    "a custom interrupt - but no handler has defined"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5433
23018
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5434
    self proceedableError:'custom interrupt'
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5435
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5436
    "Modified: / 24-05-2018 / 21:02:28 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5437
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5438
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5439
errorInterrupt:errorID with:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5440
    "subsystem error. The arguments errorID and aParameter are the values passed
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5441
     to the 'errorInterruptWithIDAndParameter(id, param)' function,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5442
     which can be called from C subsystems to raise an (asynchronous)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5443
     error exception.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5444
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5445
     Currently, this is used to map XErrors to smalltalk errors, but can be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5446
     used from other C subsystems too, to upcast errors.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5447
     Especially, for subsystems which call errorHandler functions asynchronously.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5448
     IDs (currently) used:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5449
	#DisplayError ..... x-error interrupt
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5450
	#XtError      ..... xt-error interrupt (Xt interface is not yet published)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5451
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5452
6263
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  5453
    |handlers handler|
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  5454
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  5455
    handlers := ObjectMemory registeredErrorInterruptHandlers.
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  5456
    handlers notNil ifTrue:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5457
	handler := handlers at:errorID ifAbsent:nil.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5458
	handler notNil ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5459
	    "/
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5460
	    "/ handler found; let it do whatever it wants ...
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5461
	    "/
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5462
	    handler errorInterrupt:errorID with:aParameter.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5463
	    ^ self
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5464
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5465
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5466
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5467
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5468
    "/ no handler - raise errorSignal passing the errorId as parameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5469
    "/
23661
d1f55e676ed5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23659
diff changeset
  5470
    ^ ProceedableError
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5471
	raiseRequestWith:errorID
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5472
	errorString:('Subsystem error. ErrorID = ' , errorID printString)
23661
d1f55e676ed5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23659
diff changeset
  5473
d1f55e676ed5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 23659
diff changeset
  5474
    "Modified: / 04-02-2019 / 15:23:19 / Stefan Vogel"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5475
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5476
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5477
exceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5478
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5479
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5480
    "exception interrupt - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5481
23018
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5482
    self proceedableError:'exception Interrupt'
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5483
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5484
    "Modified: / 24-05-2018 / 21:02:43 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5485
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5486
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5487
fpExceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5488
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5489
20253
da66d4066959 #OTHER by mawalch
mawalch
parents: 20222
diff changeset
  5490
    "a floating point exception occurred - this one
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5491
     has to be handled differently since it comes asynchronous
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5492
     on some machines (for example, on machines with a separate FPU
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5493
     or superscalar architectures. Also, errors from within primitive code
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5494
     (or library functions such as GL) are sent via the Unix-signal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5495
     mechanism this way."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5497
    |where rec|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5498
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5499
    where := thisContext sender.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5500
    rec := where receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5501
    rec isNumber ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5502
	^ rec class
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5503
	    raise:#domainErrorSignal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5504
	    receiver:rec
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5505
	    selector:where selector
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5506
	    arguments:(where args asArray)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5507
	    errorString:'floating point exception'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5508
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5509
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5510
    "/ could be in some C-library ...
7402
b9d45ce2463a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7359
diff changeset
  5511
    ^ DomainError raise
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5512
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5513
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5514
internalError:msg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5515
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5516
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5517
    "this is triggered, when VM hits some bad error,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5518
     such as corrupted class, corrupted method/selector array
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5519
     etc. The argument string gives some more information on what happened.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5520
     (for example, if you set an objects class to a non-behavior, nil etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5521
     Its not guaranteed, that the system is in a working condition once
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5522
     this error occurred ...."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5523
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  5524
    VMInternalError raiseWith:self errorString:msg
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5525
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5526
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5527
ioInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5528
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5529
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5530
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5531
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5532
     or it does not understand the ioInterrupt message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5533
     In any case, this is a sign of some big trouble. Enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5534
23018
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5535
    self proceedableError:'I/O Interrupt - but no handler'
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5536
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5537
    "Modified: / 24-05-2018 / 21:02:52 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5538
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5539
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5540
memoryInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5541
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5542
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5543
    "out-of-memory interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5544
23018
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5545
    self proceedableError:'almost out of memory'
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5546
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5547
    "Modified: / 24-05-2018 / 21:02:58 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5548
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5549
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5550
recursionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5551
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5552
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5553
    "recursion limit (actually: stack overflow) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5554
     This interrupt is triggered, when a process stack grows above
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5555
     its stackLimit - usually, this leads into the debugger, but
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5556
     could be caught.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5557
     Under Unix, the stackLimit may be increased in the handler,
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5558
     and the exception can be resumed.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5559
     Sorry, but under win32, the stack cannot grow, and the exception
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5560
     is not proceedable.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5561
     At the time we arrive here, the system has still some stack
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5562
     as a reserve so we can continue to do some useful work, or cleanup,
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5563
     or debug for a while.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5564
     If the signal is ignored, and the stack continues to grow, there
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5565
     will be a few more chances (and more interrupts) before the VM
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  5566
     terminates the process."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5567
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5568
    |con remaining sender nSkipped caller level|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5569
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5570
    (con := thisContext) isRecursive ifFalse:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5571
"/        Processor activeProcess usedStackSize < Processor activeProcess maximumStackSize ifTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5572
"/            "/ mhmh - it hit me, but I am not responsible ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5573
"/            'Stray recursionInterrupt ...' infoPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5574
"/            ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5575
"/        ].
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5576
	ObjectMemory infoPrinting ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5577
	    level := 0.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5578
	    caller := con sender.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5579
	    [caller notNil] whileTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5580
		level := level + 1.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5581
		caller := caller sender.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5582
	    ].
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5583
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5584
	    'Object [info]: recursionInterrupt ( from:' _errorPrint.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5585
	    level _errorPrint. ') from:' _errorPrintCR.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5586
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5587
	    con := con sender.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5588
	    remaining := 500.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5589
	    [con notNil and:[remaining > 0]] whileTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5590
		sender := con sender.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5591
		RecursionInterruptSignal handle:[:ex |
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5592
		] do:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5593
		    '| ' _errorPrint. con savePrint.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5594
		].
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5595
		nSkipped := 0.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5596
		[sender notNil and:[sender sender notNil
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5597
		and:[sender selector == con selector
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5598
		and:[sender sender selector == con selector
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5599
		and:[sender method == con method]]]]] whileTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5600
		    nSkipped := nSkipped + 1.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5601
		    con := sender.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5602
		    sender := con sender.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5603
		].
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5604
		nSkipped > 0 ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5605
		    '| ... ***** ' _errorPrint. nSkipped _errorPrint. ' recursive contexts skipped *****' _errorPrintCR.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5606
		].
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5607
		con := sender.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5608
		remaining := remaining - 1
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5609
	    ].
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5610
	].
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  5611
	^ RecursionInterruptSignal raiseSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5612
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5613
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5614
    "Modified: / 10-11-2001 / 15:15:56 / cg"
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  5615
    "Modified: / 15-03-2017 / 17:26:56 / stefan"
23757
0a92ba4c8db2 #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 23753
diff changeset
  5616
    "Modified: / 20-02-2019 / 14:22:11 / Stefan Vogel"
24258
1c723f4dbc1a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24221
diff changeset
  5617
    "Modified: / 05-06-2019 / 20:27:31 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5618
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5619
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5620
schedulerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5621
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5622
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5623
    "scheduler interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5624
     If we arrive here, either the Processor does not understand it,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5625
     or it has been set to nil. In any case, this is a sign of some
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5626
     big trouble. Enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5627
23018
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5628
    self proceedableError:'schedulerInterrupt - but no Processor'
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5629
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5630
    "Modified: / 24-05-2018 / 21:03:28 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5631
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5632
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5633
signalInterrupt:signalNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5634
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5635
20253
da66d4066959 #OTHER by mawalch
mawalch
parents: 20222
diff changeset
  5636
    "unix signal occurred - some signals are handled as Smalltalk Exceptions
10016
e174cf2d1f43 crash save refactored
Claus Gittinger <cg@exept.de>
parents: 9993
diff changeset
  5637
     (SIGPIPE), others (SIGBUS) are rather fatal...
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  5638
     In any case, IF a smalltalk-signal has been connected to the OS signal, that one is raised.
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
  5639
     Otherwise, a dialog is shown, asking the user on how to handle the signal.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5640
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5641
     exact cause etc.). This helps if segvs occur in primitive code.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5642
     Currently (temporary kludge), these are passed as global variables."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5643
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  5644
    |name here sig fatal titles actions badContext msg pc addr
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5645
     action title screen|
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5646
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5647
     (signalNumber == OperatingSystem sigPWR
22540
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5648
      or:[signalNumber == OperatingSystem sigHUP]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5649
	self signalInterruptWithCrashImage:signalNumber.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5650
	^ self.
22540
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5651
    ].
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5652
13254
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  5653
    thisContext isRecursive ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5654
	'Severe error: signalInterrupt while processing a signalInterrupt.' _errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5655
	'Terminating process ' _errorPrint. Processor activeProcess _errorPrintCR.
13710
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5656
"/        GenericException handle:[:ex |
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5657
"/            "/ ignore any error during termination
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5658
"/        ] do:[
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5659
"/           Processor activeProcess terminate.
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5660
"/        ].
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5661
	MiniDebugger enter.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5662
	Processor activeProcess terminateNoSignal.
13254
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  5663
    ].
5cf789a74946 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13229
diff changeset
  5664
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5665
    "if there has been an ST-signal installed, use it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5666
    sig := OperatingSystem operatingSystemSignal:signalNumber.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5667
    sig notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5668
	sig raiseSignalWith:signalNumber.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5669
	^ self.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5670
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5671
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5672
    "/ if handled, raise OSSignalInterruptSignal
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
  5673
    OSSignalInterrupt isHandled ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5674
	OSSignalInterrupt raiseRequestWith:signalNumber.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5675
	^ self.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5676
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5677
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5678
    name := OperatingSystem nameForSignal:signalNumber.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5679
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5680
    "if there is no screen at all, bring up a mini debugger"
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5681
    (Screen isNil
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5682
     or:[(screen := Screen current) isNil
6778
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5683
     or:[(screen := Screen default) isNil
87e2d95ce8a4 Raise #drawingOnClosedDeviceSignal instead of #error
Stefan Vogel <sv@exept.de>
parents: 6764
diff changeset
  5684
     or:[screen isOpen not]]]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5685
	^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5686
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5687
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5688
    "ungrab - in case it happened in a box/popupview
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5689
     otherwise display stays locked"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5690
    screen ungrabPointer; ungrabKeyboard.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5691
7031
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5692
    here := thisContext.
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5693
    badContext := here sender.          "the context, in which the signal occurred"
eae2df0a3ad2 Exit Smalltalk in SIGHUP
Stefan Vogel <sv@exept.de>
parents: 6964
diff changeset
  5694
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5695
    "there is a screen. use it to bring up a box asking for what to do ..."
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5696
    Screen currentScreenQuerySignal answer:screen do:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5697
	"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5698
	 SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5699
	 since the system will retry the faulty instruction, which leads to
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5700
	 another signal - to avoid frustration, better not offer this option.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5701
	"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5702
	fatal := OperatingSystem isFatalSignal:signalNumber.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5703
	fatal ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5704
	    (Debugger isNil or:[here isRecursive]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5705
		'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5706
		^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5707
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5708
	    "
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5709
	     a hard signal - go into debugger immediately
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5710
	    "
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5711
	    msg := 'OS-signal: ', name.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5712
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5713
	    "/ the IRQ-PC is passed as low-hi, to avoid the need
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5714
	    "/ to allocate a LargeInteger in the VM during signal
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5715
	    "/ time. I know, this is ugly.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5716
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5717
	    InterruptPcLow notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5718
		pc := InterruptPcLow + (InterruptPcHi bitShift:((SmallInteger maxBits + 1) // 2)).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5719
		pc ~~ 0 ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5720
		    msg := msg , ' PC=' , (pc printStringRadix:16)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5721
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5722
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5723
	    InterruptAddrLow notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5724
		addr := InterruptAddrLow + (InterruptAddrHi bitShift:((SmallInteger maxBits + 1) // 2)).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5725
		addr ~~ 0 ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5726
		    msg := msg , ' ADDR=' , (addr printStringRadix:16)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5727
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5728
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5729
	    Debugger enter:here withMessage:msg mayProceed:false.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5730
	    "unreachable"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5731
	    ^ nil.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5732
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5733
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5734
	"if possible, open an option box asking the user what do.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5735
	 Otherwise, start a debugger"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5736
	Dialog notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5737
	    OperatingSystem isOSXlike ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5738
		titles := #('Save crash image' 'Dump core' 'GDB' 'Exit ST/X' 'Debug').
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5739
		actions := #(save core gdb exit debug).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5740
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5741
		titles := #('Save crash image' 'Dump core' 'Exit ST/X' 'Debug').
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5742
		actions := #(save core exit debug).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5743
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5744
	    action := nil.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5745
	    title := 'OS Signal caught (' , name, ')'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5746
	    title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5747
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5748
	    "/ if caught while in the scheduler or event dispatcher,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5749
	    "/ a modal dialog is not possible ...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5750
	    "/ (therefore, abort & return does not makes sense)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5751
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5752
	    Processor activeProcess isSystemProcess ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5753
		titles := #('Abort') , titles.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5754
		actions := #(abort), actions.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5755
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5756
		badContext canReturn ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5757
		    titles := #('Return') , titles.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5758
		    actions :=  #(return), actions.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5759
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5760
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5761
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5762
	    fatal ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5763
		titles := titles, #('Ignore').
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5764
		actions := actions , #(ignore).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5765
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5766
	    action := Dialog choose:title
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5767
			     labels:titles
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5768
			     values:actions
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5769
			     default:(fatal ifTrue:[nil] ifFalse:[#ignore]).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5770
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5771
	    "Dialog may fail (if system process), default action is debug"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5772
	    action isEmptyOrNil ifTrue:[action := #debug].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5773
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5774
	    action := #debug.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5775
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5776
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5777
	action == #save ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5778
	    ObjectMemory writeCrashImage
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5779
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5780
	action == #gdb ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5781
	    OperatingSystem openTerminalWithCommand:('gdb -p %1' bindWith:OperatingSystem getProcessId) inBackground:true.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5782
	    MiniDebugger enter. "/ to stop, so gdb can show where we are
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5783
	    AbortOperationRequest raise.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5784
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5785
	action == #core ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5786
	    Smalltalk fatalAbort
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5787
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5788
	action == #exit ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5789
	    Smalltalk exit:10.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5790
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5791
	action == #return ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5792
	    badContext return
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5793
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5794
	action == #abort ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5795
	    AbortOperationRequest raise.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5796
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5797
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5798
	action == #debug ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5799
	    Debugger isNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5800
		^ self startMiniDebuggerOrExit:'OS-Signal (' , name, ')'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5801
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5802
	    Debugger enter:here withMessage:('OS-Signal ', name) mayProceed:true.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5803
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5804
	"action == #ignore"
13261
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5805
    ].
Claus Gittinger <cg@exept.de>
parents: 13258
diff changeset
  5806
13710
277f3a5697e8 changed: #signalInterrupt:
Claus Gittinger <cg@exept.de>
parents: 13656
diff changeset
  5807
    "Modified: / 15-09-2011 / 16:38:14 / cg"
22540
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5808
    "Modified: / 09-02-2018 / 18:06:16 / stefan"
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5809
!
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5810
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5811
signalInterruptWithCrashImage:signalNumber
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5812
    "
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5813
     special cases
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5814
	- SIGPWR: power failure - write a crash image and continue
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5815
	- SIGHUP: hang up - write a crash image and exit
22540
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5816
    "
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5817
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5818
    thisContext isRecursive ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5819
	"got another signal while writing crash just continue"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5820
	^ self.
22540
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5821
    ].
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5822
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5823
    (signalNumber == OperatingSystem sigPWR) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5824
	SnapshotError catch:[ObjectMemory writeCrashImage].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5825
	^ self.
22540
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5826
    ].
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5827
    (signalNumber == OperatingSystem sigHUP) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5828
	'Smalltalk [info]: got hangup signal from OS: writing crash.img.' _errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5829
	SnapshotError catch:[ObjectMemory writeCrashImage].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5830
	'Smalltalk [info]: exit due to hangup signal from OS.' _errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5831
	Smalltalk exit:1.
22540
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5832
    ].
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5833
afb476a2a3d9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22535
diff changeset
  5834
    "Created: / 09-02-2018 / 18:05:46 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5835
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5836
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5837
spyInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5838
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5839
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5840
    "spy interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5841
23018
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5842
    self proceedableError:'spy Interrupt - but no handler'
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5843
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5844
    "Modified: / 24-05-2018 / 21:03:35 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5845
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5846
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5847
startMiniDebuggerOrExit:text
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5848
    "some critical condition happened.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5849
     Start a mini debugger or exit if none is present"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5850
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5851
    MiniDebugger isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5852
	"a system without debugging facilities (i.e. a standalone system)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5853
	 output a message and exit."
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5854
	('Object [error]: exit due to ', text, ' - and no debugger.') errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5855
	OperatingSystem exit:99.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5856
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5857
    MiniDebugger enterWithMessage:text mayProceed:true.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5858
!
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  5859
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5860
timerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5861
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5862
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5863
    "timer interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5864
23018
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5865
    self proceedableError:'timer Interrupt - but no handler'
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5866
b9676c52f715 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22998
diff changeset
  5867
    "Modified: / 24-05-2018 / 21:03:41 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5868
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5869
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5870
userInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5871
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5872
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5873
    "user (^c) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5874
     This is typically sent by the VM, when a ctrl-C is typed at the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5875
     controlling tty (i.e. in the xterm)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5876
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5877
    UserInterrupt raiseRequest
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5878
!
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5879
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5880
userInterruptIn:aContext from:originator
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5881
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5882
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5883
    "user (^c) interrupt - enter debugger, but show aContext
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5884
     as top-context.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5885
     This is used to hide any intermediate scheduler contexts,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5886
     in case of an interrupted process. Typically, this is sent by
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5887
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5888
     processed.
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  5889
     Set the originator to distinguish UserInterrupts from controlling tty vs.
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5890
     UserInterrupt from a view."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5891
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5892
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5893
20027
5be764ee44fb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 19846
diff changeset
  5894
    UserInterrupt raiseRequestWith:originator errorString:nil in:aContext
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5895
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5896
    "Created: / 18.10.1996 / 20:46:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5897
    "Modified: / 20.10.1996 / 13:06:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5898
    "Modified: / 26.7.1999 / 10:58:49 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5899
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5900
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5901
!Object methodsFor:'message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5902
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5903
perform:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5904
    "send the message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5905
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  5906
    <resource: #skipInDebuggersWalkBack>
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  5907
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5908
%{
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  5909
#ifdef __SCHTEAM__
18238
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  5910
    return context.PERFORM(self, aSelector);
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5911
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5912
    REGISTER OBJ sel = aSelector;
16588
eb24b473a3ba Fix for bug in Object>>perform(with:(with:)) - care for nil or SmallInteger selectors.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16583
diff changeset
  5913
    int hash0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5914
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5915
    if (InterruptPending == nil) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5916
	struct inlineCache *pIlc;
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5917
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5918
# define nways 2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5919
# define nilcs 131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5920
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5921
# define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF0(l) , __ILCPERF0(l) } , 0 }
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5922
# define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5923
# define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5924
# define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5925
# define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5926
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5927
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5928
# define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5929
# define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5930
# define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5931
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5932
# define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5933
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5934
	static struct { OBJ sel[nways]; struct inlineCache ilc[nways]; int flip; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_131(@line) };
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5935
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5936
# undef SEL_AND_ILC_INIT_1
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5937
# undef SEL_AND_ILC_INIT_2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5938
# undef SEL_AND_ILC_INIT_4
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5939
# undef SEL_AND_ILC_INIT_8
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5940
# undef SEL_AND_ILC_INIT_16
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5941
# undef SEL_AND_ILC_INIT_32
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5942
# undef SEL_AND_ILC_INIT_64
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5943
# undef SEL_AND_ILC_INIT_128
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5944
# undef SEL_AND_ILC_INIT_256
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5945
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5946
# undef SEL_AND_ILC_INIT_131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5947
# undef SEL_AND_ILC_INIT_257
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5948
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5949
# define TRY(n)                                  \
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5950
	if (sel == sel_and_ilc[hash0].sel[n]) { \
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5951
	    pIlc = &sel_and_ilc[hash0].ilc[n];  \
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5952
	    goto perform0_send_and_return;      \
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5953
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5954
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5955
	if (__isNonNilObject(sel)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5956
	    hash0 = __MAKE_HASH__(__GET_HASH(sel)) % nilcs;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5957
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5958
	    /* sel is either nil or smallint, use its value as hash */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5959
	    hash0 = (INT)sel % nilcs;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5960
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5961
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5962
	TRY(0);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5963
	TRY(1);
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  5964
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  5965
# undef TRY
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5966
	/*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5967
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5968
	pIlc = &sel_and_ilc[hash0].ilc[sel_and_ilc[hash0].flip];
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5969
	sel_and_ilc[hash0].sel[sel_and_ilc[hash0].flip] = sel;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5970
	sel_and_ilc[hash0].flip = (sel_and_ilc[hash0].flip + 1) % nways;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5971
	pIlc->ilc_func = __SEND0ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5972
	if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5973
	    __flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5974
	    pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5975
	}
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  5976
perform0_send_and_return:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5977
	RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5978
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5979
	static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5980
	RETURN (_SEND0(self, aSelector, nil, &ilc0));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5981
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  5982
#endif /* not __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5983
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5984
    ^ self perform:aSelector withArguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5985
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5986
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5987
perform:aSelector inClass:aClass withArguments:argArray
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5988
    "send the message aSelector with all args taken from argArray
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5989
     to the receiver as a super-send message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5990
     This is actually more flexible than the normal super-send, since it allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5991
     to execute a method in ANY superclass of the receiver (not just the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5992
     immediate superclass).
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  5993
     Thus, it is (theoretically) possible to do
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  5994
	 '5 perform:#< inClass:Magnitude withArguments:#(6)'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5995
     and evaluate Magnitudes compare method even if there was one in Number.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5996
     This method is used by the interpreter to evaluate super sends
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5997
     and could be used for very special behavior (language extension ?).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5998
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5999
     WARNING: this is an ST/X feature - probably not found in other smalltalks."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6000
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  6001
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 myClass|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6002
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6003
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6004
     check, if aClass is really a superclass of the receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6005
    "
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  6006
    myClass := self class.
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  6007
    (myClass == aClass or:[myClass isSubclassOf:aClass]) ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6008
	self error:'lookup-class argument is not a superclass of the receiver'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6009
	^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6010
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6011
%{
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  6012
#ifdef __SCHTEAM__
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6013
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6014
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6015
    int nargs, i;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6016
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  6017
    if (__isArrayLike(argArray)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6018
	nargs = __arraySize(argArray);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6019
	argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6020
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6021
	if (__isNonNilObject(argArray)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6022
	    static struct inlineCache ilcSize = __ILC0(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6023
	    numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6024
	    if (!__isSmallInteger(numberOfArgs))
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6025
		goto bad;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6026
	    nargs = __intVal(numberOfArgs);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6027
	    argP = (OBJ *)(&a1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6028
	    for (i=1; i <= nargs; i++) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6029
		*argP++ = __AT_(argArray, __mkSmallInteger(i));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6030
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6031
	    argP = (OBJ *)(&a1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6032
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6033
	    nargs = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6034
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6035
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6036
    switch (nargs) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6037
	case 0:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6038
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6039
		static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6040
		RETURN ( _SEND0(self, aSelector, aClass, &ilc0));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6041
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6042
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6043
	case 1:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6044
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6045
		static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6046
		RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6047
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6048
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6049
	case 2:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6050
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6051
		static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6052
		RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6053
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6054
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6055
	case 3:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6056
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6057
		static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6058
		RETURN ( _SEND3(self, aSelector, aClass, &ilc3,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6059
				argP[0], argP[1], argP[2]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6060
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6061
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6062
	case 4:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6063
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6064
		static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6065
		RETURN ( _SEND4(self, aSelector, aClass, &ilc4,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6066
				argP[0], argP[1], argP[2], argP[3]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6067
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6068
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6069
	case 5:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6070
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6071
		static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6072
		RETURN ( _SEND5(self, aSelector, aClass, &ilc5,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6073
				argP[0], argP[1], argP[2], argP[3], argP[4]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6074
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6075
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6076
	case 6:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6077
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6078
		static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6079
		RETURN ( _SEND6(self, aSelector, aClass, &ilc6,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6080
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6081
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6082
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6083
	case 7:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6084
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6085
		static struct inlineCache ilc7 = __DUMMYILCSELF7(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6086
		RETURN ( _SEND7(self, aSelector, aClass, &ilc7,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6087
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6088
				argP[6]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6089
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6090
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6091
	case 8:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6092
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6093
		static struct inlineCache ilc8 = __DUMMYILCSELF8(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6094
		RETURN ( _SEND8(self, aSelector, aClass, &ilc8,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6095
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6096
				argP[6], argP[7]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6097
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6098
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6099
	case 9:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6100
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6101
		static struct inlineCache ilc9 = __DUMMYILCSELF9(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6102
		RETURN ( _SEND9(self, aSelector, aClass, &ilc9,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6103
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6104
				argP[6], argP[7], argP[8]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6105
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6106
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6107
	case 10:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6108
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6109
		static struct inlineCache ilc10 = __DUMMYILCSELF10(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6110
		RETURN ( _SEND10(self, aSelector, aClass, &ilc10,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6111
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6112
				 argP[6], argP[7], argP[8], argP[9]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6113
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6114
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6115
	case 11:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6116
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6117
		static struct inlineCache ilc11 = __DUMMYILCSELF11(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6118
		RETURN ( _SEND11(self, aSelector, aClass, &ilc11,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6119
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6120
				 argP[6], argP[7], argP[8], argP[9], argP[10]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6121
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6122
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6123
	case 12:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6124
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6125
		static struct inlineCache ilc12 = __DUMMYILCSELF12(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6126
		RETURN ( _SEND12(self, aSelector, aClass, &ilc12,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6127
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6128
				 argP[6], argP[7], argP[8], argP[9], argP[10],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6129
				 argP[11]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6130
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6131
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6132
	case 13:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6133
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6134
		static struct inlineCache ilc13 = __DUMMYILCSELF13(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6135
		RETURN ( _SEND13(self, aSelector, aClass, &ilc13,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6136
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6137
				 argP[6], argP[7], argP[8], argP[9], argP[10],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6138
				 argP[11], argP[12]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6139
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6140
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6141
	case 14:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6142
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6143
		static struct inlineCache ilc14 = __DUMMYILCSELF14(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6144
		RETURN ( _SEND14(self, aSelector, aClass, &ilc14,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6145
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6146
				 argP[6], argP[7], argP[8], argP[9], argP[10],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6147
				 argP[11], argP[12], argP[13]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6148
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6149
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6150
	case 15:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6151
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6152
		static struct inlineCache ilc15 = __DUMMYILCSELF15(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6153
		RETURN ( _SEND15(self, aSelector, aClass, &ilc15,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6154
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6155
				 argP[6], argP[7], argP[8], argP[9], argP[10],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6156
				 argP[11], argP[12], argP[13], argP[14]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6157
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6158
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6159
# ifdef _SEND16
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6160
	case 16:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6161
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6162
		static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6163
		RETURN ( _SEND16(self, aSelector, aClass, &ilc15,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6164
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6165
				 argP[6], argP[7], argP[8], argP[9], argP[10],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6166
				 argP[11], argP[12], argP[13], argP[14], argP[15]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6167
	    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6168
# endif
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6169
# ifdef _SEND17
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6170
	case 17:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6171
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6172
		static struct inlineCache ilc17 = __DUMMYILCSELF17(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6173
		RETURN ( _SEND17(self, aSelector, aClass, &ilc15,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6174
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6175
				 argP[6], argP[7], argP[8], argP[9], argP[10],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6176
				 argP[11], argP[12], argP[13], argP[14], argP[15], argP[16]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6177
	    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6178
# endif
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6179
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6180
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6181
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6182
bad:;
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  6183
#endif /* not __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6184
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6185
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6186
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6187
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6188
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6189
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6190
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6191
perform:aSelector with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6192
    "send the one-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6193
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6194
%{
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  6195
#ifdef __SCHTEAM__
18238
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  6196
    return context.PERFORM_WITH(self, aSelector, arg);
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6197
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6198
    REGISTER OBJ sel = aSelector;
16588
eb24b473a3ba Fix for bug in Object>>perform(with:(with:)) - care for nil or SmallInteger selectors.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16583
diff changeset
  6199
    int hash0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6200
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6201
    if (InterruptPending == nil) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6202
	struct inlineCache *pIlc;
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6203
# undef nways
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6204
# define nways 2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6205
# undef nilcs
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6206
# define nilcs 131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6207
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6208
# define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF1(l) , __ILCPERF1(l)  } , 0 }
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6209
# define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6210
# define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6211
# define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6212
# define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6213
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6214
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6215
# define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6216
# define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6217
# define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6218
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6219
# define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  6220
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6221
	static struct { OBJ sel[nways]; struct inlineCache ilc[nways]; int flip; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_131(@line) };
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  6222
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6223
# undef SEL_AND_ILC_INIT_1
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6224
# undef SEL_AND_ILC_INIT_2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6225
# undef SEL_AND_ILC_INIT_4
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6226
# undef SEL_AND_ILC_INIT_8
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6227
# undef SEL_AND_ILC_INIT_16
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6228
# undef SEL_AND_ILC_INIT_32
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6229
# undef SEL_AND_ILC_INIT_64
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6230
# undef SEL_AND_ILC_INIT_128
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6231
# undef SEL_AND_ILC_INIT_256
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6232
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6233
# undef SEL_AND_ILC_INIT_131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6234
# undef SEL_AND_ILC_INIT_257
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6235
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6236
# define TRY(n)                                  \
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6237
	if (sel == sel_and_ilc[hash0].sel[n]) { \
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6238
	    pIlc = &sel_and_ilc[hash0].ilc[n];  \
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6239
	    goto perform1_send_and_return;      \
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6240
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6241
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6242
	if (__isNonNilObject(sel)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6243
	    hash0 = __MAKE_HASH__(__GET_HASH(sel)) % nilcs;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6244
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6245
	    /* sel is either nil or smallint, use its value as hash */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6246
	    hash0 = (INT)sel % nilcs;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6247
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6248
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6249
	TRY(0);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6250
	TRY(1);
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  6251
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6252
# undef TRY
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6253
	/*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6254
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6255
	pIlc = &sel_and_ilc[hash0].ilc[sel_and_ilc[hash0].flip];
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6256
	sel_and_ilc[hash0].sel[sel_and_ilc[hash0].flip] = sel;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6257
	sel_and_ilc[hash0].flip = (sel_and_ilc[hash0].flip + 1) % nways;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6258
	pIlc->ilc_func = __SEND1ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6259
	if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6260
	    __flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6261
	    pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6262
	}
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  6263
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  6264
perform1_send_and_return:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6265
	RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6266
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6267
	static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6268
	RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6269
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  6270
#endif /* not __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6271
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6272
    ^ self perform:aSelector withArguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6273
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6275
perform:aSelector with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6276
    "send the two-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6277
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6278
%{
18263
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  6279
#ifdef __SCHTEAM__
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  6280
    return context.PERFORM_WITH2(self, aSelector, arg1, arg2);
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  6281
#else
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  6282
    REGISTER OBJ sel = aSelector;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6283
    struct inlineCache *pIlc;
16588
eb24b473a3ba Fix for bug in Object>>perform(with:(with:)) - care for nil or SmallInteger selectors.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16583
diff changeset
  6284
    int hash0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6285
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6286
    if (InterruptPending == nil) {
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6287
# undef nways
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6288
# define nways 2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6289
# undef nilcs
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6290
# define nilcs 131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6291
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6292
# define SEL_AND_ILC_INIT_1(l)   { { nil, nil } , { __ILCPERF2(l) , __ILCPERF2(l) } , 0 }
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6293
# define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6294
# define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6295
# define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6296
# define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6297
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6298
# define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6299
# define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6300
# define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6301
# define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6302
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6303
# define SEL_AND_ILC_INIT_131(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_2(l) , SEL_AND_ILC_INIT_1(l)
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  6304
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6305
	static struct { OBJ sel[nways]; struct inlineCache ilc[nways]; int flip; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_131(@line) };
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  6306
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6307
# undef SEL_AND_ILC_INIT_1
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6308
# undef SEL_AND_ILC_INIT_2
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6309
# undef SEL_AND_ILC_INIT_4
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6310
# undef SEL_AND_ILC_INIT_8
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6311
# undef SEL_AND_ILC_INIT_16
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6312
# undef SEL_AND_ILC_INIT_32
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6313
# undef SEL_AND_ILC_INIT_64
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6314
# undef SEL_AND_ILC_INIT_128
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6315
# undef SEL_AND_ILC_INIT_256
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6316
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6317
# undef SEL_AND_ILC_INIT_131
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6318
# undef SEL_AND_ILC_INIT_257
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6319
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6320
# define TRY(n)                                  \
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6321
	if (sel == sel_and_ilc[hash0].sel[n]) { \
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6322
	    pIlc = &sel_and_ilc[hash0].ilc[n];  \
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6323
	    goto perform2_send_and_return;      \
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6324
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6325
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6326
	if (__isNonNilObject(sel)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6327
	    hash0 = __MAKE_HASH__(__GET_HASH(sel)) % nilcs;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6328
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6329
	    /* sel is either nil or smallint, use its value as hash */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6330
	    hash0 = (INT)sel % nilcs;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6331
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6332
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6333
	TRY(0);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6334
	TRY(1);
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  6335
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  6336
# undef TRY
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6337
	/*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6338
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6339
	pIlc = &sel_and_ilc[hash0].ilc[sel_and_ilc[hash0].flip];
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6340
	sel_and_ilc[hash0].sel[sel_and_ilc[hash0].flip] = sel;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6341
	sel_and_ilc[hash0].flip = (sel_and_ilc[hash0].flip + 1) % nways;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6342
	pIlc->ilc_func = __SEND2ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6343
	if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6344
	    __flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6345
	    pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6346
	}
16169
5a4e80279be4 Object>>#perform:(with:(with:)): more performant implementation
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16126
diff changeset
  6347
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
  6348
perform2_send_and_return:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6349
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6350
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6351
	static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6352
	RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6353
    }
18263
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  6354
#endif /* not SCHTEAM */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6355
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6356
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6357
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6358
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6359
perform:aSelector with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6360
    "send the three-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6361
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6362
%{
18263
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  6363
#ifdef __SCHTEAM__
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  6364
    return context.PERFORM_WITH3(self, aSelector, arg1, arg2, arg3);
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  6365
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6366
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6367
    static struct inlineCache ilc_0 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6368
    static struct inlineCache ilc_1 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6369
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6370
    static OBJ last_1 = nil;
18185
f454e3590ebc missing type in flip
Claus Gittinger <cg@exept.de>
parents: 18151
diff changeset
  6371
    static int flip = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6372
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6373
    if (InterruptPending == nil) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6374
	if (aSelector != last_0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6375
	    if (aSelector != last_1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6376
		if (flip) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6377
		    pIlc = &ilc_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6378
		    flip = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6379
		    last_0 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6380
		} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6381
		    pIlc = &ilc_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6382
		    flip = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6383
		    last_1 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6384
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6385
		pIlc->ilc_func = __SEND3ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6386
		if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6387
		    __flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6388
		    pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6389
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6390
	    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6391
		pIlc = &ilc_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6392
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6393
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6394
	    pIlc = &ilc_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6395
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6396
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2, arg3) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6397
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6398
	static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6399
	RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6400
    }
18263
1fadeed7749f schteam stuff
Claus Gittinger <cg@exept.de>
parents: 18254
diff changeset
  6401
#endif /* not SCHTEAM */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6402
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6403
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6404
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6405
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6406
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6407
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6408
    "send the four-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6409
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6410
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6411
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6412
    static struct inlineCache ilc_0 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6413
    static struct inlineCache ilc_1 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6414
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6415
    static OBJ last_1 = nil;
18185
f454e3590ebc missing type in flip
Claus Gittinger <cg@exept.de>
parents: 18151
diff changeset
  6416
    static int flip = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6418
    if (InterruptPending == nil) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6419
	if (aSelector != last_0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6420
	    if (aSelector != last_1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6421
		if (flip) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6422
		    pIlc = &ilc_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6423
		    flip = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6424
		    last_0 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6425
		} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6426
		    pIlc = &ilc_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6427
		    flip = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6428
		    last_1 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6429
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6430
		pIlc->ilc_func = __SEND4ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6431
		if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6432
		    __flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6433
		    pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6434
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6435
	    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6436
		pIlc = &ilc_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6437
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6438
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6439
	    pIlc = &ilc_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6440
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6441
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6442
				     arg1, arg2, arg3, arg4) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6443
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6444
	static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6445
	RETURN (_SEND4(self, aSelector, nil, &ilc4,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6446
		       arg1, arg2, arg3, arg4));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6447
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6448
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6449
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6450
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6451
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6452
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6453
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6454
    "send the five-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6455
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6456
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6457
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6458
    static struct inlineCache ilc_0 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6459
    static struct inlineCache ilc_1 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6460
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6461
    static OBJ last_1 = nil;
18185
f454e3590ebc missing type in flip
Claus Gittinger <cg@exept.de>
parents: 18151
diff changeset
  6462
    static int flip = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6463
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6464
    if (InterruptPending == nil) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6465
	if (aSelector != last_0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6466
	    if (aSelector != last_1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6467
		if (flip) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6468
		    pIlc = &ilc_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6469
		    flip = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6470
		    last_0 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6471
		} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6472
		    pIlc = &ilc_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6473
		    flip = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6474
		    last_1 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6475
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6476
		pIlc->ilc_func = __SEND5ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6477
		if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6478
		    __flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6479
		    pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6480
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6481
	    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6482
		pIlc = &ilc_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6483
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6484
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6485
	    pIlc = &ilc_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6486
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6487
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6488
				     arg1, arg2, arg3, arg4, arg5) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6489
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6490
	static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6491
	RETURN (_SEND5(self, aSelector, nil, &ilc5,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6492
		       arg1, arg2, arg3, arg4, arg5));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6493
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6494
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6495
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6496
						  with:arg5)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6497
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6498
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6499
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6500
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 with:arg6
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6501
    "send the six-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6502
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6503
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6504
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6505
    static struct inlineCache ilc_0 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6506
    static struct inlineCache ilc_1 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6507
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6508
    static OBJ last_1 = nil;
18185
f454e3590ebc missing type in flip
Claus Gittinger <cg@exept.de>
parents: 18151
diff changeset
  6509
    static int flip = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6510
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6511
    if (InterruptPending == nil) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6512
	if (aSelector != last_0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6513
	    if (aSelector != last_1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6514
		if (flip) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6515
		    pIlc = &ilc_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6516
		    flip = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6517
		    last_0 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6518
		} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6519
		    pIlc = &ilc_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6520
		    flip = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6521
		    last_1 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6522
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6523
		pIlc->ilc_func = __SEND6ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6524
		if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6525
		    __flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6526
		    pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6527
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6528
	    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6529
		pIlc = &ilc_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6530
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6531
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6532
	    pIlc = &ilc_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6533
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6534
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6535
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6536
				     arg1, arg2, arg3, arg4, arg5, arg6) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6537
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6538
	static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6539
	RETURN (_SEND6(self, aSelector, nil, &ilc6,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6540
		       arg1, arg2, arg3, arg4, arg5, arg6));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6541
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6542
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6543
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6544
						  with:arg5 with:arg6)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6545
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6546
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6547
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6548
perform:aSelector withArguments:argArray
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  6549
    "send the message aSelector with all args taken from argArray
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6550
     to the receiver."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6551
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6552
    |numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6553
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6554
%{
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  6555
#ifdef __SCHTEAM__
18238
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  6556
    return context.PERFORM_WITH_ARGUMENTS(self, aSelector, argArray);
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  6557
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6558
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6559
    int nargs;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6560
    OBJ l;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6561
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  6562
    if (__isArrayLike(argArray)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6563
	nargs = __arraySize(argArray);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6564
	argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6565
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6566
	if (__isNonNilObject(argArray)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6567
	    static struct inlineCache ilcSize = __ILC0(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6568
	    int i;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6569
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6570
	    numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6571
	    if (!__isSmallInteger(numberOfArgs))
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6572
		goto bad;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6573
	    nargs = __intVal(numberOfArgs);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6574
	    argP = (OBJ *)(&a1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6575
	    for (i=1; i <= nargs; i++) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6576
		*argP++ = __AT_(argArray, __mkSmallInteger(i));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6577
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6578
	    argP = (OBJ *)(&a1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6579
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6580
	    nargs = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6581
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6582
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6583
    switch (nargs) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6584
	case 0:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6585
	    if (InterruptPending == nil) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6586
		static OBJ last0_0 = nil; static struct inlineCache ilc0_0 = __ILCPERF0(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6587
		static OBJ last0_1 = nil; static struct inlineCache ilc0_1 = __ILCPERF0(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6588
		static OBJ last0_2 = nil; static struct inlineCache ilc0_2 = __ILCPERF0(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6589
		static OBJ last0_3 = nil; static struct inlineCache ilc0_3 = __ILCPERF0(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6590
		static int flip0 = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6591
		struct inlineCache *pIlc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6592
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6593
		if (aSelector == last0_0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6594
		    pIlc = &ilc0_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6595
		} else if (aSelector == last0_1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6596
		    pIlc = &ilc0_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6597
		} else if (aSelector == last0_2) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6598
		    pIlc = &ilc0_2;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6599
		} else if (aSelector == last0_3) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6600
		    pIlc = &ilc0_3;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6601
		} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6602
		    if (flip0 == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6603
			pIlc = &ilc0_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6604
			flip0 = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6605
			last0_0 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6606
		    } else if (flip0 == 1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6607
			pIlc = &ilc0_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6608
			flip0 = 2;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6609
			last0_1 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6610
		    } else if (flip0 == 2) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6611
			pIlc = &ilc0_2;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6612
			flip0 = 3;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6613
			last0_2 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6614
		    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6615
			pIlc = &ilc0_3;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6616
			flip0 = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6617
			last0_3 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6618
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6619
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6620
		    pIlc->ilc_func = __SEND0ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6621
		    if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6622
			__flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6623
			pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6624
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6625
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6626
		RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6627
	    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6628
		static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6629
		RETURN (_SEND0(self, aSelector, nil, &ilc0));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6630
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6631
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6632
	case 1:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6633
	    if (InterruptPending == nil) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6634
		static OBJ last1_0 = nil; static struct inlineCache ilc1_0 = __ILCPERF1(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6635
		static OBJ last1_1 = nil; static struct inlineCache ilc1_1 = __ILCPERF1(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6636
		static OBJ last1_2 = nil; static struct inlineCache ilc1_2 = __ILCPERF1(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6637
		static OBJ last1_3 = nil; static struct inlineCache ilc1_3 = __ILCPERF1(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6638
		static int flip1 = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6639
		struct inlineCache *pIlc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6640
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6641
		if (aSelector == last1_0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6642
		    pIlc = &ilc1_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6643
		} else if (aSelector == last1_1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6644
		    pIlc = &ilc1_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6645
		} else if (aSelector == last1_2) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6646
		    pIlc = &ilc1_2;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6647
		} else if (aSelector == last1_3) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6648
		    pIlc = &ilc1_3;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6649
		} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6650
		    if (flip1 == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6651
			pIlc = &ilc1_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6652
			flip1 = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6653
			last1_0 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6654
		    } else if (flip1 == 1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6655
			pIlc = &ilc1_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6656
			flip1 = 2;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6657
			last1_1 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6658
		    } else if (flip1 == 2) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6659
			pIlc = &ilc1_2;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6660
			flip1 = 3;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6661
			last1_2 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6662
		    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6663
			pIlc = &ilc1_3;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6664
			flip1 = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6665
			last1_3 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6666
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6667
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6668
		    pIlc->ilc_func = __SEND1ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6669
		    if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6670
			__flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6671
			pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6672
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6673
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6674
		RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6675
	    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6676
		static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6677
		RETURN (_SEND1(self, aSelector, nil, &ilc1, argP[0]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6678
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6679
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6680
	case 2:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6681
	    if (InterruptPending == nil) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6682
		static OBJ last2_0 = nil; static struct inlineCache ilc2_0 = __ILCPERF2(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6683
		static OBJ last2_1 = nil; static struct inlineCache ilc2_1 = __ILCPERF2(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6684
		static int flip2 = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6685
		struct inlineCache *pIlc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6686
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6687
		if (aSelector == last2_0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6688
		    pIlc = &ilc2_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6689
		} else if (aSelector == last2_1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6690
		    pIlc = &ilc2_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6691
		} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6692
		    if (flip2 == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6693
			pIlc = &ilc2_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6694
			flip2 = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6695
			last2_0 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6696
		    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6697
			pIlc = &ilc2_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6698
			flip2 = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6699
			last2_1 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6700
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6701
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6702
		    pIlc->ilc_func = __SEND2ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6703
		    if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6704
			__flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6705
			pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6706
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6707
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6708
		RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6709
	    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6710
		static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6711
		RETURN (_SEND2(self, aSelector, nil, &ilc2, argP[0], argP[1]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6712
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6713
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6714
	case 3:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6715
	    if (InterruptPending == nil) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6716
		static OBJ last3_0 = nil; static struct inlineCache ilc3_0 = __ILCPERF3(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6717
		static OBJ last3_1 = nil; static struct inlineCache ilc3_1 = __ILCPERF3(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6718
		static int flip3 = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6719
		struct inlineCache *pIlc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6720
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6721
		if (aSelector == last3_0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6722
		    pIlc = &ilc3_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6723
		} else if (aSelector == last3_1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6724
		    pIlc = &ilc3_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6725
		} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6726
		    if (flip3 == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6727
			pIlc = &ilc3_0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6728
			flip3 = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6729
			last3_0 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6730
		    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6731
			pIlc = &ilc3_1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6732
			flip3 = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6733
			last3_1 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6734
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6735
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6736
		    pIlc->ilc_func = __SEND3ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6737
		    if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6738
			__flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6739
			pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6740
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6741
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6742
		RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1], argP[2]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6743
	    } else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6744
		static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6745
		RETURN (_SEND3(self, aSelector, nil, &ilc3, argP[0], argP[1], argP[2]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6746
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6747
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6748
	case 4:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6749
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6750
		static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6751
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6752
		if ((InterruptPending != nil) || (aSelector != last4)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6753
		    ilc4.ilc_func = __SEND4ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6754
		    if (ilc4.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6755
			__flushPolyCache(ilc4.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6756
			ilc4.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6757
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6758
		    last4 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6759
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6760
		RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6761
						argP[0], argP[1], argP[2], argP[3]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6762
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6763
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6764
	case 5:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6765
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6766
		static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6767
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6768
		if ((InterruptPending != nil) || (aSelector != last5)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6769
		    ilc5.ilc_func = __SEND5ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6770
		    if (ilc5.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6771
			__flushPolyCache(ilc5.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6772
			ilc5.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6773
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6774
		    last5 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6775
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6776
		RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6777
						argP[0], argP[1], argP[2], argP[3], argP[4]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6778
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6779
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6780
	case 6:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6781
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6782
		static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6783
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6784
		if ((InterruptPending != nil) || (aSelector != last6)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6785
		    ilc6.ilc_func = __SEND6ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6786
		    if (ilc6.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6787
			__flushPolyCache(ilc6.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6788
			ilc6.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6789
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6790
		    last6 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6791
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6792
		RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6793
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6794
						argP[5]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6795
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6796
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6797
	case 7:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6798
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6799
		static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6800
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6801
		if ((InterruptPending != nil) || (aSelector != last7)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6802
		    ilc7.ilc_func = __SEND7ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6803
		    if (ilc7.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6804
			__flushPolyCache(ilc7.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6805
			ilc7.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6806
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6807
		    last7 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6808
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6809
		RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6810
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6811
						argP[5], argP[6]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6812
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6813
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6814
	case 8:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6815
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6816
		static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6817
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6818
		if ((InterruptPending != nil) || (aSelector != last8)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6819
		    ilc8.ilc_func = __SEND8ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6820
		    if (ilc8.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6821
			__flushPolyCache(ilc8.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6822
			ilc8.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6823
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6824
		    last8 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6825
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6826
		RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6827
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6828
						argP[5], argP[6], argP[7]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6829
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6830
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6831
	case 9:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6832
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6833
		static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6834
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6835
		if ((InterruptPending != nil) || (aSelector != last9)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6836
		    ilc9.ilc_func = __SEND9ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6837
		    if (ilc9.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6838
			__flushPolyCache(ilc9.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6839
			ilc9.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6840
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6841
		    last9 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6842
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6843
		RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6844
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6845
						argP[5], argP[6], argP[7], argP[8]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6846
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6847
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6848
	case 10:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6849
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6850
		static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6851
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6852
		if ((InterruptPending != nil) || (aSelector != last10)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6853
		    ilc10.ilc_func = __SEND10ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6854
		    if (ilc10.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6855
			__flushPolyCache(ilc10.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6856
			ilc10.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6857
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6858
		    last10 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6859
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6860
		RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6861
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6862
						argP[5], argP[6], argP[7], argP[8], argP[9]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6863
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6864
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6865
	case 11:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6866
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6867
		static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6868
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6869
		if ((InterruptPending != nil) || (aSelector != last11)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6870
		    ilc11.ilc_func = __SEND11ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6871
		    if (ilc11.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6872
			__flushPolyCache(ilc11.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6873
			ilc11.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6874
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6875
		    last11 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6876
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6877
		RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6878
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6879
						argP[5], argP[6], argP[7], argP[8], argP[9],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6880
						argP[10]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6881
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6882
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6883
	case 12:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6884
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6885
		static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6886
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6887
		if ((InterruptPending != nil) || (aSelector != last12)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6888
		    ilc12.ilc_func = __SEND12ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6889
		    if (ilc12.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6890
			__flushPolyCache(ilc12.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6891
			ilc12.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6892
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6893
		    last12 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6894
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6895
		RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6896
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6897
						argP[5], argP[6], argP[7], argP[8], argP[9],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6898
						argP[10], argP[11]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6899
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6900
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6901
	case 13:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6902
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6903
		static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6904
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6905
		if ((InterruptPending != nil) || (aSelector != last13)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6906
		    ilc13.ilc_func = __SEND13ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6907
		    if (ilc13.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6908
			__flushPolyCache(ilc13.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6909
			ilc13.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6910
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6911
		    last13 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6912
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6913
		RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6914
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6915
						argP[5], argP[6], argP[7], argP[8], argP[9],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6916
						argP[10], argP[11], argP[12]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6917
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6918
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6919
	case 14:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6920
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6921
		static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6922
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6923
		if ((InterruptPending != nil) || (aSelector != last14)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6924
		    ilc14.ilc_func = __SEND14ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6925
		    if (ilc14.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6926
			__flushPolyCache(ilc14.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6927
			ilc14.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6928
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6929
		    last14 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6930
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6931
		RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6932
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6933
						argP[5], argP[6], argP[7], argP[8], argP[9],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6934
						argP[10], argP[11], argP[12], argP[13]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6935
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6936
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6937
	case 15:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6938
	    {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6939
		static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6940
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6941
		if ((InterruptPending != nil) || (aSelector != last15)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6942
		    ilc15.ilc_func = __SEND15ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6943
		    if (ilc15.ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6944
			__flushPolyCache(ilc15.ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6945
			ilc15.ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6946
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6947
		    last15 = aSelector;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6948
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6949
		RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6950
						argP[0], argP[1], argP[2], argP[3], argP[4],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6951
						argP[5], argP[6], argP[7], argP[8], argP[9],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6952
						argP[10], argP[11], argP[12], argP[13],
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6953
						argP[14]));
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6954
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6955
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6956
bad:;
18238
0b3b5ced099d oops - sorry
Claus Gittinger <cg@exept.de>
parents: 18231
diff changeset
  6957
#endif
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6958
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6959
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6960
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6961
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6962
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6963
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6964
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6965
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6966
perform:aSelector withOptionalArgument:arg
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6967
    "send aSelector-message to the receiver.
6318
3677d346113a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  6968
     If the message expects an argument, pass arg."
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6969
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  6970
    aSelector argumentCount == 1 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6971
	^ self perform:aSelector with:arg
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6972
    ].
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6973
    ^ self perform:aSelector
6319
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6974
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6975
    "
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6976
     |rec sel|
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6977
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6978
     rec := -1.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6979
     sel := #abs.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6980
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6981
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6982
     sel := #max:.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6983
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  6984
    "
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6985
!
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  6986
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6987
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6988
    "send aSelector-message to the receiver.
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6989
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  6990
     pass either none, 1, or 2 arguments."
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6991
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6992
    |numArgs|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6993
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  6994
    numArgs := aSelector argumentCount.
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6995
    numArgs == 0 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6996
	^ self perform:aSelector
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6997
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  6998
    numArgs == 1 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  6999
	^ self perform:aSelector with:optionalArg1
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7000
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7001
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7002
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7003
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7004
     |rec sel|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7005
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7006
     rec := -1.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7007
     sel := #abs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7008
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7009
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7010
     sel := #max:.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7011
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7012
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7013
!
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  7014
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7015
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7016
    "send aSelector-message to the receiver.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7017
     Depending on the number of arguments the message expects,
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7018
     pass either none, 1, 2 or 3 arguments."
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7019
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7020
    |numArgs|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7021
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  7022
    numArgs := aSelector argumentCount.
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7023
    numArgs == 0 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7024
	^ self perform:aSelector
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7025
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7026
    numArgs == 1 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7027
	^ self perform:aSelector with:optionalArg1
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7028
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7029
    numArgs == 2 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7030
	^ self perform:aSelector with:optionalArg1 with:optionalArg2
6728
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7031
    ].
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7032
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7033
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7034
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7035
     |rec sel|
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7036
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7037
     rec := -1.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7038
     sel := #abs.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7039
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7040
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7041
     sel := #max:.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7042
     rec perform:sel withOptionalArgument:2.
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7043
    "
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7044
!
a4fc441779dc with 3 OptionalArguments
Claus Gittinger <cg@exept.de>
parents: 6721
diff changeset
  7045
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7046
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2 and:optionalArg3 and:optionalArg4
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7047
    "send aSelector-message to the receiver.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7048
     Depending on the number of arguments the message expects,
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7049
     pass either none, 1, 2, 3 or 4 arguments."
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7050
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7051
    |numArgs|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7052
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  7053
    numArgs := aSelector argumentCount.
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7054
    numArgs == 0 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7055
	^ self perform:aSelector
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7056
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7057
    numArgs == 1 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7058
	^ self perform:aSelector with:optionalArg1
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7059
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7060
    numArgs == 2 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7061
	^ self perform:aSelector with:optionalArg1 with:optionalArg2
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7062
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7063
    numArgs == 3 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7064
	^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3
6764
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7065
    ].
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7066
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2 with:optionalArg3 with:optionalArg4.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7067
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7068
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7069
     |rec sel|
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7070
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7071
     rec := -1.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7072
     sel := #abs.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7073
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7074
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7075
     sel := #max:.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7076
     rec perform:sel withOptionalArgument:2.
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7077
    "
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7078
!
c5455cf45678 perform:withOptional*
Claus Gittinger <cg@exept.de>
parents: 6741
diff changeset
  7079
17524
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7080
performMessage:aMessage
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7081
    "Send aMessage, an object which provides a selector and arguments to the
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7082
     receiver object.
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7083
     Added for Ansi compatibility"
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7084
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7085
    ^ self perform:(aMessage selector) withArguments:(aMessage arguments).
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7086
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7087
    "
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7088
     123 performMessage:(Message selector:#+ argument:100)
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7089
    "
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7090
!
4a059f9d1dee class: Object
Claus Gittinger <cg@exept.de>
parents: 17456
diff changeset
  7091
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7092
performMethod:aMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7093
    "invoke aMethod on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7094
     The method should be a zero-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7095
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7096
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7097
     Warning:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7098
	 Take care for the method to be appropriate for the
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7099
	 receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7100
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7101
    ^ aMethod valueWithReceiver:self arguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7102
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7103
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7104
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7105
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7106
     mthd := SmallInteger compiledMethodAt:#negated.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7107
     Transcript showCR:(1 performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7108
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7109
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7110
    "BAD USE example:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7111
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7112
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7113
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7114
     mthd := Point compiledMethodAt:#x.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7115
     Transcript showCR:((1->2) performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7116
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7117
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7118
    "Modified: 31.7.1997 / 17:41:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7119
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7120
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7121
performMethod:aMethod arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7122
    "invoke aMethod on the receiver, passing an argumentArray.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7123
     The size of the argumentArray should match the number of args
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7124
     expected by the method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7125
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7126
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7127
     Warning:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7128
	 Take care for the method to be appropriate for the
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7129
	 receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7130
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7131
    ^ aMethod valueWithReceiver:self arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7132
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7133
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7134
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7135
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7136
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7137
     Transcript showCR:(1 performMethod:mthd arguments:#(2))
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7138
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7139
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7140
    "Created: 31.7.1997 / 17:46:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7141
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7142
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7143
performMethod:aMethod with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7144
    "invoke aMethod on the receiver, passing an argument.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7145
     The method should be a one-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7146
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7147
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7148
     Warning:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7149
	 Take care for the method to be appropriate for the
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7150
	 receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7151
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7152
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7153
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7154
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7155
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7156
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7157
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7158
     Transcript showCR:(1 performMethod:mthd with:2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7159
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7160
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7161
    "Modified: 31.7.1997 / 17:42:32 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7162
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7163
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7164
performMethod:aMethod with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7165
    "invoke aMethod on the receiver, passing two arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7166
     The method should be a two-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7167
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7168
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7169
     Warning:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7170
	 Take care for the method to be appropriate for the
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7171
	 receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7172
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7173
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7174
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7175
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7176
     |mthd arr|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7177
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7178
     arr := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7179
     mthd := Array compiledMethodAt:#basicAt:put:.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7180
     arr performMethod:mthd with:1 with:'foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7181
     Transcript showCR:arr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7182
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7183
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7184
    "Modified: 31.7.1997 / 17:44:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7185
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7186
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7187
performMethod:aMethod with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7188
    "invoke aMethod on the receiver, passing three arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7189
     The method should be a three-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7190
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7191
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7192
     Warning:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7193
	 Take care for the method to be appropriate for the
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7194
	 receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7195
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7196
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7197
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7198
    "Created: 31.7.1997 / 17:45:20 / cg"
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7199
!
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7200
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7201
performX:aSelector
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  7202
    "send the message aSelector to the receiver
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  7203
     This is the original implementation of #perform, for reference (before Jan's changes for Ruby tuning)."
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7204
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7205
    <resource: #skipInDebuggersWalkBack>
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7206
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7207
%{
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7208
    REGISTER OBJ sel = aSelector;
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7209
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7210
    if (InterruptPending == nil) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7211
	struct inlineCache *pIlc;
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7212
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7213
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF0(l) }
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7214
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7215
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7216
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7217
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7218
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7219
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7220
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7221
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7222
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
16230
e5de942a1a19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16229
diff changeset
  7223
#undef nilcs
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7224
#define nilcs 256
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7225
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7226
	static struct sel_and_ilc {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7227
	    OBJ sel;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7228
	    struct inlineCache ilc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7229
	    struct sel_and_ilc *next;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7230
	} sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7231
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7232
#undef SEL_AND_ILC_INIT_1
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7233
#undef SEL_AND_ILC_INIT_2
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7234
#undef SEL_AND_ILC_INIT_4
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7235
#undef SEL_AND_ILC_INIT_8
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7236
#undef SEL_AND_ILC_INIT_16
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7237
#undef SEL_AND_ILC_INIT_32
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7238
#undef SEL_AND_ILC_INIT_64
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7239
#undef SEL_AND_ILC_INIT_128
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7240
#undef SEL_AND_ILC_INIT_256
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7241
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7242
	static struct sel_and_ilc *nextFree = sel_and_ilc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7243
	static struct sel_and_ilc *lastUsed = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7244
	int n;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7245
	struct sel_and_ilc *slot, *prev, *prevPrev;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7246
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7247
	for (n=0, slot = lastUsed, prev = prevPrev = 0; slot; n++, slot = slot->next) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7248
	   if (sel == slot->sel) {
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  7249
#ifdef XXDEBUG
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7250
printf("cached slot %d (len=%d)\n", slot-sel_and_ilc, n);
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  7251
#endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7252
		pIlc = &(slot->ilc);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7253
		// move to front
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7254
		if (prev) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7255
		    prev->next = slot->next;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7256
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7257
		slot->next = lastUsed;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7258
		lastUsed = slot;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7259
		pIlc = &(slot->ilc);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7260
		goto perform0_send_and_return;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7261
	   }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7262
	   prevPrev = prev;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7263
	   prev = slot;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7264
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7265
	// not recently used...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7266
	if (nextFree) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7267
	    // another free one
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7268
	    slot = nextFree;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7269
	    nextFree = nextFree + 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7270
	    if (nextFree >= &(sel_and_ilc[nilcs])) nextFree = 0;
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  7271
#ifdef XXDEBUG
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7272
printf("new slot %d\n", slot-sel_and_ilc);
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  7273
#endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7274
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7275
	    // no more for reuse - use least recently used
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7276
	    slot = prev;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7277
	    prevPrev->next = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7278
	    slot->next = lastUsed;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7279
	    lastUsed = slot;
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  7280
#ifdef XXDEBUG
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7281
printf("reuse last slot %d\n", slot-sel_and_ilc);
15942
a76da2251215 handle weak objects (with instances or non-WeakArray)
Claus Gittinger <cg@exept.de>
parents: 15932
diff changeset
  7282
#endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7283
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7284
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7285
	/*printf("Object >> #perform: #%s --> no PIC found\n", __symbolVal(aSelector));*/
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7286
	pIlc = &(slot->ilc);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7287
	slot->sel = sel;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7288
	pIlc->ilc_func = __SEND0ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7289
	if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7290
	     __flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7291
	    pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7292
	}
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7293
perform0_send_and_return:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7294
	RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7295
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7296
	static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7297
	RETURN (_SEND0(self, aSelector, nil, &ilc0));
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7298
    }
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7299
%}.
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  7300
    ^ self perform:aSelector withArguments:#()
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7301
!
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7302
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7303
returnablePerform:aSelector with:arg
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7304
    "send the one-arg-message aSelector to the receiver.
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7305
     This is the same as #perform:with: but the context can return."
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7306
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7307
    <context: #return>
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7308
%{
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7309
    REGISTER OBJ sel = aSelector;
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7310
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7311
    if (InterruptPending == nil) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7312
	struct inlineCache *pIlc;
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7313
    /* JV @ 2010-22-07: To improve performance I use 256 ILCs instead
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7314
       of default 4. For details, see comment in perform: */
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7315
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7316
#define SEL_AND_ILC_INIT_1(l)   { nil , __ILCPERF1(l) }
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7317
#define SEL_AND_ILC_INIT_2(l)   SEL_AND_ILC_INIT_1(l)   , SEL_AND_ILC_INIT_1(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7318
#define SEL_AND_ILC_INIT_4(l)   SEL_AND_ILC_INIT_2(l)   , SEL_AND_ILC_INIT_2(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7319
#define SEL_AND_ILC_INIT_8(l)   SEL_AND_ILC_INIT_4(l)   , SEL_AND_ILC_INIT_4(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7320
#define SEL_AND_ILC_INIT_16(l)  SEL_AND_ILC_INIT_8(l)   , SEL_AND_ILC_INIT_8(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7321
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7322
#define SEL_AND_ILC_INIT_32(l)  SEL_AND_ILC_INIT_16(l)  , SEL_AND_ILC_INIT_16(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7323
#define SEL_AND_ILC_INIT_64(l)  SEL_AND_ILC_INIT_32(l)  , SEL_AND_ILC_INIT_32(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7324
#define SEL_AND_ILC_INIT_128(l) SEL_AND_ILC_INIT_64(l)  , SEL_AND_ILC_INIT_64(l)
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7325
#define SEL_AND_ILC_INIT_256(l) SEL_AND_ILC_INIT_128(l) , SEL_AND_ILC_INIT_128(l)
16230
e5de942a1a19 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 16229
diff changeset
  7326
#undef nilcs
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7327
#define nilcs 256
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7328
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7329
	static struct { OBJ sel; struct inlineCache ilc; } sel_and_ilc[nilcs] = { SEL_AND_ILC_INIT_256(29) };
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7330
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7331
#undef SEL_AND_ILC_INIT_1
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7332
#undef SEL_AND_ILC_INIT_2
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7333
#undef SEL_AND_ILC_INIT_4
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7334
#undef SEL_AND_ILC_INIT_8
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7335
#undef SEL_AND_ILC_INIT_16
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7336
#undef SEL_AND_ILC_INIT_32
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7337
#undef SEL_AND_ILC_INIT_64
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7338
#undef SEL_AND_ILC_INIT_128
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7339
#undef SEL_AND_ILC_INIT_256
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7340
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7341
	static int flip = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7342
	int i;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7343
	for (i = 0; i < nilcs; i++) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7344
	   if (sel == sel_and_ilc[i].sel) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7345
		pIlc = &sel_and_ilc[i].ilc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7346
		goto perform1_send_and_return;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7347
	   }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7348
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7349
	/*printf("Object >> #perform: #%s with: arg --> no PIC found\n", __symbolVal(aSelector));*/
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7350
	pIlc = &sel_and_ilc[flip].ilc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7351
	sel_and_ilc[flip].sel = sel;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7352
	flip = (flip + 1) % nilcs;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7353
	pIlc->ilc_func = __SEND1ADDR__;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7354
	if (pIlc->ilc_poly) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7355
	     __flushPolyCache(pIlc->ilc_poly);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7356
	    pIlc->ilc_poly = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7357
	}
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7358
perform1_send_and_return:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7359
	RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7360
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7361
	static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7362
	RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
15797
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7363
    }
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7364
%}.
4100230d57fa class: Object
Stefan Vogel <sv@exept.de>
parents: 15777
diff changeset
  7365
    ^ self perform:aSelector withArguments:(Array with:arg)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7366
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7367
17677
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7368
!Object methodsFor:'misc ui support'!
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7369
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7370
browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7371
    "open a browser on the receiver's class"
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7372
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7373
    self class theNonMetaclass browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7374
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7375
    "
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7376
     10 browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7377
     Collection browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7378
     Collection class browse
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7379
    "
20779
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7380
!
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7381
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7382
inspect
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7383
    "{ Pragma: +optSpace }"
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7384
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7385
    "launch an inspector on the receiver.
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7386
     this method (or better: inspectorClass) can be redefined in subclasses
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7387
     to start special inspectors."
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7388
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7389
    |cls|
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7390
24221
d9a7aa5e2dab #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24187
diff changeset
  7391
    "/ the new inspector2 will create multiple tabs containing basic,regular and type-specific inspectors
20779
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7392
    Inspector ~~ MiniInspector ifTrue:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  7393
	cls := #'Tools::Inspector2' asClassIfAbsent:nil.
20779
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7394
    ].
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7395
    cls isNil ifTrue:[
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  7396
	cls := self inspectorClass.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  7397
	cls isNil ifTrue:[
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  7398
	    self basicInspect.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  7399
	    ^ self.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
  7400
	].
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7401
    ].
20779
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7402
    cls openOn:self
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7403
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7404
    "
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7405
     Object new inspect
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7406
     (1 @ 2) inspect
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7407
     Smalltalk inspect
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7408
     #(1 2 3) asOrderedCollection inspect
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7409
     (Color red) inspect
24221
d9a7aa5e2dab #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24187
diff changeset
  7410
     (Image fromFile:'../../goodies/bitmaps/gifImages/garfield.gif') inspect
20779
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7411
    "
22384
9cf6c162e316 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 22315
diff changeset
  7412
9cf6c162e316 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 22315
diff changeset
  7413
    "Modified (format): / 29-11-2017 / 10:40:56 / stefan"
23416
bcf56209c667 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23403
diff changeset
  7414
    "Modified: / 10-10-2018 / 00:41:58 / Claus Gittinger"
24221
d9a7aa5e2dab #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24187
diff changeset
  7415
    "Modified (format): / 28-05-2019 / 19:45:07 / Claus Gittinger"
20779
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7416
!
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7417
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7418
inspectorClass
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7419
    "{ Pragma: +optSpace }"
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7420
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7421
    "return the class to use for inspect.
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7422
     Can (should) be redefined in classes for which a better inspector is available"
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7423
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7424
    Inspector notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7425
	^ Inspector.
20779
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7426
    ].
23416
bcf56209c667 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23403
diff changeset
  7427
    ^ #'InspectorView' asClassIfAbsent:nil
20779
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7428
69971f5a730b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20762
diff changeset
  7429
    "Modified: / 08-03-2012 / 16:09:38 / cg"
23416
bcf56209c667 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23403
diff changeset
  7430
    "Modified: / 10-10-2018 / 00:42:11 / Claus Gittinger"
17677
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7431
! !
4b68c0b48d73 class: Object
Claus Gittinger <cg@exept.de>
parents: 17590
diff changeset
  7432
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7433
!Object methodsFor:'object persistency'!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7434
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7435
elementDescriptorFor:anAspectSymbol
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7436
    "support for persistency:
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7437
     answer a collection of associations containing the
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7438
     objects state to be encoded for aspect.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7439
     Association key is the instance variable name or access selector,
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7440
     association value is the contents of the instance variable.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7441
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7442
     The default is to return the contents of all non-nil instance variables"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7443
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7444
    |ret|
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7445
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7446
    ret := 0.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7447
    anAspectSymbol notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7448
	ret := self perform:anAspectSymbol ifNotUnderstood:[0].
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7449
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7450
    ret == 0 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7451
	^ self elementDescriptorForNonNilInstanceVariables
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7452
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7453
    ^ ret.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7454
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7455
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7456
elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7457
    "return all instance variables for visiting/encoding"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7458
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7459
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | true].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7460
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7461
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7462
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7463
      Dictionary new elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7464
      (5 @ nil) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7465
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7466
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7467
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7468
elementDescriptorForInstanceVariablesMatching:aBlock
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7469
    "return all instance variables which conform to aBlock, for encoding/visiting.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7470
     Indexed vars are all included."
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7471
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7472
    |instVarNames theClass children
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7473
     instSize "{ Class: SmallInteger }"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7474
     varSize "{ Class: SmallInteger }"|
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7475
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7476
    theClass := self class.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7477
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7478
    instSize := theClass instSize.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7479
    varSize := theClass isVariable ifTrue:[self basicSize] ifFalse:[0].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7480
    children := OrderedCollection new:(instSize + varSize).
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7481
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7482
    instVarNames := theClass allInstVarNames.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7483
    1 to:instSize do:[:i | |var|
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7484
	var := self instVarAt:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7485
	(aBlock value:var) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7486
	    children add:((instVarNames at:i) -> var)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7487
	]
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7488
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7489
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7490
    varSize ~~ 0 ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7491
	1 to:varSize do:[:i |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7492
	    children add:(i -> (self basicAt:i))
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7493
	]
10834
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7494
    ].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7495
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7496
    ^ children.
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7497
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7498
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7499
      #(1 2 3 nil true symbol) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7500
      Dictionary new elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7501
      (5 @ nil) elementDescriptorForInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7502
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7503
!
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7504
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7505
elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7506
    "return all non-nil instance variables for visiting/encoding"
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7507
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7508
    ^ self elementDescriptorForInstanceVariablesMatching:[:val | val notNil].
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7509
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7510
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7511
      #(1 2 3 nil true symbol) elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7512
      Dictionary new elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7513
      (5 @ nil) elementDescriptorForNonNilInstanceVariables
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7514
    "
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7515
! !
f780552c1b11 category change
Claus Gittinger <cg@exept.de>
parents: 10732
diff changeset
  7516
25046
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
  7517
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7518
!Object methodsFor:'printing & storing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7519
20839
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7520
_errorPrint
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7521
    "Do not use this in user code.
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7522
     Prints on stderr, regardless of any redirection to a logger.
25231
9d9d184c6af3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25230
diff changeset
  7523
     Only to be used by the MiniDebugger or during early startup (before classes are initialized), 
9d9d184c6af3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25230
diff changeset
  7524
     to ensure that its output is shown to a user"
20839
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7525
22315
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7526
    "do not use #asString - error when executing: #('bla' 'fasel') asString"
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7527
    (self printString asSingleByteStringReplaceInvalidWith:$?) _errorPrint.
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7528
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7529
    "
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7530
     #('bla' 'fasel') _errorPrint
22121
60c9ff1ec454 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 22053
diff changeset
  7531
     'hello' asUnicode16String _errorPrint
60c9ff1ec454 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 22053
diff changeset
  7532
     'helloαβγ' asUnicode16String _errorPrint
60c9ff1ec454 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 22053
diff changeset
  7533
     'helloαβγ' asUnicode16String _errorPrintCR
60c9ff1ec454 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 22053
diff changeset
  7534
    "
22315
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7535
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7536
    "Modified (comment): / 17-10-2017 / 13:31:09 / stefan"
20839
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7537
!
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7538
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7539
_errorPrintCR
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7540
    "Do not use this in user code.
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7541
     Prints on stderr, regardless of any redirection to a logger.
25231
9d9d184c6af3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25230
diff changeset
  7542
     Only to be used by the MiniDebugger or during early startup (before classes are initialized), 
9d9d184c6af3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25230
diff changeset
  7543
     to ensure that its output is shown to a user"
9d9d184c6af3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25230
diff changeset
  7544
9d9d184c6af3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25230
diff changeset
  7545
    "do not use #asString - error when executing: #('bla' 'fasel') asString"
22315
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7546
    (self printString asSingleByteStringReplaceInvalidWith:$?) _errorPrintCR.
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7547
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7548
    "Modified: / 17-10-2017 / 13:28:06 / stefan"
20839
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7549
!
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7550
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7551
_print
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7552
    "Do not use this in user code.
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7553
     Prints on stdout, regardless of any redirection to a logger.
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7554
     Only to be used by low-level crash utilities (like MiniDebugger),
20839
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7555
     to ensure that its output is shown to a user"
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7556
22315
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7557
    self printString _print.
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7558
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7559
    "Modified: / 17-10-2017 / 13:28:11 / stefan"
20839
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7560
!
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7561
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7562
_printCR
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7563
    "Do not use this in user code.
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7564
     Prints on stdout, regardless of any redirection to a logger.
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7565
     Only to be used by low-level crash utilities (like MiniDebugger),
20839
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7566
     to ensure that its output is shown to a user"
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7567
22315
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7568
    self printString _printCR.
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7569
24b83543ad6f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22230
diff changeset
  7570
    "Modified: / 17-10-2017 / 13:28:15 / stefan"
20839
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7571
!
5fde08cafe90 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 20807
diff changeset
  7572
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7573
basicPrintOn:aStream
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7574
    "append the receiver's className with an article to the argument, aStream"
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7575
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7576
    aStream nextPutAll:self classNameWithArticle
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7577
!
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7578
18984
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7579
basicStoreString
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7580
    "defined here for compatibility with CharacterArray, which redefines this"
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7581
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7582
    ^ self storeString
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7583
!
a811aef4aaf5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18894
diff changeset
  7584
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7585
className
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  7586
    "return the classname of the receiver's class"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7587
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7588
    ^ self class name
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7589
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7590
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7591
     1 className
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7592
     1 class className
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7593
     $a className
9105
1666cb465e3f comments
Stefan Vogel <sv@exept.de>
parents: 9071
diff changeset
  7594
     $a class className
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7595
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7596
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7597
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7598
classNameWithArticle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7599
    "return a string consisting of classname preceeded by an article.
20807
fd862f559394 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20779
diff changeset
  7600
     (don't expect me to write national variants for this ... :-)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7601
     If you have special preferences, redefine it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7602
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  7603
    | cls|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7604
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7605
    (cls := self class) == self ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7606
	^ 'a funny object'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7607
    ].
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  7608
    cls isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7609
	^ 'a nil-classes object'        "/ cannot happen
14368
deb662b4664b comment/format in: #className
Claus Gittinger <cg@exept.de>
parents: 14355
diff changeset
  7610
    ].
6829
db28715efb4d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6815
diff changeset
  7611
    ^ cls nameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7612
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7613
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7614
     1 classNameWithArticle
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7615
     (1->2) classNameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7616
     XWorkstation basicNew classNameWithArticle
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7617
     XWorkstation classNameWithArticle
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7618
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7619
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7620
    "Modified: 13.5.1996 / 12:16:14 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7621
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7622
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7623
errorPrint
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7624
    "if a logger has been defined, let it print the receiver when a CR is coming.
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7625
     Otherwise, print the receiver on the Transcript and Stderr.
10530
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  7626
     The Transcript is directed to the standard error stream on
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  7627
     headless applications."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7628
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7629
    Logger notNil ifTrue:[
25230
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7630
        PartialErrorPrintLine := (PartialErrorPrintLine ? ''), self printString string.
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7631
        ^ self.
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7632
    ].
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7633
    Stderr isNil ifTrue:[
25230
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7634
        "/ the following allows errorPrint to be used during
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7635
        "/ the early init-phase, when no Stderr has been set up.
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7636
        "/ (depends on string to respond to #errorPrint)
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7637
        self printString errorPrint.
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7638
        ^ self.
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7639
    ].
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7640
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7641
    self withErrorStreamDo:[:s | self printOn:s].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7642
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7643
    "Modified: / 21-04-2011 / 12:46:42 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7644
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7645
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7646
errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7647
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7648
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7649
    "if a logger has been defined, let it print the receiver.
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7650
     otherwise, print the receiver followed by a cr on the error stream(s).
10530
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  7651
     The Transcript is directed to the standard error stream on
0f3d3ddd3837 #errorPrint* and #infoPrint* print to Transcript.
Stefan Vogel <sv@exept.de>
parents: 10527
diff changeset
  7652
     headless applications."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7653
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7654
    Logger notNil ifTrue:[
25230
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7655
        |fullLine|
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7656
        fullLine := (PartialErrorPrintLine ? ''), self printString string.
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7657
        PartialErrorPrintLine := nil.
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7658
        Logger error:fullLine.
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7659
        ^ self.
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7660
    ].
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7661
    Stderr isNil ifTrue:[
25230
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7662
        "/ the following allows errorPrintCR to be used during
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7663
        "/ the early init-phase, when no Stderr has been set up.
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7664
        "/ (depends on string to respond to #errorPrintCR)
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7665
        self printString errorPrintCR.
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  7666
        ^ self.
14165
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7667
    ].
b5bb4e9fde8c changed:
Stefan Vogel <sv@exept.de>
parents: 14162
diff changeset
  7668
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7669
    self withErrorStreamDo:[:s | self printOn:s. s cr].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7670
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7671
    "
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7672
     'hello' errorPrintCR
25240
9f07c869d954 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25231
diff changeset
  7673
     'aöäü' errorPrintCR
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7674
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7675
10564
7d25403688ba dont errorPrint on Transcript when I am a system process.
Claus Gittinger <cg@exept.de>
parents: 10558
diff changeset
  7676
    "Created: / 20-05-1996 / 10:20:41 / cg"
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  7677
    "Modified: / 21-04-2011 / 12:47:13 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7678
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7679
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7680
errorPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7681
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7682
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7683
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7684
    "print the receiver followed by a cr on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7685
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7686
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7687
    ^ self errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7688
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7689
    "Modified: 20.5.1996 / 10:24:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7690
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7691
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7692
errorPrintNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7693
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7694
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7695
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7696
    "print the receiver followed by a cr on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7697
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7698
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7699
    self errorPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7700
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7701
    "Modified: 20.5.1996 / 10:24:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7702
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7703
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7704
infoPrint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7705
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7706
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7707
    "if a logger has been defined, let it print the receiver when a CR is coming.
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7708
     otherwise print the receiver on the standard error stream.
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7709
     This is meant for information messages which are not warnings or fatal messages.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7710
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7711
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7712
    Logger notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7713
	PartialInfoPrintLine := (PartialInfoPrintLine ? ''), self printString string.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7714
	^ self.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7715
    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7716
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7717
    InfoPrinting == true ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7718
	self errorPrint
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7719
    ]
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7720
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7721
    "
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7722
     'hello' infoPrint. ' world' infoPrintCR.
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7723
     'foo [info] hello' infoPrintCR.
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7724
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7725
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7726
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7727
infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7728
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7729
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7730
    "if a logger has been defined, let it print the receiver.
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7731
     otherwise print the receiver followed by a cr on the standard error stream.
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7732
     This is meant for information messages which are not warnings or fatal messages.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7733
     These messages can be turned on/off by 'Object infoPrinting:true/false'"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7734
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7735
    Logger notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7736
	|fullLine|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7737
	fullLine := (PartialInfoPrintLine ? ''), self printString string.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7738
	PartialInfoPrintLine := nil.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7739
	Logger info:fullLine.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7740
	^ self.
20493
16e6126eef3c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 20383
diff changeset
  7741
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7742
    InfoPrinting == true ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7743
	self errorPrintCR
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7744
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7745
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7746
    "Created: 20.5.1996 / 10:21:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7747
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7748
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7749
infoPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7750
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7751
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7752
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7753
    "print the receiver followed by a cr on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7754
     Please use #infoPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7756
    ^ self infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7757
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7758
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7759
print
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7760
    "print the receiver on the standard output stream (which is not the Transcript)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7761
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7762
    "/ the following allows print/printCR to be used during
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7763
    "/ the early init-phase, when no Stdout has been set up.
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7764
    "/ (depends on String to respond to #print, without recurring back to here)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7765
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7766
    Stdout isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7767
	self printString utf8Encoded print.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7768
	^ self
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7769
    ].
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7770
    self printOn:Processor activeProcess stdout
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7771
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7772
    "Modified: 4.11.1996 / 23:36:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7773
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7774
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7775
printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7776
    "print the receiver followed by a cr on the standard output stream (which is not the Transcript)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7777
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7778
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7779
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7780
    "/ (depends on string to respond to #printCR)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7781
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7782
    |stdout|
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7783
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7784
    Stdout isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7785
	self printString utf8Encoded printCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  7786
	^ self
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7787
    ].
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7788
    stdout := Processor activeProcess stdout.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7789
    self printOn:stdout.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7790
    stdout cr
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7791
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7792
    "Created: 20.5.1996 / 10:21:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7793
    "Modified: 4.11.1996 / 23:37:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7794
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7795
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7796
printNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7797
    "print the receiver followed by a cr on the standard output stream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7798
     This exists for GNU Smalltalk compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7799
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7800
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7801
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7802
    ^ self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7803
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7804
    "Modified: 20.5.1996 / 10:25:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7805
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7806
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7807
printNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7808
    "print the receiver followed by a cr on the standard output stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7809
     This exists for backward compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7810
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7811
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  7812
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7813
    self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7814
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7815
    "Modified: 20.5.1996 / 10:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7816
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7817
22737
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7818
printNl
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7819
    "print the receiver followed by a cr on the standard output stream
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7820
     This exists for GNU Smalltalk compatibility - please use #printCR."
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7821
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7822
    <resource:#obsolete>
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7823
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7824
    ^ self printCR
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7825
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7826
    "Modified: 20.5.1996 / 10:25:31 / cg"
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7827
!
265707d2dd8a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22722
diff changeset
  7828
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7829
printOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7830
    "append a user printed representation of the receiver to aStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7831
     The format is suitable for a human - not meant to be read back.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7832
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  7833
     The default here is to output the receiver's class name.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7834
     BUT: this method is heavily redefined for objects which
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7835
     can print prettier."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7836
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7837
    self basicPrintOn:aStream.
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7838
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7839
   "
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7840
    (1@2) printOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7841
    (1@2) basicPrintOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  7842
   "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7843
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7844
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7845
printOn:aStream format:format
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
  7846
    "this may be redefined in subclasses.
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7847
     Defined here for compatibility with subclasses"
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7848
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7849
    self printOn:aStream.
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7850
!
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7851
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7852
printOn:aStream leftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7853
    "print the receiver on aStream, padding with spaces up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7854
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7855
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7856
    self printOn:aStream leftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7857
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7858
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7859
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7860
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7861
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7862
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7863
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7864
printOn:aStream leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7865
    "print the receiver on aStream, padding with padCharacters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7866
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7867
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7868
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7869
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7870
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7871
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7872
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7873
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7874
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7875
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7876
printOn:aStream paddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7877
    "print the receiver on aStream, padding with spaces up to size."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7878
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7879
    self printOn:aStream paddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7880
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7881
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7882
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7883
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7884
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7885
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7886
printOn:aStream paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7887
    "print the receiver on aStream, padding with padCharacter up to size"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7888
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7889
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7890
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7891
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7892
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7893
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7894
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7895
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7896
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7897
printOn:aStream zeroPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7898
    "print the receiver on aStream, padding with zeros up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7899
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7900
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7901
    self printOn:aStream paddedTo:size with:$0.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7902
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7903
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7904
     123.0 printOn:Transcript zeroPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7905
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7906
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7907
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7908
printRightAdjustLen:size
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7909
    <resource: #obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7910
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7911
     This method will go away ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7912
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  7913
    (self printStringLeftPaddedTo:size) print
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7914
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7915
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7916
printString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7917
    "return a string for printing the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7918
     Since we now use printOn: as the basic print mechanism,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7919
     we have to create a stream and print into it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7920
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7921
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7922
19340
2e2523f386df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19287
diff changeset
  7923
    "allocate at least 40 bytes for fast UUID conversion.
2e2523f386df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19287
diff changeset
  7924
     cg: who did that? If that's a bottleneck, it ought to be done in UUID, not here!!"
2e2523f386df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19287
diff changeset
  7925
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  7926
    s := CharacterWriteStream on:(String basicNew:40).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7927
    self printOn:s.
8300
d15ead94361f Use CharacterWriteStream in #printString (speedup)
Stefan Vogel <sv@exept.de>
parents: 8287
diff changeset
  7928
    ^ s contents.
7978
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  7929
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  7930
    "
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  7931
     Date today printString.
4ce7575e1cfc care for 16bit chars in #printString
Claus Gittinger <cg@exept.de>
parents: 7838
diff changeset
  7932
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7933
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7934
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7935
printStringFormat:orintFormat
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7936
    "subclasses may redefine this.
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7937
     Defined here to avoid type checks"
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7938
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7939
    ^ self printString
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7940
!
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  7941
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7942
printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7943
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7944
     characters on the left are filled with spaces.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7945
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7946
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7947
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7948
    ^ self printStringLeftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7949
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7950
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7951
     10 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7952
     1 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7953
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7954
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7955
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7956
printStringLeftPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7957
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7958
     characters on the left are filled with spaces.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7959
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7960
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7961
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7962
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7963
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7964
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7965
     12   printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7966
     123  printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7967
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7968
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7969
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7970
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7971
printStringLeftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7972
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7973
     characters on the left are filled with padCharacter.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7974
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7975
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7976
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7977
    ^ (self printString) leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7978
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7979
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7980
     123 printStringLeftPaddedTo:10 with:$.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7981
     1 printStringLeftPaddedTo:10 with:$.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7982
     (Float pi) printStringLeftPaddedTo:20 with:$*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7983
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7984
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7985
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7986
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7987
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7988
     characters on the left are filled with padCharacter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7989
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7990
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7991
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7992
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7993
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7994
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7995
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7996
    ^ s leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7997
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7998
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  7999
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8000
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8001
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8002
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8003
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8004
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8005
printStringLimitedTo:sizeLimit
25186
13abf9897f03 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25165
diff changeset
  8006
    "return a string for printing the receiver, but limit the result string in its size.
13abf9897f03 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25165
diff changeset
  8007
     (i.e. silently truncate the string)"
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8008
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8009
    |s|
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8010
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8011
    s := CharacterWriteStream on:(String basicNew:30).
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8012
    s writeLimit:sizeLimit.
25186
13abf9897f03 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25165
diff changeset
  8013
    WriteError handle:[:ex |
13abf9897f03 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25165
diff changeset
  8014
    ] do:[
13abf9897f03 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25165
diff changeset
  8015
        self printOn:s.
13abf9897f03 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25165
diff changeset
  8016
    ].
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8017
    ^ s contents.
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8018
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8019
    "
25186
13abf9897f03 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25165
diff changeset
  8020
     Date today printStringLimitedTo:5.     
13abf9897f03 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25165
diff changeset
  8021
     '12345678901234567890' printStringLimitedTo:5.   
8576
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8022
    "
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8023
!
f58f51583a34 +printStringLimitedTo:
Claus Gittinger <cg@exept.de>
parents: 8574
diff changeset
  8024
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8025
printStringOnError:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8026
    "return a string for printing the receiver; if any error occurs, return the result from
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8027
     evaluating exceptionBlock. Useful to print something in an exceptionHandler or other
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8028
     cleanup code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8029
21389
fc82fc93f332 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21382
diff changeset
  8030
    ^ [self printString] on:Error do:exceptionBlock.
fc82fc93f332 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21382
diff changeset
  8031
fc82fc93f332 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21382
diff changeset
  8032
    "Modified: / 09-02-2017 / 10:00:59 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8033
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8034
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8035
printStringPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8036
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8037
     padded with spaces (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8038
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8039
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8040
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8041
    ^ self printStringPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8042
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8043
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8044
     123 printStringPaddedTo:10
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8045
     1234567890123456 printStringPaddedTo:10
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8046
     'hello' printStringPaddedTo:10
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8047
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8048
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8049
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8050
printStringPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8051
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8052
     padded with spaces (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8053
     If the resulting printString is too large,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8054
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8055
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8056
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8057
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8058
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8059
     12   printStringPaddedTo:3 ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8060
     123  printStringPaddedTo:3 ifLarger:['***']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8061
     1234 printStringPaddedTo:3 ifLarger:['***']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8062
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8063
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8064
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8065
printStringPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8066
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8067
     padded with padCharacter (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8068
     If the printString is longer than size,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8069
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8070
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8071
    ^ (self printString) paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8072
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8073
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8074
     123  printStringPaddedTo:10 with:$.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8075
     123  printStringPaddedTo:10 with:$*
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8076
     123  printStringPaddedTo:3 with:$*
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8077
     1234 printStringPaddedTo:3 with:$*
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8078
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8079
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8080
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8081
printStringPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8082
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8083
     padded with padCharacter (at the right) up to size.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8084
     If the resulting printString is too large,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8085
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8086
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8087
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8088
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8089
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8090
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8091
    ^ s paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8092
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8093
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8094
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8095
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8096
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8097
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8098
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8099
printStringRightAdjustLen:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8100
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8101
     This method will go away ..."
11068
a5ef673886fd #printOn:format: and #printStringFormat for Date/Time compatibility
Stefan Vogel <sv@exept.de>
parents: 11065
diff changeset
  8102
    <resource: #obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8103
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8104
    ^ self printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8105
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8106
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8107
printStringZeroPaddedTo:size
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8108
    "return a printed representation of the receiver,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8109
     padded with zero (at the right) characters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8110
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8111
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8112
    ^ self printStringPaddedTo:size with:$0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8113
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8114
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8115
     123.0 printStringZeroPaddedTo:10
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8116
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8117
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8118
24692
21348277bc96 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24659
diff changeset
  8119
printfPrintString:format
8287
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  8120
    "fallback to default printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  8121
     (for compatibility with float and integer-printing)"
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  8122
24692
21348277bc96 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24659
diff changeset
  8123
    PrintfScanf notNil ifTrue:[
21348277bc96 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24659
diff changeset
  8124
        ^ PrintfScanf printf:format argument:self
21348277bc96 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24659
diff changeset
  8125
    ].
8287
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  8126
    ^ self printString
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  8127
!
9770f4ad54ff +printfPrintString
werner
parents: 8273
diff changeset
  8128
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8129
store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8130
    "store the receiver on standard output.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8131
     this method is useless, but included for compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8132
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  8133
    self storeOn:Processor activeProcess stdout
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8134
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8135
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8136
storeCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8137
    "store the receiver on standard output; append a carriage return."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8138
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  8139
    |stdout|
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  8140
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  8141
    stdout := Processor activeProcess stdout.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  8142
    self storeOn:stdout.
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  8143
    stdout cr.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8144
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8145
    "Created: 20.5.1996 / 10:26:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8146
    "Modified: 20.5.1996 / 10:26:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8147
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8148
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8149
storeNl
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8150
    "store the receiver on standard output; append a newline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8151
     This method is included for backward compatibility-  use #storeCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8152
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  8153
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  8154
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8155
    self storeCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8156
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8157
    "Modified: 20.5.1996 / 10:26:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8158
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8159
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8160
storeOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8161
    "store the receiver on aStream; i.e. print an expression which will
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8162
     reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8163
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8164
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8165
     Use storeBinaryOn:, which handles these cases correctly."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8166
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8167
    |myClass hasSemi sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8168
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8169
    thisContext isRecursive ifTrue:[
24813
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8170
        RecursiveStoreError raiseRequestWith:self.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8171
        'Object [error]: storeString of self referencing object (' errorPrint.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8172
        self class name errorPrint.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8173
        ')' errorPrintCR.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8174
        aStream nextPutAll:'#("recursive")'.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8175
        ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8176
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8177
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8178
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8179
    aStream nextPut:$(.
24813
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8180
    aStream nextPutAll:myClass name.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8181
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8182
    hasSemi := false.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8183
    myClass isVariable ifTrue:[
24813
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8184
        aStream nextPutAll:' basicNew:'.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8185
        self basicSize printOn:aStream
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8186
    ] ifFalse:[
24813
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8187
        aStream nextPutAll:' basicNew'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8188
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8189
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8190
    sz := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8191
    1 to:sz do:[:i |
24813
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8192
        |ref|
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8193
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8194
        ref := (self instVarAt:i).
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8195
        "/ no need to store nil entries, because the object has been instantiated
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8196
        "/ with basicNew just a moment ago (so the fields are already nil)
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8197
        ref notNil ifTrue:[
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8198
            aStream nextPutAll:' instVarAt:'.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8199
            i printOn:aStream.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8200
            aStream nextPutAll:' put:'.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8201
            ref storeOn:aStream.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8202
            aStream nextPut:$;.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8203
            hasSemi := true
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8204
        ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8205
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8206
    myClass isVariable ifTrue:[
24813
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8207
        sz := self basicSize.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8208
        1 to:sz do:[:i |
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8209
            |ref|
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8210
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8211
            ref := (self basicAt:i).
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8212
            "/ no need to store nil entries, because the object has been instantiated
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8213
            "/ with basicNew just a moment ago (so the fields are already nil)
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8214
            ref notNil ifTrue:[
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8215
                aStream nextPutAll:' basicAt:'.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8216
                i printOn:aStream.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8217
                aStream nextPutAll:' put:'.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8218
                ref storeOn:aStream.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8219
                aStream nextPut:$;.
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8220
                hasSemi := true
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8221
            ]
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8222
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8223
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8224
    hasSemi ifTrue:[
24813
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8225
        aStream nextPutAll:' yourself'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8226
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8227
    aStream nextPut:$).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8228
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8229
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8230
     |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8231
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8232
     s := WriteStream on:(String new).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8233
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8234
     s := ReadStream on:(s contents).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8235
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8236
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8237
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8238
     |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8239
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8240
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8241
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8242
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8243
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8244
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8245
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8246
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8247
16590
c6a17a505282 class: Object
Claus Gittinger <cg@exept.de>
parents: 16588
diff changeset
  8248
    "does not work example (cyclic):"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8249
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8250
     |s a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8251
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8252
     a := Array new:2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8253
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8254
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8255
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8256
     a storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8257
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8258
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8259
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8260
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8261
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8262
13162
dd688290df14 changed: #storeOn:
Claus Gittinger <cg@exept.de>
parents: 13140
diff changeset
  8263
    "Modified: / 03-12-2010 / 13:27:51 / cg"
24813
bf9745bd8c0e #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24737
diff changeset
  8264
    "Modified: / 30-09-2019 / 14:43:42 / Stefan Vogel"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8265
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8266
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8267
storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8268
    "return a string representing an expression to reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8269
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8270
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8271
     Use storeBinaryOn:, which handles these cases correctly."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8273
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8275
    s := WriteStream on:(String new:50).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8276
    self storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8277
    ^ s contents
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  8278
!
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  8279
23659
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8280
transcribe
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8281
    "print the receiver on the Transcript (without CR)"
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8282
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8283
    self printOn:(Processor activeProcess transcript)
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8284
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8285
    "Created: / 03-02-2019 / 13:01:29 / Claus Gittinger"
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8286
!
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8287
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8288
transcribeCR
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8289
    "print the receiver on the Transcript (with CR)"
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8290
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8291
    |out|
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8292
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8293
    out := Processor activeProcess transcript.
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8294
    self printOn:out.
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8295
    out cr.
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8296
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8297
    "
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8298
     1234 transcribe
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8299
     1234 transcribeCR
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8300
    "
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8301
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8302
    "Created: / 03-02-2019 / 13:02:46 / Claus Gittinger"
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8303
!
2a7cd86b3931 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23658
diff changeset
  8304
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  8305
withErrorStreamDo:aBlock
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  8306
    "{ Pragma: +optSpace }"
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  8307
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  8308
    "helper for error messages - evaluate aBlock,
19784
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  8309
     passing it a stream on which to put error messages.
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  8310
     Notice that the block might be called twice,
4b81dcd2d740 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19781
diff changeset
  8311
     to print both on stderr and onto the Transcript"
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  8312
19428
117f7e571ea0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19382
diff changeset
  8313
    |stream stderr activeProcess|
117f7e571ea0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19382
diff changeset
  8314
117f7e571ea0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19382
diff changeset
  8315
    activeProcess := Processor activeProcess.
117f7e571ea0 #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19382
diff changeset
  8316
    stderr := activeProcess stderr.
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  8317
16383
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  8318
    "CG: care for standalone non-GUI progs, which have no userPreferences class"
4cb54426f3c0 class: Object
Claus Gittinger <cg@exept.de>
parents: 16378
diff changeset
  8319
    (Smalltalk isInitialized
22184
ad22e7f99345 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22176
diff changeset
  8320
     and:[UserPreferences notNil
ad22e7f99345 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22176
diff changeset
  8321
     and:[UserPreferences current sendMessagesAlsoToTranscript]]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8322
	stream := activeProcess isSystemProcess
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8323
			    ifTrue:[stderr]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8324
			    ifFalse:[activeProcess transcript].
16378
d88d0cc60491 class: Object
Claus Gittinger <cg@exept.de>
parents: 16349
diff changeset
  8325
    ].
d88d0cc60491 class: Object
Claus Gittinger <cg@exept.de>
parents: 16349
diff changeset
  8326
    stream notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8327
	StreamError catch:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8328
	    aBlock value:stream.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8329
	].
19382
a471e303346c #FEATURE
Claus Gittinger <cg@exept.de>
parents: 19340
diff changeset
  8330
    ].
22184
ad22e7f99345 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22176
diff changeset
  8331
ad22e7f99345 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22176
diff changeset
  8332
    (stream ~~ stderr
ad22e7f99345 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22176
diff changeset
  8333
     and:[stderr notNil
ad22e7f99345 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22176
diff changeset
  8334
     and:[UserPreferences current sendMessagesOnlyToTranscript not]]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8335
	StreamError catch:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8336
	    aBlock value:stderr.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8337
	].
13350
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  8338
    ].
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  8339
8c7603161369 added: #withErrorStreamDo:
Claus Gittinger <cg@exept.de>
parents: 13320
diff changeset
  8340
    "Created: / 21-04-2011 / 12:46:21 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8341
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8342
24025
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8343
!Object methodsFor:'private array element printing'!
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8344
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8345
displayArrayElementOn:aStream
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8346
    "Display myself as an Array element on aStream.
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8347
     Subclasses may redefine this to omit a leading '#'"
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8348
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8349
    ^ self displayOn:aStream
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8350
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8351
    "Created: / 29-03-2019 / 12:01:32 / stefan"
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8352
!
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8353
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8354
printArrayElementOn:aStream
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8355
    "Print myself as an Array element.
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8356
     Subclasses may redefine this to omit a leading '#'"
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8357
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8358
    ^ self printOn:aStream
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8359
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8360
    "Created: / 29-03-2019 / 11:55:06 / stefan"
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8361
!
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8362
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8363
storeArrayElementOn:aStream
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8364
    "store an object as an Array element.
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8365
     Subclasses may redefine this to omit a leading '#'"
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8366
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8367
    ^ self storeOn:aStream
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8368
! !
6337612d7653 #UI_ENHANCEMENT by stefan
Stefan Vogel <sv@exept.de>
parents: 23875
diff changeset
  8369
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8370
!Object methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8371
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8372
basicSize
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8373
    "return the number of the receiver's indexed instance variables,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8374
     0 if it has none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8375
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8376
     This method should NOT be redefined in any subclass (except with great care, for tuning)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8377
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8378
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  8379
#ifdef __SCHTEAM__
18404
ae9230dde5ca comments
Claus Gittinger <cg@exept.de>
parents: 18371
diff changeset
  8380
    return context._RETURN( STInteger._new( self.basicSize() ) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8381
#else
8909
485a8e3153e0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8901
diff changeset
  8382
    REGISTER INT nbytes;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8383
    REGISTER OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8384
    int nInstBytes;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8385
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8386
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8387
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8388
     * this can be done since basicSize is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8389
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8390
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8391
    myClass = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8392
    nbytes = __qSize(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8393
    nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8394
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8395
    switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8396
	case __MASKSMALLINT(POINTERARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8397
	case __MASKSMALLINT(WKPOINTERARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8398
	    nbytes -= nInstBytes;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8399
	    RETURN ( __mkSmallInteger(__BYTES2OBJS__(nbytes)) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8400
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8401
	case __MASKSMALLINT(BYTEARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8402
	    nbytes -= nInstBytes;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8403
	    RETURN ( __mkSmallInteger(nbytes / sizeof(char)) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8404
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8405
	case __MASKSMALLINT(FLOATARRAY):
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  8406
# ifdef __NEED_FLOATARRAY_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8407
	    nInstBytes = (nInstBytes-1+__FLOATARRAY_ALIGN) &~ (__FLOATARRAY_ALIGN-1);
20303
060fea1cfebe fixes for float/doubleArray alignemnt
Claus Gittinger <cg@exept.de>
parents: 20253
diff changeset
  8408
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8409
	    nbytes -= nInstBytes;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8410
	    RETURN ( __mkSmallInteger(nbytes / sizeof(float)) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8411
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8412
	case __MASKSMALLINT(DOUBLEARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8413
# ifdef __NEED_DOUBLE_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8414
	    nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8415
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8416
	    nbytes -= nInstBytes;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8417
	    RETURN ( __mkSmallInteger(nbytes / sizeof(double)) );
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8418
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8419
	case __MASKSMALLINT(WORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8420
	case __MASKSMALLINT(SWORDARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8421
	    nbytes -= nInstBytes;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8422
	    RETURN ( __mkSmallInteger(nbytes>>1) ); /* notice the hardcoded 2 here - not sizeof(short) */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8423
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8424
	case __MASKSMALLINT(LONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8425
	case __MASKSMALLINT(SLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8426
	    nbytes -= nInstBytes;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8427
	    RETURN ( __mkSmallInteger(nbytes>>2) ); /* notice the hardcoded 4 here - not sizeof(int) */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8428
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8429
	case __MASKSMALLINT(LONGLONGARRAY):
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8430
	case __MASKSMALLINT(SLONGLONGARRAY):
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8431
# ifdef __NEED_LONGLONG_ALIGN
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8432
	    nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8433
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8434
	    nbytes -= nInstBytes;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8435
	    RETURN ( __mkSmallInteger(nbytes>>3) ); /* notice the hardcoded 8 here - not sizeof(long long) */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8436
    }
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  8437
#endif /* not __SCHTEAM__ */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8438
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8439
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8440
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8441
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8442
byteSize
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8443
    "return the number of bytes in the receiver's indexed instance variables,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8444
     0 if it has none. This only returns non-zero for non-pointer indexed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8445
     instvars i.e. byteArrays, wordArrays etc.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8446
     Notice: for Strings the returned size may look strange.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8447
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8448
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8449
    |myClass|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8450
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8451
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8452
    myClass isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8453
	myClass isPointers ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8454
	    myClass isBytes ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8455
		^ self basicSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8456
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8457
	    myClass isWords ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8458
		^ self basicSize * 2.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8459
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8460
	    myClass isSignedWords ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8461
		^ self basicSize * 2.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8462
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8463
	    myClass isLongs ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8464
		^ self basicSize * 4.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8465
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8466
	    myClass isSignedLongs ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8467
		^ self basicSize * 4.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8468
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8469
	    myClass isLongLongs ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8470
		^ self basicSize * 8.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8471
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8472
	    myClass isSignedLongLongs ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8473
		^ self basicSize * 8.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8474
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8475
	    myClass isFloats ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8476
		^ self basicSize * (ExternalBytes sizeofFloat)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8477
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8478
	    myClass isDoubles ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8479
		^ self basicSize * (ExternalBytes sizeofDouble)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8480
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8481
	    self error:'unknown variable size class species'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8482
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8483
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8484
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8486
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8487
     Point new byteSize
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  8488
     'hello' byteSize
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
  8489
     'hello' asUnicode16String byteSize
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8490
     (ByteArray with:1 with:2) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8491
     (FloatArray with:1.5) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8492
     (DoubleArray with:1.5) byteSize
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8493
     (WordArray with:1 with:2) byteSize
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8494
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8495
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8497
class
19679
c5eec12206f6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19646
diff changeset
  8498
    "return the receiver's class"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8499
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8500
%{  /* NOCONTEXT */
18240
28af09029a8b ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents: 18238
diff changeset
  8501
#ifdef __SCHTEAM__
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8502
    return context._RETURN(self.clazz());
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8503
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8504
    RETURN ( __Class(self) );
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8505
#endif
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8506
%}
19679
c5eec12206f6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19646
diff changeset
  8507
c5eec12206f6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19646
diff changeset
  8508
    "Modified (comment): / 30-04-2016 / 15:51:17 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8509
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8510
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8511
respondsTo:aSelector
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8512
    "return true if the receiver responds to a message with aSelector;
22521
eed49735fed0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22520
diff changeset
  8513
     i.e. if there is a method for aSelector in either the
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8514
     receiver's class or one of its superclasses.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8515
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8516
     Notice, that this does not imply, that such a message can be sent without
22521
eed49735fed0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22520
diff changeset
  8517
     an error being raised; for example, an implementation could send
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8518
     #shouldNotImplement or #subclassResponsibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8519
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8520
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8521
     should we go via the cache, or search (by class) ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8522
     The first is faster, most of the time; while the 2nd fills
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8523
     the cache with useless data if this is sent in a loop over all objects.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8524
     For now, use the cache ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8525
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8526
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8527
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8528
    if (__lookup(__Class(self), aSelector) == nil) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8529
	RETURN ( false );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8530
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8531
    RETURN ( true );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8532
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8533
.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8534
    ^ self class canUnderstand:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8535
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8536
22521
eed49735fed0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22520
diff changeset
  8537
    "
eed49735fed0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22520
diff changeset
  8538
     'aString' respondsTo:#+
eed49735fed0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22520
diff changeset
  8539
     'aString' respondsTo:#,
eed49735fed0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22520
diff changeset
  8540
     'aString' respondsTo:#collect:
eed49735fed0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22520
diff changeset
  8541
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8542
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8543
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8544
respondsToArithmetic
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  8545
    "return true if the receiver responds to arithmetic messages.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8546
     false is returned here - the method is redefined in ArithmeticValue."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8547
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8548
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8549
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8550
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8551
size
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8552
    "return the number of the receiver's indexed instance variables;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8553
     this method may be redefined in subclasses"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8554
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8555
    ^ self basicSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8556
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8557
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8558
species
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  8559
    "return a class which is similar to (or the same as) the receiver's class.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8560
     This is used to create an appropriate object when creating derived
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8561
     copies in the collection classes (sometimes redefined)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8562
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8563
    ^ self class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8564
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8565
22912
c3476aa5226b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22737
diff changeset
  8566
speciesForCompare
c3476aa5226b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22737
diff changeset
  8567
    "return a class to determine if two objects can be compared.
23417
c00a7d62d686 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23416
diff changeset
  8568
     The fallback here is my species; only redefined by some timestamp classes.
c00a7d62d686 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23416
diff changeset
  8569
     FIXME: not all classes (actually currently only one) use this in their #= method
c00a7d62d686 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23416
diff changeset
  8570
     (i.e. it needs to be done eg in Dictionary as well)"
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8571
22912
c3476aa5226b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22737
diff changeset
  8572
    ^ self species
23417
c00a7d62d686 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23416
diff changeset
  8573
c00a7d62d686 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23416
diff changeset
  8574
    "Modified (comment): / 10-10-2018 / 18:22:05 / Claus Gittinger"
22912
c3476aa5226b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22737
diff changeset
  8575
!
c3476aa5226b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22737
diff changeset
  8576
16401
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  8577
speciesForCopy
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  8578
    "return a class which is the receiver's class, except for readonly objects,
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  8579
     such as immutable collections.
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  8580
     This is only to be used by copy methods"
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  8581
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  8582
    ^ self class
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  8583
!
ae4c51e826cb class: Object
Claus Gittinger <cg@exept.de>
parents: 16383
diff changeset
  8584
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8585
yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8586
    "return the receiver - used for cascades to return self at the end"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8587
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8588
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8589
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8590
25046
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
  8591
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8592
!Object methodsFor:'secure message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8593
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8594
?:selector
13099
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8595
    "try to send a message to the receiver;
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8596
     if understood, return the value;
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8597
     if not, return nil."
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
  8598
13099
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8599
    ^ self perform:selector ifNotUnderstood:nil
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8600
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8601
    "
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8602
     ApplicationModel new masterApplication resources first             - error
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8603
     ApplicationModel new ?: #masterApplication ?: #resources ?: #first - nil
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8604
    "
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8605
    "Modified: / 20-10-2010 / 10:45:21 / cg"
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8606
!
fdcece3bda6c added: #?:
Claus Gittinger <cg@exept.de>
parents: 13039
diff changeset
  8607
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8608
askFor:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8609
    "try to send the receiver the message, aSelector.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8610
     If it does not understand it, return false.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8611
     Otherwise the real value returned.
11398
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8612
     Useful to send messages such as: #isColor to unknown receivers."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8613
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8614
    ^ self perform:aSelector ifNotUnderstood:[false]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8615
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8616
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8617
     1 askFor:#isColor
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8618
     Color red askFor:#isColor
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8619
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8620
     1 askFor:#isFoo
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8621
     Color red askFor:#isFoo
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8622
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8623
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8624
11398
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8625
askFor:aSelector with:argument
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8626
    "try to send the receiver the message, aSelector.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8627
     If it does not understand it, return false.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8628
     Otherwise the real value returned.
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8629
     Useful to send messages such as: #isXXX: to unknown receivers."
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8630
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8631
    ^ self perform:aSelector with:argument ifNotUnderstood:[false]
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8632
!
1f006dd241a7 +askFor:with:
Claus Gittinger <cg@exept.de>
parents: 11366
diff changeset
  8633
11401
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8634
askFor:aSelector with:arg1 with:arg2
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8635
    "try to send the receiver the message, aSelector.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8636
     If it does not understand it, return false.
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8637
     Otherwise the real value returned.
24834
f67a0e9f14d1 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24817
diff changeset
  8638
     Useful to send messages such as: #handlesPointerLeave:inView: to unknown receivers."
11401
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8639
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8640
    ^ self perform:aSelector with:arg1 with:arg2 ifNotUnderstood:[false]
24834
f67a0e9f14d1 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24817
diff changeset
  8641
f67a0e9f14d1 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24817
diff changeset
  8642
    "Modified (comment): / 15-10-2019 / 14:49:33 / Stefan Vogel"
11401
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8643
!
78104cb2fba3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11398
diff changeset
  8644
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8645
perform:aSelector ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8646
    "try to send message aSelector to the receiver.
21432
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8647
     If it's understood, return the method's returned value,
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8648
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8649
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8650
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8651
     checked-message send. However, this method is more specific,
25379
609d492f29a7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25252
diff changeset
  8652
     in that only errors for the given selector and this receiver are caught - not any other
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8653
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8654
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8655
    ^ [
25379
609d492f29a7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25252
diff changeset
  8656
        self perform:aSelector.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8657
    ] on:MessageNotUnderstood do:[:ex |
25379
609d492f29a7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25252
diff changeset
  8658
        "/ reject, if the bad message is not the one
609d492f29a7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25252
diff changeset
  8659
        "/ we have sent originally
609d492f29a7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25252
diff changeset
  8660
        (ex selector == aSelector and:[ex receiver == self]) ifFalse:[
609d492f29a7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25252
diff changeset
  8661
            ex reject
609d492f29a7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25252
diff changeset
  8662
        ].
609d492f29a7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25252
diff changeset
  8663
        exceptionBlock value
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8664
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8665
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8666
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8667
     1.2345 perform:#foo ifNotUnderstood:['sorry']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8668
     1.2345 perform:#sqrt ifNotUnderstood:['sorry']
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8669
     12345 perform:#sqrt ifNotUnderstood:['sorry']
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8670
    "
21432
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8671
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8672
    "Modified: / 15-03-2017 / 17:05:58 / stefan"
25379
609d492f29a7 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 25252
diff changeset
  8673
    "Modified (comment): / 03-05-2020 / 13:19:31 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8674
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8675
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8676
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8677
    "try to send message aSelector to the receiver.
21432
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8678
     If it's understood, return the method's returned value,
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8679
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8680
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8681
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8682
     checked-message send. However, this method is more specific,
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  8683
     in that only errors for the given selector are caught - not any other
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8684
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8685
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8686
    ^ [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8687
	self perform:aSelector with:argument.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8688
    ] on:MessageNotUnderstood do:[:ex |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8689
	"/ reject, if the bad message is not the one
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8690
	"/ we have sent originally
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8691
	(ex selector == aSelector and:[ex receiver == self]) ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8692
	    ex reject
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8693
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8694
	exceptionBlock value
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8695
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8696
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8697
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8698
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8699
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8700
     unknown := 4.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8701
     Transcript showCR:(unknown perform:#- with:2 ifNotUnderstood:['sorry']).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8702
     unknown := 'high there'.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8703
     Transcript showCR:(unknown perform:#- with:2 ifNotUnderstood:['sorry']) printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8704
    "
21432
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8705
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8706
    "Modified (comment): / 13-02-2017 / 20:27:41 / cg"
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8707
    "Modified (comment): / 15-03-2017 / 17:08:01 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8708
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8709
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8710
perform:aSelector with:arg1 with:arg2 ifNotUnderstood:exceptionBlock
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8711
    "try to send message aSelector to the receiver.
21432
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8712
     If it's understood, return the method's returned value,
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8713
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8714
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8715
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8716
     checked-message send. However, this method is more specific,
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  8717
     in that only errors for the given selector are caught - not any other
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8718
     doesNotUnderstand, and especially not any other error."
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8719
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8720
    ^ [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8721
	self perform:aSelector with:arg1 with:arg2.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8722
    ] on:MessageNotUnderstood do:[:ex |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8723
	"/ reject, if the bad message is not the one
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8724
	"/ we have sent originally
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8725
	(ex selector == aSelector and:[ex receiver == self]) ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8726
	    ex reject
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8727
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8728
	exceptionBlock value
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8729
    ].
21432
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8730
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8731
    "Modified (comment): / 13-02-2017 / 20:27:44 / cg"
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8732
    "Modified: / 15-03-2017 / 17:09:12 / stefan"
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8733
!
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  8734
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8735
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8736
    "try to send message aSelector to the receiver.
21432
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8737
     If it's understood, return the method's returned value,
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8738
     otherwise return the value of the exceptionBlock.
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8739
     Read this:
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8740
     Many programmers do an Error-handle to perform a similar
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8741
     checked-message send. However, this method is more specific,
16560
Claus Gittinger <cg@exept.de>
parents: 16470
diff changeset
  8742
     in that only errors for the given selector are caught - not any other
12157
114823c8f3b0 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 12050
diff changeset
  8743
     doesNotUnderstand, and especially not any other error."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8744
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8745
    ^ [
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8746
	self perform:aSelector withArguments:argumentArray.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8747
    ] on:MessageNotUnderstood do:[:ex |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8748
	"/ reject, if the bad message is not the one
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8749
	"/ we have sent originally
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8750
	(ex selector == aSelector and:[ex receiver == self]) ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8751
	    ex reject
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8752
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8753
	exceptionBlock value
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8754
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8756
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8757
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8758
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  8759
     unknown := 4.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8760
     Transcript showCR:(unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8761
     unknown := 'high there'.
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8762
     Transcript showCR:(unknown perform:#- withArguments:#(2) ifNotUnderstood:['sorry']).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8763
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8764
21432
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8765
    "Modified: / 27-03-1997 / 14:13:16 / cg"
9feea9e360ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21389
diff changeset
  8766
    "Modified (comment): / 13-02-2017 / 20:27:46 / cg"
21646
efbec3f0a85f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21528
diff changeset
  8767
    "Modified: / 15-03-2017 / 17:10:27 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8768
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8769
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8770
!Object methodsFor:'signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8771
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8772
messageNotUnderstoodSignal
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  8773
    ^ MessageNotUnderstood
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8774
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8775
    "Created: 6.3.1997 / 15:46:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8776
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8777
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8778
!Object methodsFor:'special queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8779
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8780
allOwners
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8781
    "return a collection of all objects referencing the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8782
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8783
    ^ ObjectMemory whoReferences:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8784
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8785
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8786
references:anObject
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  8787
    "return true if the receiver refers to the argument, anObject.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8788
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8789
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  8790
    ^ self referencesObject:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8791
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8792
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8793
     |v|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8794
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8795
     v := View new initialize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8796
     v references:Display.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8797
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8798
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8799
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8800
referencesAny:aCollection
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  8801
    "return true if the receiver refers to any object from
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8802
     the argument, aCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8803
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8804
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8805
%{
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8806
    OBJ cls, flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8807
    int nInsts, inst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8808
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8809
    if (! __isNonNilObject(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8810
	RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8811
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8812
8934
32a063645991 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8930
diff changeset
  8813
    if (__isArrayLike(aCollection)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8814
	int nObjs = __arraySize(aCollection);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8815
	char *minAddr = 0, *maxAddr = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8816
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8817
	if (nObjs == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8818
	    RETURN (false);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8819
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8820
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8821
	cls = __qClass(self);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8822
	flags = __ClassInstPtr(cls)->c_flags;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8823
	if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8824
	    nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8825
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8826
	    nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8827
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8828
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8829
	if (nObjs == 1) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8830
	    /* better reverse the loop */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8831
	    OBJ anObject = __arrayVal(aCollection)[0];
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8832
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8833
	    if (anObject == cls) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8834
		RETURN(true);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8835
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8836
	    if (! nInsts) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8837
		RETURN (false);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8838
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8839
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8840
	    if ((__qSpace(self) <= OLDSPACE)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8841
		    && !__isRemembered(self)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8842
		    && __isNonNilObject(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8843
		int spc = __qSpace(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8844
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8845
		if ((spc == NEWSPACE) || (spc == SURVSPACE)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8846
		    RETURN(false);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8847
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8848
	    }
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  8849
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8850
# if defined(memsrch4)
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8851
	    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8852
		RETURN (true);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8853
	    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8854
# else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8855
	    for (inst=0; inst<nInsts; inst++) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8856
		if ((__InstPtr(self)->i_instvars[inst]) == anObject) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8857
		    RETURN (true);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8858
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8859
	    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8860
# endif
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8861
	    RETURN (false);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8862
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8863
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8864
	/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8865
	 * a little optimization: use the fact that all old objects
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8866
	 * refering to a new object are on the remSet; if I am not,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8867
	 * a trivial reject is possible, if all objects are newbees.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8868
	 * as a side effect, gather min/max addresses
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8869
	 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8870
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8871
	    int allNewBees = 1;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8872
	    int i;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8873
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8874
	    minAddr = (char *)(__arrayVal(aCollection)[0]);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8875
	    maxAddr = minAddr;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8876
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8877
	    for (i=0; i<nObjs; i++) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8878
		OBJ anObject = __arrayVal(aCollection)[i];
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8879
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8880
		if (__isNonNilObject(anObject)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8881
		    int spc = __qSpace(anObject);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8882
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8883
		    if ((spc != NEWSPACE) && (spc != SURVSPACE)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8884
			allNewBees = 0;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8885
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8886
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8887
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8888
		if ((char *)anObject < minAddr) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8889
		    minAddr = (char *)anObject;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8890
		} else if ((char *)anObject > maxAddr) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8891
		    maxAddr = (char *)anObject;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8892
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8893
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8894
	    if (allNewBees) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8895
		RETURN (false);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8896
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8897
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8898
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8899
	/*
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8900
	 * fetch min/max in searchList (if not already done above)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8901
	 */
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8902
	if (minAddr == 0) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8903
	    int i;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8904
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8905
	    for (i=0; i<nObjs; i++) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8906
		char  *anObject = (char *)__arrayVal(aCollection)[i];
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8907
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8908
		if (anObject < minAddr) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8909
		    minAddr = anObject;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8910
		} else if (anObject > maxAddr) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8911
		    maxAddr = anObject;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8912
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8913
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8914
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8915
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8916
	if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) {
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8917
# if defined(memsrch4)
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8918
	    if (memsrch4(__arrayVal(aCollection), (INT)cls, nObjs)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8919
		RETURN (true);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8920
	    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8921
# else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8922
	    int i;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8923
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8924
	    for (i=0; i<nObjs; i++) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8925
		if (cls == __arrayVal(aCollection)[i]) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8926
		    RETURN (true);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8927
		}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8928
	    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8929
# endif /* memsrch4 */
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8930
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8931
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8932
	for (inst=0; inst<nInsts; inst++) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8933
	    OBJ instVar = __InstPtr(self)->i_instvars[inst];
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8934
	    int i;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8935
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8936
	    if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) {
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8937
# if defined(memsrch4)
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8938
		if (memsrch4(__arrayVal(aCollection), (INT)instVar, nObjs)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8939
		    RETURN (true);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8940
		}
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8941
# else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8942
		for (i=0; i<nObjs; i++) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8943
		    if (instVar == __arrayVal(aCollection)[i]) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8944
			RETURN (true);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8945
		    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8946
		}
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  8947
# endif /* memsrch4 */
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8948
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8949
	}
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8950
	RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8951
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8952
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8953
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8954
    aCollection do:[:el |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8955
	(self referencesObject:el) ifTrue:[^ true].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8956
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8957
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8958
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8959
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8960
referencesDerivedInstanceOf:aClass
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  8961
    "return true if the receiver refers to an instance of
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8962
     the argument, aClass or its subclass. This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8963
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8964
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8965
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8966
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8967
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8968
    "check the class"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8969
    (self isKindOf:aClass) ifTrue:[^ true].
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
  8970
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8971
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8972
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8973
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8974
    1 to:numInst do:[:i |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8975
	((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8976
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8977
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8978
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8979
    myClass isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8980
	myClass isPointers ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8981
	    "no need to search in non pointer fields"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8982
	    ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8983
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8984
	numInst := self basicSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8985
	1 to:numInst do:[:i |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8986
	    ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  8987
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8988
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8989
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8990
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8991
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8992
     (1 @ 3.4) referencesDerivedInstanceOf:Number
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8993
     (1 @ 3.4) referencesDerivedInstanceOf:Array
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  8994
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8995
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8996
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8997
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8998
referencesForWhich:checkBlock do:actionBlock
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  8999
    |myClass inst
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9000
     numInst "{ Class: SmallInteger }" |
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9001
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9002
    myClass := self class.
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9003
    "check the instance variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9004
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9005
    1 to:numInst do:[:i |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9006
	inst := self instVarAt:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9007
	(checkBlock value:inst) ifTrue:[actionBlock value:inst].
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9008
    ].
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9009
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9010
    "check the indexed variables"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9011
    myClass isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9012
	myClass isPointers ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9013
	    "no need to search in non pointer fields"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9014
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9015
	    numInst := self basicSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9016
	    1 to:numInst do:[:i |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9017
		inst := self basicAt:i.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9018
		(checkBlock value:inst) ifTrue:[actionBlock value:inst].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9019
	    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9020
	]
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9021
    ].
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9022
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9023
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9024
     (1 @ 3.4) referencesForWhich:[:i | i isFloat] do:[:i | Transcript showCR:i]
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9025
    "
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9026
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
  9027
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9028
referencesInstanceOf:aClass
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9029
    "return true if the receiver refers to an instance of
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9030
     the argument, aClass.This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9031
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9032
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9033
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9034
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9035
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9036
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9037
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9038
    "check the class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9039
    (myClass isMemberOf:aClass) ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9040
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9041
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9042
    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9043
    1 to:numInst do:[:i |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9044
	((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9045
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9046
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9047
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9048
    myClass isVariable ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9049
	myClass isPointers ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9050
	    "no need to search in non-pointer indexed fields"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9051
	    myClass isLongs ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9052
		(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9053
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9054
		myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9055
		^ aClass == SmallInteger
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9056
	    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9057
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9058
	numInst := self basicSize.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9059
	1 to:numInst do:[:i |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9060
	    ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9061
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9062
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9063
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9064
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9065
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9066
     (1 @ 3.4) referencesInstanceOf:Float
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9067
     (1 @ 3.4) referencesInstanceOf:Fraction
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9068
     View new initialize referencesInstanceOf:(Display class)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9069
    "
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9070
!
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9071
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9072
referencesObject:anObject
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9073
    "return true if the receiver refers to the argument, anObject.
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9074
     - for debugging only"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9075
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9076
%{  /* NOCONTEXT */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9077
    OBJ cls, flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9078
    int nInsts, i;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9079
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9080
    if (! __isNonNilObject(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9081
	RETURN (false);
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9082
    }
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9083
    cls = __qClass(self);
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9084
    if (cls == anObject) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9085
	RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9086
    }
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9087
    flags = __ClassInstPtr(cls)->c_flags;
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9088
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9089
	nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9090
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9091
	nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9092
    }
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9093
    if (! nInsts) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9094
	RETURN (false);
16325
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9095
    }
aea5ba9d95a9 class: Object
Stefan Vogel <sv@exept.de>
parents: 16311
diff changeset
  9096
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9097
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9098
    /*
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9099
     * a little optimization: use the fact that all old objects
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9100
     * refering to a new object are on the remSet; if I am not,
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9101
     * a trivial reject is possible, if anObject is a newbee
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9102
     */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9103
    if (__isNonNilObject(anObject)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9104
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9105
	    int spc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9106
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9107
	    if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9108
		RETURN (false);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9109
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9110
	}
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9111
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9112
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  9113
# if defined(memsrch4)
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9114
    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9115
	RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9116
    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  9117
# else
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9118
    for (i=0; i<nInsts; i++) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9119
	if (__InstPtr(self)->i_instvars[i] == anObject) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9120
	    RETURN (true);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9121
	}
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9122
    }
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  9123
# endif /* memsrch4 */
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9124
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9125
%}.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9126
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9127
"/    |myClass
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9128
"/     numInst "{ Class: SmallInteger }" |
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9129
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9130
"/    myClass := self class.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9131
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9132
"/    "check the class"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9133
"/    (myClass == anObject) ifTrue:[^ true].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9134
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9135
"/    "check the instance variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9136
"/    numInst := myClass instSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9137
"/    1 to:numInst do:[:i |
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9138
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9139
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9140
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9141
"/    "check the indexed variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9142
"/    myClass isVariable ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9143
"/      myClass isPointers ifFalse:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9144
"/          "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9145
"/          "/ we could argue about the following unconditional return:
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9146
"/          "/ it says that a non pointer array never has a reference to the
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9147
"/          "/ corresponding object - not mimicing a reference to a copy of the
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9148
"/          "/ integer. However, it avoids useless searches in huge byteArray
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9149
"/          "/ like objects when searching for owners. If in doubt, remove it.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9150
"/          "/ A consequence of the return below is that #[1 2 3] will say that it
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9151
"/          "/ does not refer to the number 2 (think of keeping a copy instead)
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9152
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9153
"/          ^ false.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9154
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9155
"/          "/ alternative:
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9156
"/          "/  anObject isNumber ifFalse:[^ false].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9157
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9158
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9159
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9160
"/      "/ because arrays are so common, and those have a highly tuned
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9161
"/      "/ idenitytIndex method, use it
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9162
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9163
"/      myClass == Array ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9164
"/          ^ (self identityIndexOf:anObject) ~~ 0
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9165
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9166
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9167
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9168
"/      "/ otherwise, do it the slow way
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9169
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9170
"/      numInst := self basicSize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9171
"/      1 to:numInst do:[:i |
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9172
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9173
"/      ]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9174
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9175
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9176
    ^ false
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9177
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9178
    "
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9179
     |v|
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9180
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9181
     v := View new initialize.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9182
     v references:Display.
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  9183
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9184
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9185
25230
ccd7091812e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 25186
diff changeset
  9186
22011
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9187
!Object methodsFor:'splitting & joining'!
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9188
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9189
split:aSequenceableCollection
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9190
    "treating the receiver as a splitter,
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9191
     split aSequenceableCollection accordingly and return a collection of fragments."
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9192
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9193
    | result |
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9194
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9195
    result := OrderedCollection new:(aSequenceableCollection size // 2).
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9196
    self split:aSequenceableCollection do:[:item |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9197
	result add:item
22011
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9198
    ].
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9199
    ^ result
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9200
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9201
    "
23243
e04d4a19c021 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 23221
diff changeset
  9202
     0 split:#(1 2 3 0 4 5 6 0 7 8 9)
e04d4a19c021 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 23221
diff changeset
  9203
     Character space split: 'hello world'
22011
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9204
     ' ' split: 'hello world'
23454
4d4b9bd174b3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23417
diff changeset
  9205
4d4b9bd174b3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23417
diff changeset
  9206
     $a split:'abacadae'
4d4b9bd174b3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23417
diff changeset
  9207
     'aa' split:'abaacaadaae'
4d4b9bd174b3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23417
diff changeset
  9208
     [:ch | ch == $a] split:'abaacaadaae'
4d4b9bd174b3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23417
diff changeset
  9209
     ('a+' asRegex) split:'abaacaadaae'
22011
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9210
    "
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9211
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9212
    "Created: / 13-07-2017 / 17:23:55 / cg"
23243
e04d4a19c021 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 23221
diff changeset
  9213
    "Modified (comment): / 30-07-2018 / 08:59:28 / Stefan Vogel"
22011
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9214
!
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9215
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9216
split:aCollection do:aBlock
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9217
    "treating the receiver as a splitter,
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9218
     split aSequenceableCollection accordingly and evaluate aBlock for each fragment."
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9219
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9220
    self split:aCollection indicesDo:[:start :stop |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9221
	aBlock value:(aCollection copyFrom:start to:stop)
22011
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9222
    ].
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9223
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9224
    "
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9225
     ' ' split: 'hello world' do: [:frag | Transcript showCR:frag ]
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9226
    "
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9227
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9228
    "Created: / 13-07-2017 / 16:43:28 / cg"
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9229
    "Modified (comment): / 13-07-2017 / 18:11:53 / cg"
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9230
!
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9231
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9232
split:aCollection indicesDo:aTwoArgBlock
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9233
    "treating the receiver as a splitter,
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9234
     split aSequenceableCollection accordingly and evaluate aBlock for each pair of start-
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9235
     and stop index."
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9236
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9237
    |position oldPosition|
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9238
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9239
    position := 1.
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9240
    oldPosition := position.
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9241
    position := aCollection indexOf:self startingAt:position.
23243
e04d4a19c021 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 23221
diff changeset
  9242
    [position ~~ 0] whileTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9243
	aTwoArgBlock value:oldPosition value:position-1.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9244
	position := position + 1.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9245
	oldPosition := position.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9246
	position := aCollection indexOf:self startingAt:position.
22011
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9247
    ].
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9248
    aTwoArgBlock value:oldPosition value:aCollection size
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9249
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9250
    "
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9251
     1 split:#(10 1 20 30 40 1 50 60 1 70) do: [:frag | Transcript showCR:frag ]
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9252
     1 split:#(10 1 20 30 40 1 50 60 1 70) indicesDo: [:start :stop | Transcript show:start; show:' to '; showCR:stop ]
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9253
22011
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9254
     nil split:#(10 nil 20 30 40 nil 50 60 nil 70) do: [:frag | Transcript showCR:frag ]
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9255
     nil split:#(10 nil 20 30 40 nil 50 60 nil 70) indicesDo: [:start :stop | Transcript show:start; show:' to '; showCR:stop ]
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9256
    "
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9257
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9258
    "Created: / 13-07-2017 / 18:12:34 / cg"
23243
e04d4a19c021 #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 23221
diff changeset
  9259
    "Modified: / 30-07-2018 / 09:02:13 / Stefan Vogel"
22011
4feefa83e27c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22008
diff changeset
  9260
! !
21389
fc82fc93f332 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 21382
diff changeset
  9261
25046
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
  9262
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9263
!Object methodsFor:'synchronized evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9264
25252
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9265
ensureSynchronizationSemaphore
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9266
    "return the synchronizationSemaphore.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9267
     Create it save if no one exists yet"
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9268
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9269
    |sema wasBlocked|
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9270
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9271
    "/ instead of using another lock to assign the lock,
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9272
    "/ we block interrupts for a short time period. This is faster.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9273
    wasBlocked := OperatingSystem blockInterrupts.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9274
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9275
    sema := self synchronizationSemaphore.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9276
    sema isNil ifTrue:[
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9277
        sema := RecursionLock name:self className.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9278
        self synchronizationSemaphore:sema.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9279
    ].
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9280
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9281
    wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9282
    ^ sema
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9283
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9284
    "
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9285
       Object ensureSynchronizationSemaphore.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9286
    "
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9287
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9288
    "Created: / 06-02-2020 / 18:36:56 / Stefan Vogel"
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9289
!
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9290
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9291
freeSynchronizationSemaphore
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9292
    "free synchronizationSemaphore. May be used, to save memory when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9293
     an object is no longer used synchronized."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9294
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9295
    |sema|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9296
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9297
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9298
    sema notNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9299
	sema wait.              "/ get lock
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9300
	self synchronizationSemaphore:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9301
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9302
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9303
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9304
     self synchronized:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9305
     self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9306
     self freeSynchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9307
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9308
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9309
    "Created: 28.1.1997 / 19:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9310
    "Modified: 28.1.1997 / 19:47:55 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9311
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9313
synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9314
    "return the synchronization semaphore for myself.
25252
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9315
     subclasses may redefine.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9316
     Return nil, if none has been allocated yet."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9317
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9318
    ^ SynchronizationSemaphores at:self ifAbsent:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9319
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9320
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9321
      self synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9322
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9323
25252
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9324
    "Modified: / 28-01-1997 / 19:47:09 / stefan"
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9325
    "Modified (comment): / 06-02-2020 / 18:39:43 / Stefan Vogel"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9326
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9327
23251
fde6384b96e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23243
diff changeset
  9328
synchronizationSemaphore:aSemaphoreOrBetterARecursionLock
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9329
    "set the synchronisationSemaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9330
     subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9331
23251
fde6384b96e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23243
diff changeset
  9332
    aSemaphoreOrBetterARecursionLock isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9333
	"/ remove Semaphore
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9334
	SynchronizationSemaphores removeKey:self ifAbsent:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9335
    ] ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9336
	SynchronizationSemaphores at:self put:aSemaphoreOrBetterARecursionLock.
23251
fde6384b96e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23243
diff changeset
  9337
    ].
fde6384b96e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23243
diff changeset
  9338
fde6384b96e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23243
diff changeset
  9339
    "Modified: / 28-01-1997 / 19:37:48 / stefan"
fde6384b96e4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23243
diff changeset
  9340
    "Modified (format): / 01-08-2018 / 13:23:47 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9341
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9342
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9343
synchronized:aBlock
24286
b4a5297f5469 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24269
diff changeset
  9344
    "evaluate aBlock synchronized, i.e. use a monitor for this object;
b4a5297f5469 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24269
diff changeset
  9345
     return the value from aBlock"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9346
25252
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9347
    |sema|
6600
9c85adf293dd Simplify #synchronized:
Stefan Vogel <sv@exept.de>
parents: 6572
diff changeset
  9348
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9349
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9350
    sema isNil ifTrue:[
25252
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9351
        sema := self ensureSynchronizationSemaphore.
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9352
    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9353
18799
4ad4472385e5 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18685
diff changeset
  9354
    ^ sema critical:aBlock.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9355
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9356
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9357
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9358
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9359
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9360
22176
401be0ebefda #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22139
diff changeset
  9361
    "Created: / 28-01-1997 / 17:52:56 / stefan"
401be0ebefda #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22139
diff changeset
  9362
    "Modified: / 20-02-1997 / 09:43:35 / stefan"
401be0ebefda #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 22139
diff changeset
  9363
    "Modified: / 09-08-2017 / 11:55:40 / cg"
23034
6a720c32775e #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23033
diff changeset
  9364
    "Modified: / 29-05-2018 / 20:06:40 / Claus Gittinger"
24286
b4a5297f5469 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24269
diff changeset
  9365
    "Modified (comment): / 07-06-2019 / 13:50:38 / Claus Gittinger"
25252
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9366
    "Modified: / 06-02-2020 / 18:38:12 / Stefan Vogel"
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9367
!
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9368
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9369
synchronized:aBlock timeoutMs:timeoutMs ifBlocking:blockingBlock
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9370
    "like synchronized:, but do not block if the lock cannot be acquired
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9371
     within timeoutMs milliseconds.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9372
     Instead, return the value of blockingBlock."
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9373
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9374
    |sema|
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9375
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9376
    sema := self synchronizationSemaphore.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9377
    sema isNil ifTrue:[
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9378
        sema := self ensureSynchronizationSemaphore.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9379
    ].
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9380
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9381
    ^ sema critical:aBlock timeoutMs:timeoutMs ifBlocking:blockingBlock.
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9382
826c0e1220af #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 25240
diff changeset
  9383
    "Created: / 06-02-2020 / 18:43:00 / Stefan Vogel"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9384
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9385
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9386
!Object methodsFor:'system primitives'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9387
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9388
asOop
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9389
    "ST-80 compatibility:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9390
     ST-80 returns an OOP-identity based number here (I guess: its address
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9391
     or index); since ST/X has no such thing, and the objects address cannot
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9392
     be used (since its changing over time), we return the objects identityHash
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9393
     key, which provides (at least) some identity indication.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9394
     However, notice that (in contrast to ST-80's #asOop), the identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9395
     key of two non-identical objects may be the same.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9396
     You'd better not use it - especially do not misuse it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9397
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9398
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9399
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9400
    "Created: 9.11.1996 / 19:09:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9401
    "Modified: 9.11.1996 / 19:16:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9402
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9403
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9404
beImmutable
20526
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9405
    "experimental - not yet usable; do not use.
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9406
     For now the #isImmutable flag prohibits only #become*."
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9407
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9408
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9409
    if (! __isNonNilObject(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9410
	RETURN (self);
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9411
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9412
    __beImmutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9413
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9414
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9415
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9416
beMutable
20526
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9417
    "experimental - not yet usable; do not use.
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9418
     For now the #isImmutable flag prohibits only #become*."
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9419
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9420
%{  /* NOCONTEXT */
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9421
    if (! __isNonNilObject(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9422
	RETURN (self);
8939
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9423
    }
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9424
    __beMutable(self);
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9425
%}
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9426
!
ac97eb450b97 Fix examples in #perform:*ifNotUnderstood:
Stefan Vogel <sv@exept.de>
parents: 8935
diff changeset
  9427
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9428
become:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9429
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9430
     and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9431
     This can be a very dangerous operation - be warned.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9432
     In general, using #become: should be avoided if possible, since it may
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9433
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9434
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9435
     This may also be an expensive (i.e. slow) operation,
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9436
     since in the worst case, the whole memory has to be searched for
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9437
     references to the two objects (although the primitive tries hard to
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9438
     limit the search, for acceptable performance in most cases).
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9439
     This method fails, if the receiver or the argument is a SmallInteger
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9440
     or nil, or is a context of a living method (i.e. one that has not already
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9441
     returned).
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9442
     (notice that #become: is not used heavily by the system
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9443
      - the Collection-classes have been rewritten to not use it.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9444
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9445
    if (__primBecome(self, anotherObject)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9446
	RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9447
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9448
%}.
20526
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9449
    NoModificationError raiseRequestWith:self errorString:' - #become: failed'.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9450
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9452
becomeNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9453
    "make all references to the receiver become nil - effectively getting
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9454
     rid of the receiver.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9455
     This can be a very dangerous operation - be warned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9456
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9457
     This may be an expensive (i.e. slow) operation.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9458
     The receiver may not be a SmallInteger or a context of a living method."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9459
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9460
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9461
    if (__primBecomeNil(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9462
	RETURN ( nil );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9463
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9464
%}.
20526
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9465
    NoModificationError raiseRequestWith:self errorString:' - #becomeNil failed'.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9466
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9467
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9468
becomeSameAs:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9469
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9470
     but NOT vice versa (as done in #become:).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9471
     This can be a very dangerous operation - be warned.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9472
     In general, using #become: should be avoided if possible, since it may
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9473
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9474
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9475
     This may also be an expensive (i.e. slow) operation,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9476
     since in the worst case, the whole memory has to be searched for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9477
     references to the two objects (although the primitive tries hard to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9478
     limit the search, for acceptable performance in most cases).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9479
     This method fails, if the receiver or the argument is a SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9480
     or nil, or is a context of a living method (i.e. one that has not already returned)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9481
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9482
    if (__primBecomeSameAs(self, anotherObject)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9483
	RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9484
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9485
%}.
20526
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9486
    NoModificationError raiseRequestWith:self errorString:' - #becomeSameAs: failed'.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9487
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9488
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9489
changeClassTo:otherClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9490
    "changes the class of the receiver to the argument, otherClass.
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  9491
     This is only allowed (possible), if the receiver's class and the argument
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9492
     have the same structure (i.e. number of named instance variables and
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9493
     type of indexed instance variables).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9494
     If the structures do not match, or any of the original class or new class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9495
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9497
    |myClass ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9498
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  9499
    otherClass autoload.
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  9500
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9501
    "check for UndefinedObject/SmallInteger receiver or newClass"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9502
%{
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  9503
#ifdef __SCHTEAM__
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  9504
    ok = (self.isSTInstance() && otherClass.isSTInstance())
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9505
	    ? STObject.True : STObject.False;
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  9506
#else
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9507
    {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9508
	OBJ other = otherClass;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9509
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9510
	if (__isNonNilObject(self)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9511
	 && __isNonNilObject(other)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9512
	 && (other != UndefinedObject)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9513
	 && (other != SmallInteger)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9514
	    ok = true;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9515
	} else {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9516
	    ok = false;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9517
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9518
    }
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  9519
#endif /* not SCHTEAM */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9520
%}.
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  9521
    ok == true ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9522
	ok := false.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9523
	myClass := self class.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9524
	myClass == otherClass ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9525
	    "nothing to change"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9526
	    ^ self.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9527
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9528
	myClass flags == otherClass flags ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9529
	    myClass instSize == otherClass instSize ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9530
		"same instance layout and types: its ok to do it"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9531
		ok := true.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9532
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9533
		myClass isPointers ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9534
		    myClass isVariable ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9535
			ok := true
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9536
		    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9537
		]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9538
	    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9539
	] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9540
	    myClass isPointers ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9541
		"if newClass is a variable class, with instSize <= my instsize,
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9542
		 we can do it (effectively mapping additional instvars into the
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9543
		 variable part) - usefulness is questionable, though"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9544
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9545
		otherClass isPointers ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9546
		    otherClass isVariable ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9547
			otherClass instSize <= (myClass instSize + self basicSize)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9548
			ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9549
			    ok := true
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9550
			]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9551
		    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9552
			otherClass instSize == (myClass instSize + self basicSize)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9553
			ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9554
			    ok := true
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9555
			]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9556
		    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9557
		] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9558
		    "it does not make sense to convert pointers to bytes ..."
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9559
		]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9560
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9561
		"does it make sense, to convert bits ?"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9562
		"could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9563
		(myClass isBitsExtended and:[otherClass isBitsExtended]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9564
		    ok := true
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9565
		]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9566
	    ]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9567
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9568
    ].
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  9569
    ok == true ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9570
	"now, change the receiver's class ..."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9571
%{
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  9572
#ifdef __SCHTEAM__
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9573
	((STInstance)self).clazz = (STClass)otherClass;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9574
	return __c__._RETURN(self);
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  9575
#else
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9576
	{
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9577
	    OBJ me = self;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9578
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9579
	    // gcc4.4 does not like this:
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9580
	    // __qClass(me) = otherClass;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9581
	    __objPtr(me)->o_class = (CLASS_OBJ)otherClass;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9582
	    __STORE(me, otherClass);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9583
	    RETURN (me);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9584
	}
18371
fa96aa321a0a comments only
Claus Gittinger <cg@exept.de>
parents: 18361
diff changeset
  9585
#endif /* not SCHTEAM */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9586
%}.
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9587
	0.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9588
    ].
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  9589
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9590
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9591
     the receiver cannot be represented as a instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9592
     the desired class.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9593
     For example, you cannot change a bitInstance (byteArray etc.)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9594
     into a pointer object and vice versa.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9595
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9596
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9597
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9598
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9599
changeClassToThatOf:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9600
    "changes the class of the receiver to that of the argument, anObject.
19451
536333350448 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19428
diff changeset
  9601
     This is only allowed (possible), if the receiver's class and the arguments
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9602
     class have the same structure (i.e. number of named instance variables and
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9603
     type of indexed instance variables). If the structures do not match, or any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9604
     of the objects is nil or a Smallinteger, a primitive error is triggered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9605
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9606
    self changeClassTo:(anObject class)
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9607
!
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9608
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9609
isImmutable
20526
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9610
    "experimental - not yet usable; do not use.
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9611
     For now the #isImmutable flag prohibits only #become*."
e47455b96760 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20495
diff changeset
  9612
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9613
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9614
%{  /* NOCONTEXT */
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9615
    if (! __isNonNilObject(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9616
	RETURN (true);
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9617
    }
19646
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  9618
    if (__isImmutable(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9619
	RETURN (true);
19646
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  9620
    }
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  9621
%}.
b078054423fb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19583
diff changeset
  9622
    ^ false
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9623
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
  9624
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9625
replaceReferencesTo:anObject with:newRef
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9626
    "if the receiver refers to the argument, anObject, replace this reference with newRef.
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9627
     Return true if any reference was changed.
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9628
     Notice: this does not change the class-reference."
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9629
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9630
%{  /* NOCONTEXT */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9631
    OBJ cls, flags, anyChange;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9632
    int nInsts, i;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9633
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9634
    if (! __isNonNilObject(self)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9635
	RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9636
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9637
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9638
    /*
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9639
     * a little optimization: use the fact that all old objects
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9640
     * refering to a new object are on the remSet; if I am not,
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9641
     * a trivial reject is possible, if anObject is a newbee
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9642
     */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9643
    if (__isNonNilObject(anObject)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9644
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9645
	    int spc;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9646
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9647
	    if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9648
		RETURN (false);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9649
	    }
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9650
	}
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9651
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9652
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9653
    cls = __qClass(self);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9654
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9655
    flags = __ClassInstPtr(cls)->c_flags;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9656
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9657
	nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9658
    } else {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9659
	nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9660
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9661
    if (! nInsts) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9662
	RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9663
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9664
    anyChange = false;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9665
    for (i=0; i<nInsts; i++) {
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9666
	if (__InstPtr(self)->i_instvars[i] == anObject) {
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9667
	    __InstPtr(self)->i_instvars[i] = newRef;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9668
	    __STORE(self, newRef);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9669
	    // __dumpObject__(self, __LINE__,__FILE__);
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9670
	    anyChange = true;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9671
	}
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9672
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9673
    RETURN (anyChange);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9674
%}.
18231
564b847b61db java support
Claus Gittinger <cg@exept.de>
parents: 18215
diff changeset
  9675
    self primitiveFailed
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9676
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9677
    "
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9678
     |v|
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9679
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9680
     v := Array with:1234 with:'hello' with:Array.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9681
     v replaceReferencesTo:Array with:ByteArray.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9682
     v inspect
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  9683
    "
15586
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  9684
ac2e51b3000c class: Object
Claus Gittinger <cg@exept.de>
parents: 15519
diff changeset
  9685
    "Modified: / 30-07-2013 / 21:48:06 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9686
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9687
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9688
!Object methodsFor:'testing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9689
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9690
? defaultValue
11634
657c12384132 Fix spelling
Stefan Vogel <sv@exept.de>
parents: 11573
diff changeset
  9691
     "a syntactic sugar-piece:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9692
      if the receiver is nil, return the defaultValue;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9693
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9694
      This method is only redefined in UndefinedObject - therefore,
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9695
      the receiver is returned here.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9696
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9697
      Thus, if foo and bar are simple variables or constants,
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9698
	  foo ? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9699
      is the same as:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9700
	  (foo isNil ifTrue:[bar] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9701
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9702
      if they are message sends, the equivalent code is:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9703
	  [
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9704
	      |t1 t2|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9705
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9706
	      t1 := foo.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9707
	      t2 := bar.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9708
	      t1 isNil ifTrue:[t2] ifFalse:[t1]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9709
	  ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9710
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9711
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9712
      as in:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9713
	  foo := arg ? #defaultValue
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9714
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9715
      Note: this method should never be redefined in classes other than UndefinedObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9716
      Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9717
	 This method is open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9718
	 - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9719
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9720
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9722
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9723
     1 ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9724
     nil ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9725
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9726
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9727
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9728
    "Modified: / 19.5.1998 / 17:39:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9729
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9730
16126
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9731
?+ aOneArgBlock
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9732
     "a syntactic sugar-piece:
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9733
      aOneArgBlock is executed with self as argument
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9734
      if self is not nil.
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9735
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9736
      Note: this method should never be redefined in classes other than UndefinedObject.
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9737
     "
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9738
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9739
    ^ aOneArgBlock value:self
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9740
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9741
    "
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9742
     1 ?+ [:v| v + 5]
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9743
     nil ?+ [:v| v + 5]
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9744
    "
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9745
!
bd5dd5e03278 class: Object
Stefan Vogel <sv@exept.de>
parents: 16125
diff changeset
  9746
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9747
?? defaultValue
11634
657c12384132 Fix spelling
Stefan Vogel <sv@exept.de>
parents: 11573
diff changeset
  9748
     "a syntactic sugar-piece:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9749
      much like ?, but sends #value to the argument if required.
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9750
      (i.e. it is the same as #ifNil:)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9751
      If the receiver is nil, return the defaultValues value;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9752
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9753
      This method is only redefined in UndefinedObject - therefore,
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9754
      the receiver is returned here.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9756
      Thus, if foo and bar are simple variables or constants,
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9757
	  foo ?? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9758
      is the same as:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9759
	  (foo isNil ifTrue:[bar value] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9760
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9761
      if they are message sends, the equivalent code is:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9762
	  [
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9763
	      |t t2|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9764
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9765
	      t := foo.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9766
	      t isNil ifTrue:[bar value] ifFalse:[t]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9767
	  ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9768
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9769
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9770
      as in:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9771
	  foo := arg ?? [ self computeDefault ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9772
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9773
      Note: this method should never be redefined in classes other than UndefinedObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9774
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9775
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9776
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9777
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9778
    "
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9779
     1 ?? #default
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9780
     nil ?? #default
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9781
     1 ?? [ self halt. 1 + 2 ]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9782
     nil ?? [ self halt. 1 + 2 ]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9783
     1 ?? [Date today]
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9784
     nil ?? [Date today]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9785
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9786
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9787
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9788
    "Modified: / 19.5.1998 / 17:42:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9789
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9790
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9791
ifNil:aBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9792
    "return myself, or the result from evaluating the argument, if I am nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9793
     This is much like #?, but sends #value to the argument in case of a nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9794
     receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9795
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9796
	This method is open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9797
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9798
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9799
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9800
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9801
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9802
ifNil:nilBlockOrValue ifNotNil:notNilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9803
    "return the value of the first arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9804
     the result from evaluating the 2nd argument, if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9805
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9806
	This method is open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9807
	- redefining it may not work as expected."
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  9808
21666
5be21a5aeb80 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21661
diff changeset
  9809
    (notNilBlockOrValue isBlockWithArgumentCount:1) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9810
	^ notNilBlockOrValue value:self.
15501
43d3929a8fc0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15449
diff changeset
  9811
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9812
    ^ notNilBlockOrValue value
21661
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9813
21666
5be21a5aeb80 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21661
diff changeset
  9814
    "Modified: / 18-03-2017 / 19:07:10 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9815
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9816
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9817
ifNotNil:aBlockOrValue
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
  9818
    "return myself if nil, or the result from evaluating the argument,
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9819
     if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9820
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9821
	This method is open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9822
	- redefining it may not work as expected."
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  9823
22648
b1b967e91592 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22639
diff changeset
  9824
    ^ aBlockOrValue valueWithOptionalArgument:self
b1b967e91592 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22639
diff changeset
  9825
b1b967e91592 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 22639
diff changeset
  9826
    "Modified: / 22-03-2018 / 11:39:24 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9827
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9828
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9829
ifNotNil:notNilBlockOrValue ifNil:nilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9830
    "return the value of the 2nd arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9831
     the result from evaluating the 1st argument, if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9832
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9833
	This method is open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9834
	- redefining it may not work as expected."
18440
dc5cde224664 class: Object
Stefan Vogel <sv@exept.de>
parents: 18422
diff changeset
  9835
21661
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9836
    (notNilBlockOrValue isBlockWithArgumentCount:1) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
  9837
	^ notNilBlockOrValue value:self.
15501
43d3929a8fc0 class: Object
Claus Gittinger <cg@exept.de>
parents: 15449
diff changeset
  9838
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9839
    ^ notNilBlockOrValue value
21661
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9840
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9841
    "Modified: / 18-03-2017 / 18:26:29 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9842
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9843
8574
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9844
ifNotNilDo:aBlock
20351
1ae3d30c0149 #OTHER by mawalch
mawalch
parents: 20319
diff changeset
  9845
    "if the receiver is non-nil, return the value of aBlock, passing myself as argument.
8574
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9846
     Otherwise do nothing and return nil."
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9847
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9848
    ^ aBlock value:self
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9849
!
33bb637901eb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8563
diff changeset
  9850
22604
916243d61370 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22602
diff changeset
  9851
isApplicationModel
916243d61370 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22602
diff changeset
  9852
    "return true if the receiver is some kind of applicationModel;
916243d61370 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22602
diff changeset
  9853
     false is returned here - the method is only redefined in ApplicationModel."
916243d61370 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22602
diff changeset
  9854
916243d61370 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22602
diff changeset
  9855
    ^ false
916243d61370 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22602
diff changeset
  9856
!
916243d61370 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22602
diff changeset
  9857
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9858
isArray
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9859
    "return true if the receiver is some kind of array (or weakArray etc);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9860
     false is returned here - the method is only redefined in Array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9861
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9862
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9863
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9864
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9865
isAssociation
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9866
    "return true if the receiver is some kind of association;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9867
     false is returned here - the method is only redefined in Association."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9868
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9869
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9870
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9871
    "Created: 14.5.1996 / 17:03:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9872
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9873
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9874
isBehavior
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9875
    "return true if the receiver is describing another object's behavior.
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
  9876
     False is returned here - the method is only redefined in Behavior."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9877
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9878
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9879
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9880
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9881
isBlock
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9882
    "return true if the receiver is some kind of block;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9883
     false returned here - the method is only redefined in Block."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9884
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9885
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9886
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9887
22722
d4a251fad93a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22711
diff changeset
  9888
isBlockOrMessageSend
d4a251fad93a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22711
diff changeset
  9889
    "return true if the receiver is some kind of block;
d4a251fad93a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22711
diff changeset
  9890
     false returned here - the method is only redefined in Block."
d4a251fad93a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22711
diff changeset
  9891
d4a251fad93a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22711
diff changeset
  9892
    ^ self isBlock
d4a251fad93a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22711
diff changeset
  9893
!
d4a251fad93a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22711
diff changeset
  9894
21661
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9895
isBlockWithArgumentCount:count
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9896
    "return true if the receiver is some kind of block;
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9897
     false returned here - the method is only redefined in Block."
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9898
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9899
    ^ false
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9900
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9901
    "Created: / 18-03-2017 / 18:07:26 / stefan"
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9902
!
f224c10b495e #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 21646
diff changeset
  9903
5824
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9904
isBoolean
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9905
    "return true if the receiver is a boolean;
5824
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9906
     false is returned here - the method is only redefined in Boolean."
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9907
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9908
    ^ false
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9909
!
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  9910
23025
6faff43ba926 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23018
diff changeset
  9911
isBridgeProxy
23031
9baa6604dedb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23025
diff changeset
  9912
    "answer true, if I am a proxy object for a bridged remote object.
9baa6604dedb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23025
diff changeset
  9913
     Do NOT move this into the bridge package;
9baa6604dedb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23025
diff changeset
  9914
     it is required to be understood even without a bridge being loaded
9baa6604dedb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23025
diff changeset
  9915
     (debugger, inspectors, etc. may use it)"
9baa6604dedb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23025
diff changeset
  9916
9baa6604dedb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23025
diff changeset
  9917
    ^ false
9baa6604dedb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23025
diff changeset
  9918
9baa6604dedb #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23025
diff changeset
  9919
    "Modified (comment): / 28-05-2018 / 16:20:10 / Claus Gittinger"
23025
6faff43ba926 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23018
diff changeset
  9920
!
6faff43ba926 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 23018
diff changeset
  9921
25165
f5feabfde867 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 25061
diff changeset
  9922
isBridgedPythonClass
f5feabfde867 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 25061
diff changeset
  9923
    "return true if this is a Python class"
f5feabfde867 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 25061
diff changeset
  9924
f5feabfde867 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 25061
diff changeset
  9925
    ^ false
f5feabfde867 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 25061
diff changeset
  9926
!
f5feabfde867 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 25061
diff changeset
  9927
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9928
isByteArray
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9929
    "return true if the receiver is some kind of bytearray;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9930
     false is returned here - the method is only redefined in ByteArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9931
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9932
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9933
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9934
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9935
isByteCollection
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9936
    "return true if the receiver is some kind of byte collection,
22230
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
  9937
     This is different from 'self class isBytes',
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
  9938
     since e.g. in BitArray single bits are accessed, but it is implemented as variableBytes class."
8986
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9939
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9940
    ^ false
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9941
!
c2962d45eca0 new: #isByteCollection
Stefan Vogel <sv@exept.de>
parents: 8977
diff changeset
  9942
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9943
isCharacter
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9944
    "return true if the receiver is some kind of character;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9945
     false is returned here - the method is only redefined in Character."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9946
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9947
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9948
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9949
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9950
isClass
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9951
    "return true if the receiver is some kind of class
9405
cdeae08708cd comments
Stefan Vogel <sv@exept.de>
parents: 9375
diff changeset
  9952
     (real class, not just behavior);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9953
     false is returned here - the method is only redefined in Class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9954
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9955
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9956
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9957
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9958
isCollection
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9959
    "return true if the receiver is some kind of collection;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9960
     false is returned here - the method is only redefined in Collection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9961
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9962
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9963
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9964
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9965
isColor
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9966
    "return true if the receiver is some kind of color;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9967
     false is returned here - the method is only redefined in Color."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9968
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9969
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9970
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9971
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9972
isCons
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9973
    "return true if the receiver is a cons (pair);
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9974
     false is returned here - the method is only redefined in Cons."
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9975
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9976
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9977
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
  9978
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9979
isContext
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9980
    "return true if the receiver is some kind of Context;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9981
     false returned here - the method is only redefined in Context."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9982
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9983
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9984
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  9985
15362
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9986
isDictionary
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
  9987
    "return true if the receiver is some kind of dictionary;
15362
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9988
     false returned here - the method is only redefined in Dictionary."
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9989
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9990
    ^ false
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9991
!
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
  9992
23574
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
  9993
isEOF
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
  9994
    "Return true if the receiver is the EOF token.
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
  9995
     This is (and should only be) redefined in EOFObject,
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
  9996
     for the one and only instance of it, void"
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
  9997
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
  9998
    ^ false
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
  9999
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
 10000
    "
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
 10001
     nil isEOF
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
 10002
     void isEOF
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
 10003
     EOF isEOF
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
 10004
    "
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
 10005
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
 10006
    "Created: / 20-12-2018 / 17:00:58 / Claus Gittinger"
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
 10007
!
e8810c0c7ec7 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23571
diff changeset
 10008
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
 10009
isEmptyOrNil
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
 10010
    "return true if I am nil or an empty collection - return false here.
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
 10011
     (from Squeak)"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
 10012
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
 10013
    ^ false
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
 10014
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
 10015
    "Created: / 13.11.2001 / 13:17:04 / cg"
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
 10016
    "Modified: / 13.11.2001 / 13:28:40 / cg"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
 10017
!
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
 10018
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
 10019
isException
15362
f64a9683658b class: Object
Claus Gittinger <cg@exept.de>
parents: 15255
diff changeset
 10020
    "answer true, if this is an Exception"
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10021
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
 10022
    ^ false
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
 10023
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
 10024
    "Created: / 17.11.2001 / 18:37:44 / cg"
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
 10025
!
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
 10026
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10027
isExceptionCreator
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10028
    "return true if the receiver can create exceptions,
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10029
     this includes #raise, #raiseRequest as well as the behavior of
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10030
     an exception handler, such as the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10031
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10032
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10033
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10034
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10035
isExceptionHandler
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10036
    "return true if the receiver responds to the exception handler protocol,
6631
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10037
     especially to the #accepts: and #handles: messages"
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10038
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10039
    ^ false
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10040
!
5ffa1ce7b2cc #isExceptionCreator instead of #isSignal
Stefan Vogel <sv@exept.de>
parents: 6600
diff changeset
 10041
13187
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
 10042
isExternalAddress
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10043
    "return true if the receiver is some kind of externalAddress;
13187
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
 10044
     false is returned here - the method is only redefined in ExternalAddress."
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
 10045
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
 10046
    ^ false
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
 10047
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
 10048
    "Created: / 22-12-2010 / 17:20:36 / cg"
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
 10049
!
f79a83bcc243 added: #isExternalAddress
Claus Gittinger <cg@exept.de>
parents: 13165
diff changeset
 10050
14079
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
 10051
isExternalBytes
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
 10052
    ^ false
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
 10053
!
4568576f2690 added: #isExternalBytes
Stefan Vogel <sv@exept.de>
parents: 14078
diff changeset
 10054
10480
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
 10055
isExternalLibraryFunction
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10056
    "return true if the receiver is some kind of externalLibrary function;
10480
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
 10057
     false is returned here - the method is only redefined in ExternalLibraryFunction."
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
 10058
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
 10059
    ^false
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
 10060
!
9fc4dd89edb2 +isExternalLibraryFunction
fm
parents: 10460
diff changeset
 10061
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10062
isExternalStream
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10063
    "return true if the receiver is some kind of externalStream;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10064
     false is returned here - the method is only redefined in ExternalStream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10065
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10066
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10067
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10068
19550
0341c4074b6c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19451
diff changeset
 10069
isExternalStructure
0341c4074b6c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19451
diff changeset
 10070
    ^ false
0341c4074b6c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19451
diff changeset
 10071
!
0341c4074b6c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19451
diff changeset
 10072
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10073
isFileStream
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10074
    "return true if the receiver is some kind of fileStream;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10075
     false is returned here - the method is only redefined in FileStream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10076
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10077
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10078
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10079
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10080
isFilename
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10081
    "return true if the receiver is some kind of filename;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10082
     false is returned here - the method is only redefined in Filename."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10083
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10084
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10085
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10086
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10087
isFixedPoint
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10088
    "return true if the receiver is some kind of fixedPoint number;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10089
     false is returned here - the method is only redefined in FixedPoint."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10090
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10091
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10092
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10093
    "Created: 5.11.1996 / 19:23:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10094
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10095
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10096
isFixedSize
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10097
    "return true if the receiver cannot grow easily
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10098
     (i.e. a grow may be expensive, since it involves a become:)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10099
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10100
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10101
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10102
6185
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
 10103
isFloat
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10104
    "return true if the receiver is some kind of floating point number;
6185
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
 10105
     false is returned here.
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
 10106
     Same as #isLimitedPrecisionReal, but a better name ;-)"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
 10107
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
 10108
    ^ false
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
 10109
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
 10110
    "Modified: / 14.11.2001 / 14:57:46 / cg"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
 10111
!
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
 10112
23796
72db4bb61aaf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23794
diff changeset
 10113
isFloatArray
72db4bb61aaf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23794
diff changeset
 10114
    "return true if the receiver has float elements.
72db4bb61aaf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23794
diff changeset
 10115
     These are Float, Double- and HalfFloat arrays"
72db4bb61aaf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23794
diff changeset
 10116
72db4bb61aaf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23794
diff changeset
 10117
    ^ false
72db4bb61aaf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23794
diff changeset
 10118
72db4bb61aaf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23794
diff changeset
 10119
    "Created: / 02-03-2019 / 23:14:46 / Claus Gittinger"
72db4bb61aaf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23794
diff changeset
 10120
!
72db4bb61aaf #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23794
diff changeset
 10121
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10122
isForm
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10123
    "return true if the receiver is some kind of form;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10124
     false is returned here - the method is only redefined in Form."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10125
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10126
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10127
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10128
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10129
isFraction
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10130
    "return true if the receiver is some kind of fraction;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10131
     false is returned here - the method is only redefined in Fraction."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10132
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10133
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10134
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10135
9293
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
 10136
isHierarchicalItem
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
 10137
    "used to decide if the parent is a hierarchical item or the model"
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
 10138
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
 10139
    ^ false
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
 10140
!
307bb63a9057 category change
Claus Gittinger <cg@exept.de>
parents: 9279
diff changeset
 10141
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10142
isImage
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10143
    "return true if the receiver is some kind of image;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10144
     false is returned here - the method is only redefined in Image."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10145
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10146
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10147
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10148
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10149
isImageOrForm
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10150
    "return true if the receiver is some kind of image or form;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10151
     false is returned here - the method is only redefined in Image and Form."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10152
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10153
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10154
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10155
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10156
isImmediate
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10157
    "return true if I am an immediate object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10158
     i.e. I am represented in the pointer itself and
24187
f4985dcdc838 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24171
diff changeset
 10159
     no real object header/storage is used by me.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10160
     (currently, only SmallIntegers, some characters and nil return true)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10161
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10162
    ^ self class hasImmediateInstances
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10163
24187
f4985dcdc838 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24171
diff changeset
 10164
    "Created: / 03-06-1997 / 12:00:18 / cg"
f4985dcdc838 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24171
diff changeset
 10165
    "Modified (comment): / 27-05-2019 / 15:38:38 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10166
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10167
24520
55934fccfcca #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24504
diff changeset
 10168
isInlineObject
55934fccfcca #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24504
diff changeset
 10169
    "return true if the receiver is some kind of inline object;
55934fccfcca #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24504
diff changeset
 10170
     false is returned here - the method is only redefined in InlineObject."
55934fccfcca #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24504
diff changeset
 10171
55934fccfcca #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24504
diff changeset
 10172
    ^ false
55934fccfcca #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24504
diff changeset
 10173
!
55934fccfcca #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24504
diff changeset
 10174
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10175
isInteger
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10176
    "return true if the receiver is some kind of integer number;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10177
     false is returned here - the method is only redefined in Integer."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10178
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10179
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10180
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10181
23794
df3116f8e5b6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23757
diff changeset
 10182
isIntegerArray
df3116f8e5b6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23757
diff changeset
 10183
    "return true if the receiver has integer elements.
df3116f8e5b6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23757
diff changeset
 10184
     These are Byte- and Integer arrays; both signed and unsigned"
df3116f8e5b6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23757
diff changeset
 10185
df3116f8e5b6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23757
diff changeset
 10186
    ^ false
df3116f8e5b6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23757
diff changeset
 10187
df3116f8e5b6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23757
diff changeset
 10188
    "Created: / 02-03-2019 / 23:09:54 / Claus Gittinger"
df3116f8e5b6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23757
diff changeset
 10189
!
df3116f8e5b6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23757
diff changeset
 10190
9279
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
 10191
isInterestConverter
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
 10192
    "return true if I am a kind of interest forwarder"
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
 10193
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
 10194
    ^ false
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
 10195
!
90b74299a7c0 interest stuff
Claus Gittinger <cg@exept.de>
parents: 9246
diff changeset
 10196
10576
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
 10197
isInternalByteStream
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
 10198
    "return true, if the receiver is some kind of Stream for reading bytes;
24851
1a6831daac04 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24834
diff changeset
 10199
     false is returned here - the method is only redefined in PositionableStream."
10576
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
 10200
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
 10201
    ^false
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
 10202
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
 10203
    "Created: / 30-05-2007 / 16:15:33 / cg"
24851
1a6831daac04 #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 24834
diff changeset
 10204
    "Modified (comment): / 22-10-2019 / 17:06:07 / Stefan Vogel"
10576
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
 10205
!
60526e4a6854 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10567
diff changeset
 10206
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10207
isJavaClass
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10208
    "return true if this is a JavaClass.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10209
     false is returned here - the method is only redefined in JavaClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10210
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10211
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10212
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10213
    "Created: / 26.3.1997 / 13:34:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10214
    "Modified: / 8.5.1998 / 21:25:21 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10215
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10216
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10217
isJavaClassRef
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10218
    "return true if this is a JavaClassRef.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10219
     false is returned here - the method is only redefined in JavaClassRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10220
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10221
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10222
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10223
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10224
    "Created: / 24.12.1999 / 01:46:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10225
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10226
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10227
isJavaContext
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10228
    "return true if this is a JavaContext.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10229
     false is returned here - the method is only redefined in JavaContext."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10230
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10231
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10232
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10233
    "Created: / 8.5.1998 / 21:24:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10234
    "Modified: / 8.5.1998 / 21:25:35 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10235
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10236
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10237
isJavaMethod
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10238
    "return true if this is a JavaMethod.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10239
     false is returned here - the method is only redefined in JavaMethod."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10240
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10241
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10242
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10243
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10244
    "Created: / 25.9.1999 / 23:26:12 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10245
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10246
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10247
isJavaMethodRef
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10248
    "return true if this is a JavaMethodRef.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10249
     false is returned here - the method is only redefined in JavaMethodRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10250
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10251
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10252
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10253
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10254
    "Created: / 23.12.1999 / 19:44:51 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10255
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10256
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10257
isJavaObject
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10258
    "return true if this is a JavaObject.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10259
     false is returned here - the method is only redefined in JavaObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10260
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10261
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10262
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10263
    "Created: / 26.3.1997 / 13:34:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10264
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10265
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10266
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10267
isJavaScriptClass
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10268
    "return true if this is a JavaScriptClass.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10269
     false is returned here - the method is only redefined in JavaScriptClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10270
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10271
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10272
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10273
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10274
isJavaScriptMetaclass
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10275
    "return true if this is a JavaScript Metaclass.
8935
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10276
     false is returned here - the method is only redefined in JavaScriptMetaclass."
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10277
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10278
    ^ false
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10279
!
f770c55ba40e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8934
diff changeset
 10280
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10281
isKindOf:aClass
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10282
    "return true if the receiver is an instance of aClass or one of its
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10283
     subclasses, false otherwise.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10284
     Advice:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10285
	use of this to check objects for certain attributes/protocol should
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10286
	be avoided; it limits the reusability of your classes by limiting use
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10287
	to instances of certain classes and fences you into a specific inheritance
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10288
	hierarchy.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10289
	Use check-methods to check an object for a certain attributes/protocol
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10290
	(such as #isXXXX, #respondsTo: or #isNumber).
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10291
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10292
	Using #isKindOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10293
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10294
     Advice2:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10295
	Be aware, that using an #isXXX method is usually much faster than
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10296
	using #isKindOf:; because isKindOf: has to walk up all the superclass
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10297
	hierarchy, comparing every class on the way.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10298
	Due to caching in the VM, a call to #isXXX is normally reached via
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10299
	a single function call.
24297
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10300
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10301
     Advice3:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10302
	It is usually better to ask for a feature being present,
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10303
	or an operation to be supported, instead of asking for being something or someone.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10304
	For example, it is much better to ask for #respondsToArithmetic,
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10305
	instead of asking for #isNumber,
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10306
	Because other things (characters, matrices, physicak/mathematical objects
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10307
	might also be able to do arithmetic, although not being numbers.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10308
	Thus you'd better implement such queries and use those to make your code
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10309
	more flexble and easier to reuse in the future.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10310
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10311
      Having sayd all that, and being warned, here is the implementation:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10312
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10313
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10314
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10315
    register OBJ thisClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10316
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10317
    thisClass = __Class(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10318
    while (thisClass != nil) {
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10319
	if (thisClass == aClass) {
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10320
	    RETURN ( true );
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10321
	}
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10322
	thisClass = __ClassInstPtr(thisClass)->c_superclass;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10323
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10324
    RETURN ( false );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10325
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10326
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10327
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10328
"/  the above code is equivalent to:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10329
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10330
"/  thisClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10331
"/  [thisClass notNil] whileTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10332
"/      thisClass == aClass ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10333
"/      thisClass := thisClass superclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10334
"/  ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10335
"/  ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10336
"/
24297
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10337
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10338
    "Modified: / 08-06-2019 / 16:47:00 / Claus Gittinger"
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10339
!
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10340
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10341
isKindOf:class1 orOf:class2
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10342
    "return true if the receiver is an instance of class1 or of class2
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10343
     or one of either subclasses, false otherwise.
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10344
     Advice:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10345
	use of this to check objects for certain attributes/protocol should
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10346
	be avoided; it limits the reusability of your classes by limiting use
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10347
	to instances of certain classes and fences you into a specific inheritance
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10348
	hierarchy.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10349
	Use check-methods to check an object for a certain attributes/protocol
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10350
	(such as #isXXXX, #respondsTo: or #isNumber).
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10351
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10352
	Using #isKindOf: is considered BAD STYLE.
24297
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10353
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10354
     Advice2:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10355
	Be aware, that using an #isXXX method is usually much faster than
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10356
	using #isKindOf:; because isKindOf: has to walk up all the superclass
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10357
	hierarchy, comparing every class on the way.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10358
	Due to caching in the VM, a call to #isXXX is normally reached via
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10359
	a single function call.
24297
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10360
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10361
     Advice3:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10362
	It is usually better to ask for a feature being present,
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10363
	or an operation to be supported, instead of asking for being something or someone.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10364
	For example, it is much better to ask for #respondsToArithmetic,
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10365
	instead of asking for #isNumber,
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10366
	Because other things (characters, matrices, physicak/mathematical objects
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10367
	might also be able to do arithmetic, although not being numbers.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10368
	Thus you'd better implement such queries and use those to make your code
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10369
	more flexble and easier to reuse in the future.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10370
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10371
      Having sayd all that, and being warned, here is the implementation:
24297
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10372
     "
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10373
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10374
%{  /* NOCONTEXT */
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10375
    register OBJ thisClass;
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10376
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10377
    thisClass = __Class(self);
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10378
    while (thisClass != nil) {
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10379
	if ((thisClass == class1) || (thisClass == class2)) {
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10380
	    RETURN ( true );
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10381
	}
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10382
	thisClass = __ClassInstPtr(thisClass)->c_superclass;
24297
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10383
    }
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10384
    RETURN ( false );
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10385
%}
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10386
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10387
"/
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10388
"/  the above code is equivalent to:
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10389
"/
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10390
"/  thisClass := self class.
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10391
"/  [thisClass notNil] whileTrue:[
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10392
"/      ((thisClass == class1) or:[thisClass == class2]) ifTrue:[^ true].
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10393
"/      thisClass := thisClass superclass
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10394
"/  ].
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10395
"/  ^ false
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10396
"/
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10397
51b73c9131b3 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24286
diff changeset
 10398
    "Created: / 08-06-2019 / 16:46:36 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10399
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10400
17168
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
 10401
isLabelAndIcon
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10402
    "return true if the receiver is a LabelAndIcon;
17168
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
 10403
     false is returned here - the method is only redefined in LabelAndIcon."
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
 10404
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
 10405
    ^ false
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
 10406
!
1a65336dec3e class: Object
Claus Gittinger <cg@exept.de>
parents: 16907
diff changeset
 10407
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10408
isLayout
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10409
    "return true if the receiver is some kind of layout;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10410
     false is returned here - the method is only redefined in Layout."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10411
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10412
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10413
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10414
6567
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
 10415
isLazyValue
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
 10416
    ^ false
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
 10417
!
cba5c3103600 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6549
diff changeset
 10418
6086
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
 10419
isLimitedPrecisionReal
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10420
    "return true if the receiver is some kind of floating point number;
6086
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
 10421
     false is returned here - the method is only redefined in LimitedPrecisionReal."
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
 10422
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
 10423
    ^ false
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
 10424
!
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
 10425
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10426
isList
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10427
    "return true if the receiver is some kind of list collection;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10428
     false is returned here - the method is only redefined in List."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10429
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10430
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10431
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10432
    "Created: / 11.2.2000 / 01:37:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10433
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10434
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10435
isLiteral
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10436
    "return true if the receiver can be represented as a literal constant in ST syntax;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10437
     false is returned here - the method is redefined in some classes."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10438
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10439
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10440
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10441
24945
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10442
isLongFloat
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10443
    "return true if the receiver is a long floating point number (iee extended precision);
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10444
     false is returned here."
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10445
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10446
    ^ false
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10447
!
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10448
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10449
isMemberOf:aClass
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10450
    "return true if the receiver is an instance of aClass, false otherwise.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10451
     Advice:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10452
	use of this to check objects for certain attributes/protocol should
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10453
	be avoided; it limits the reusability of your classes by limiting use
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10454
	to instances of a certain class.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10455
	Use check-methods to check an object for a certain attributes/protocol
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10456
	(such as #isXXX, #respondsTo: or #isNumber).
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10457
	Read more on this in #isKindOf:
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10458
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10459
	Using #isMemberOf: is considered VERY BAD STYLE.
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10460
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10461
     Notice:
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10462
	This method is open coded (inlined) by the compiler(s)
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 10463
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10464
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10465
    ^ (self class) == aClass
24298
56a415d30d15 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24297
diff changeset
 10466
56a415d30d15 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 24297
diff changeset
 10467
    "Modified (comment): / 08-06-2019 / 16:50:42 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10468
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10469
18319
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
 10470
isMenuItem
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10471
    "return true if the receiver is a menu item inside a MenuPanel, Menu or PopUpmenu.
18319
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
 10472
     false is returned here - the method is redefined in some classes."
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
 10473
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
 10474
    ^ false
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
 10475
!
a28d1c9dd31e class: Object
Claus Gittinger <cg@exept.de>
parents: 18289
diff changeset
 10476
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10477
isMeta
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10478
    "return true if the receiver is some kind of metaclass;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10479
     false is returned here - the method is only redefined in Metaclass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10480
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10481
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10482
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10483
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10484
isMethod
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10485
    "return true if the receiver is some kind of method;
16021
301a3939838f class: Object
Claus Gittinger <cg@exept.de>
parents: 16012
diff changeset
 10486
     false returned here - this method is only redefined in Method."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10487
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10488
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10489
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10490
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10491
isMorph
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10492
    "return true if the receiver is some kind of morph;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10493
     false is returned here - the method is only redefined in Morph."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10494
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10495
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10496
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10497
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10498
isNameSpace
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10499
    "return true if the receiver is a NameSpace.
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
 10500
     False is returned here - the method is only redefined in Namespace."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10501
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10502
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10503
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10504
    "Created: / 11.10.1996 / 18:08:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10505
    "Modified: / 8.5.1998 / 21:26:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10506
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10507
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10508
isNamespace
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10509
    "return true if this is a NameSpace.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10510
     false is returned here - the method is only redefined in Namespace."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10511
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
 10512
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
 10513
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10514
    self obsoleteMethodWarning:'use #isNameSpace'.
6805
f95ad1a82775 *** empty log message ***
ca
parents: 6800
diff changeset
 10515
    ^ self isNameSpace
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10516
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10517
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10518
isNil
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10519
    "Return true if the receiver is nil.
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
 10520
     Because isNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
 10521
     the receiver is definitely not nil here, so unconditionally return false.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10522
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10523
	This method is open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10524
	- redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10525
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10526
    ^ false
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10527
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10528
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10529
isNilOrEmptyCollection
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
 10530
    "return true if I am nil or an empty collection - false here.
8833
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
 10531
     Obsolete, use isEmptyOrNil."
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
 10532
717b01292d0e comments
Stefan Vogel <sv@exept.de>
parents: 8832
diff changeset
 10533
    <resource:#obsolete>
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10534
22639
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
 10535
    ^ self isEmptyOrNil
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
 10536
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
 10537
    "Modified: / 13-11-2001 / 13:28:06 / cg"
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
 10538
    "Modified: / 20-03-2018 / 15:27:42 / stefan"
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10539
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10540
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
 10541
isNonByteCollection
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10542
    "return true if the receiver is some kind of collection, but not a String, ByteArray etc.;
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
 10543
     false is returned here - the method is redefined in Collection and UninterpretedBytes."
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
 10544
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
 10545
    ^ false
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
 10546
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
 10547
    "
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10548
	21 isNonByteCollection
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10549
	'abc' isNonByteCollection
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10550
	#'abc' isNonByteCollection
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10551
	#[1 2 3] isNonByteCollection
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10552
	#(1 2 3) isNonByteCollection
9005
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
 10553
    "
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
 10554
!
b82aa6bdc487 #isNonByteCollection
Stefan Vogel <sv@exept.de>
parents: 8986
diff changeset
 10555
16907
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
 10556
isNotNil
19781
810b4dd98ddd #REFACTORING by mawalch
mawalch
parents: 19719
diff changeset
 10557
    <resource: #obsolete>
810b4dd98ddd #REFACTORING by mawalch
mawalch
parents: 19719
diff changeset
 10558
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10559
    "Return true if the receiver is not nil.
16907
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
 10560
     Because isNotNil is redefined in UndefinedObject,
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
 10561
     the receiver is definitely not nil here, so unconditionally return true."
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
 10562
19781
810b4dd98ddd #REFACTORING by mawalch
mawalch
parents: 19719
diff changeset
 10563
    self obsoleteMethodWarning:'use #notNil'.
22639
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
 10564
    ^ self notNil
16907
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
 10565
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
 10566
    "Created: / 26-10-2014 / 01:30:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
22639
468e2dcbd196 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 22604
diff changeset
 10567
    "Modified: / 20-03-2018 / 15:26:52 / stefan"
16907
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
 10568
!
402df2d3c1d7 added: Object>>isNotNil
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16828
diff changeset
 10569
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10570
isNumber
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10571
    "return true if the receiver is some kind of number;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10572
     false is returned here - the method is only redefined in Number."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10573
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10574
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10575
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10576
21069
b4d9c2d2d8cb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20954
diff changeset
 10577
isOSErrorHolder
b4d9c2d2d8cb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20954
diff changeset
 10578
    ^ false
b4d9c2d2d8cb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20954
diff changeset
 10579
!
b4d9c2d2d8cb #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 20954
diff changeset
 10580
23832
5c0fb2a9bca2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23803
diff changeset
 10581
isObjectiveCObject
23833
dafca6659d63 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23832
diff changeset
 10582
    "return true if the receiver is a proxy for an
dafca6659d63 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23832
diff changeset
 10583
     objectiveC object.
dafca6659d63 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23832
diff changeset
 10584
     False is returned here."
dafca6659d63 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23832
diff changeset
 10585
23832
5c0fb2a9bca2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23803
diff changeset
 10586
    ^ false
5c0fb2a9bca2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23803
diff changeset
 10587
5c0fb2a9bca2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23803
diff changeset
 10588
    "Created: / 04-03-2019 / 11:45:20 / Claus Gittinger"
5c0fb2a9bca2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23803
diff changeset
 10589
!
5c0fb2a9bca2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23803
diff changeset
 10590
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10591
isOrderedCollection
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10592
    "return true if the receiver is some kind of ordered collection (or list etc);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10593
     false is returned here - the method is only redefined in OrderedCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10594
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10595
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10596
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10597
16342
d0f27ca59145 class: Object
Stefan Vogel <sv@exept.de>
parents: 16325
diff changeset
 10598
isOsHandle
d0f27ca59145 class: Object
Stefan Vogel <sv@exept.de>
parents: 16325
diff changeset
 10599
    ^ false
d0f27ca59145 class: Object
Stefan Vogel <sv@exept.de>
parents: 16325
diff changeset
 10600
!
d0f27ca59145 class: Object
Stefan Vogel <sv@exept.de>
parents: 16325
diff changeset
 10601
18894
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
 10602
isPlainString
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10603
    "return true if the receiver is a plain string - without attributes;
18894
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
 10604
     false is returned here - the method is redefined in CharacterArray and Text."
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
 10605
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
 10606
    ^ false
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
 10607
!
ff31342f584a #FEATURE
Stefan Vogel <sv@exept.de>
parents: 18802
diff changeset
 10608
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10609
isPoint
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10610
    "return true if the receiver is some kind of point;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10611
     false is returned here - the method is only redefined in Point."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10612
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10613
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10614
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10615
10532
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
 10616
isPrinterContext
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
 10617
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
 10618
    ^false
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
 10619
!
36237807e16a + #isPrinterContext
fm
parents: 10530
diff changeset
 10620
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10621
isProgrammingLanguage
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10622
    "return true if the receiver is a programming language.
14632
6fe0dc1d5377 64bit mingw changes
Claus Gittinger <cg@exept.de>
parents: 14539
diff changeset
 10623
     False is returned here - the method is only redefined in
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10624
     ProgrammingLanguage."
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10625
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10626
    ^ false
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10627
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10628
    "Created: / 21-07-2010 / 15:13:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10629
!
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 10630
9515
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
 10631
isProjectDefinition
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10632
    "return true if the receiver is a projectDefinition.
9515
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
 10633
     False is returned here - the method is only redefined in ProjectDefinition."
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
 10634
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
 10635
    ^ false
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
 10636
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
 10637
    "Created: / 10-08-2006 / 16:24:53 / cg"
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
 10638
!
89c8275e009a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9509
diff changeset
 10639
21074
2bf283840785 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 21069
diff changeset
 10640
isProtoObject
2bf283840785 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 21069
diff changeset
 10641
    ^ false
2bf283840785 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 21069
diff changeset
 10642
!
2bf283840785 #FEATURE by stefan
Stefan Vogel <sv@exept.de>
parents: 21069
diff changeset
 10643
13140
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
 10644
isProxy
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10645
    "return true if the receiver is a proxy for another (lazy loaded) object.
13140
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
 10646
     False is returned here."
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
 10647
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
 10648
    ^ false
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
 10649
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
 10650
    "Created: / 21-11-2010 / 11:15:46 / cg"
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
 10651
!
919308f42885 added: #isProxy
Claus Gittinger <cg@exept.de>
parents: 13136
diff changeset
 10652
24945
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10653
isQuadFloat
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10654
    "return true if the receiver is a quad floating point number (iee quad precision);
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10655
     false is returned here."
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10656
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10657
    ^ false
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10658
!
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10659
10171
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
 10660
isRealNameSpace
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10661
    "return true if the receiver is a NameSpace, but not Smalltalk (which is also a class).
15439
6e30547e7c1d class: Object
Claus Gittinger <cg@exept.de>
parents: 15407
diff changeset
 10662
     False is returned here - the method is redefined in Namespace and Smalltalk."
10171
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
 10663
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
 10664
    ^ false
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
 10665
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
 10666
    "Created: / 10-11-2006 / 17:05:43 / cg"
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
 10667
!
523c654f762b +isRealNameSpace
Claus Gittinger <cg@exept.de>
parents: 10062
diff changeset
 10668
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10669
isRectangle
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10670
    "return true if the receiver is some kind of rectangle;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10671
     false is returned here - the method is only redefined in Rectangle."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10672
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10673
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10674
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10675
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10676
isSequenceable
23803
b64bd0c74a03 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23796
diff changeset
 10677
    "return true if the receiver is sequenceable;
b64bd0c74a03 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23796
diff changeset
 10678
     i.e. if its elements are accessable by an integer index,
b64bd0c74a03 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23796
diff changeset
 10679
     and support the do:-protocol.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10680
     false is returned here - the method is only redefined in SequenceableCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10681
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10682
    ^ false
23803
b64bd0c74a03 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23796
diff changeset
 10683
b64bd0c74a03 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23796
diff changeset
 10684
    "Modified (comment): / 03-03-2019 / 00:09:00 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10685
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10686
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10687
isSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10688
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10689
     This method is a historic leftover and will be removed soon ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10690
     (although its name is much better than #isSequenceable - sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10691
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
 10692
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
 10693
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10694
    self obsoleteMethodWarning:'use #isSequenceable'.
17365
b3c64ee9cbf5 class: Object
Claus Gittinger <cg@exept.de>
parents: 17306
diff changeset
 10695
    ^ self isSequenceable
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10696
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10697
10856
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
 10698
isSharedPool
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10699
    "return true if the receiver is a sharedPool.
10856
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
 10700
     False is returned here - the method is only redefined in SharedPool."
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
 10701
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
 10702
    ^ false
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
 10703
!
d54db15b9761 +isSharedPool
Claus Gittinger <cg@exept.de>
parents: 10837
diff changeset
 10704
24945
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10705
isShortFloat
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10706
    "return true if the receiver is a short floating point number (iee single precision);
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10707
     false is returned here."
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10708
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10709
    ^ false
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10710
!
1e57a723fb37 #FEATURE by exept
Claus Gittinger <cg@exept.de>
parents: 24866
diff changeset
 10711
22230
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
 10712
isSingleByteCollection
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
 10713
    "return true, if the receiver has access methods for bytes;
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
 10714
     i.e. #at: and #at:put: accesses a byte and are equivalent to #byteAt: and byteAt:put:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10715
     and #replaceFrom:to: is equivalent to #replaceBytesFrom:to:.
22230
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
 10716
     This is different from 'self class isBytes'."
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
 10717
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
 10718
    ^ false
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
 10719
!
74a78be266f9 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22203
diff changeset
 10720
16770
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
 10721
isSingleByteString
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10722
    "return true if the receiver is a string or immutableString.
16772
429a8466520a class: Object
Claus Gittinger <cg@exept.de>
parents: 16770
diff changeset
 10723
     false is returned here - the method is only redefined in String.
429a8466520a class: Object
Claus Gittinger <cg@exept.de>
parents: 16770
diff changeset
 10724
     Must replace foo isMemberOf:String and foo class == String"
16770
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
 10725
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
 10726
    ^ false
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
 10727
!
9ac0b20cef5f class: Object
Claus Gittinger <cg@exept.de>
parents: 16732
diff changeset
 10728
15514
a9a6355f89d4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15501
diff changeset
 10729
isSocketAddress
a9a6355f89d4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15501
diff changeset
 10730
    ^ false
a9a6355f89d4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15501
diff changeset
 10731
!
a9a6355f89d4 class: Object
Stefan Vogel <sv@exept.de>
parents: 15501
diff changeset
 10732
13565
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
 10733
isSpecialInstrumentationInfoLiteral
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10734
    "return true if the receiver is a special instrumentation info
13565
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
 10735
     object as placed into the literal array of instrumented methods"
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
 10736
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
 10737
    ^ false
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
 10738
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
 10739
    "Created: / 07-08-2011 / 17:03:41 / cg"
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
 10740
!
4c0a9ea3a4e1 added: #isSpecialInstrumentationInfoLiteral
Claus Gittinger <cg@exept.de>
parents: 13515
diff changeset
 10741
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10742
isStream
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10743
    "return true if the receiver is some kind of stream;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10744
     false is returned here - the method is only redefined in Stream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10745
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10746
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10747
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10748
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10749
isString
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10750
    "return true if the receiver is some kind of string;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10751
     false is returned here - the method is only redefined in CharacterArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10752
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10753
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10754
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10756
isStringCollection
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10757
    "return true if the receiver is some kind of stringCollection;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10758
     false is returned here - the method is only redefined in StringCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10759
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10760
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10761
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10762
20535
204bd187c16f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20534
diff changeset
 10763
isStructure
204bd187c16f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20534
diff changeset
 10764
    "redefined in Structure>>#doesNotUnderstand"
204bd187c16f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20534
diff changeset
 10765
204bd187c16f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20534
diff changeset
 10766
    ^ false
204bd187c16f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20534
diff changeset
 10767
!
204bd187c16f #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20534
diff changeset
 10768
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10769
isSymbol
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10770
    "return true if the receiver is some kind of symbol;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10771
     false is returned here - the method is only redefined in Symbol."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10772
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10773
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10774
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10775
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10776
isText
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10777
    "return true if the receiver is some kind of text object;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10778
     false is returned here - the method is only redefined in Text."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10779
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10780
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10781
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10782
    "Created: 12.5.1996 / 10:56:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10783
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10784
13656
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
 10785
isTextView
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10786
    "return true if the receiver is some kind of textView;
13656
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
 10787
     false is returned here - the method is only redefined in TextViews."
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
 10788
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
 10789
    ^ false
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
 10790
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
 10791
    "Modified (comment): / 08-09-2011 / 05:12:37 / cg"
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
 10792
!
46e673aac938 added: #isTextView
Claus Gittinger <cg@exept.de>
parents: 13626
diff changeset
 10793
16349
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10794
isTimeDuration
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10795
    "return true if the receiver is some kind of time duration;
16349
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10796
     false is returned here - the method is only redefined in TimeDuration."
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10797
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10798
    ^ false
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10799
!
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10800
13229
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
 10801
isTimestamp
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10802
    "return true if the receiver is some kind of time duration;
16349
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10803
     false is returned here - the method is only redefined in Timestamp."
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10804
13229
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
 10805
    ^ false
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
 10806
!
187ab17bc43d added: #isTimestamp
Stefan Vogel <sv@exept.de>
parents: 13190
diff changeset
 10807
13626
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
 10808
isTrait
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
 10809
    "Return true if the receiver is a trait.
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
 10810
     Note: Do not override in any class except TraitBehavior."
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
 10811
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
 10812
    ^ false
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
 10813
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
 10814
    "Created: / 04-09-2011 / 20:04:43 / cg"
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
 10815
!
057aa930d735 added: #isTrait
Claus Gittinger <cg@exept.de>
parents: 13578
diff changeset
 10816
21480
20b4ddb4ba7a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21432
diff changeset
 10817
isURL
20b4ddb4ba7a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21432
diff changeset
 10818
    "Return true if the receiver is a url.
20b4ddb4ba7a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21432
diff changeset
 10819
     Note: Do not override in any class except URL."
20b4ddb4ba7a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21432
diff changeset
 10820
20b4ddb4ba7a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21432
diff changeset
 10821
    ^ false
20b4ddb4ba7a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21432
diff changeset
 10822
20b4ddb4ba7a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21432
diff changeset
 10823
    "Created: / 17-02-2017 / 10:25:12 / cg"
20b4ddb4ba7a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21432
diff changeset
 10824
!
20b4ddb4ba7a #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 21432
diff changeset
 10825
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
 10826
isUUID
16349
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10827
    "Return true if the receiver is a uuid.
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10828
     Note: Do not override in any class except UUID."
ef173d25b20c class: Object
Claus Gittinger <cg@exept.de>
parents: 16342
diff changeset
 10829
14296
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
 10830
    ^ false
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
 10831
!
fe82bc5091f9 added: #isUUID
Stefan Vogel <sv@exept.de>
parents: 14292
diff changeset
 10832
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10833
isValueModel
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10834
    "return true if the receiver is some kind of valueModel;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10835
     false is returned here - the method is only redefined in ValueModel."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10836
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10837
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10838
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10839
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10840
isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10841
    "return true if the receiver has indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10842
     false otherwise."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10843
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10844
    ^ self class isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10845
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10846
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10847
isVariableBinding
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10848
    "return true if this is a binding for a variable.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10849
     false is returned here - the method is only redefined in Binding."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10850
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10851
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10852
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10853
    "Created: / 19.6.1997 / 17:38:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10854
    "Modified: / 8.5.1998 / 21:26:55 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10855
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10856
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10857
isView
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10858
    "return true if the receiver is some kind of view;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10859
     false is returned here - the method is only redefined in View."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10860
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10861
    ^ false
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10862
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10863
15943
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
 10864
isViewBackground
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
 10865
    "return false here; to be redefined in subclass(es)"
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
 10866
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
 10867
    ^ false
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
 10868
!
e232d88d7157 class: Object
Claus Gittinger <cg@exept.de>
parents: 15942
diff changeset
 10869
20939
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10870
isVoid
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10871
    "Return true if the receiver is void.
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10872
     This is (and should only be) redefined in VoidObject,
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10873
     for the one and only instance of it, void"
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10874
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10875
    ^ false
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10876
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10877
    "
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10878
     nil isVoid
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10879
     void isVoid
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10880
    "
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10881
!
9e6fa8c7273c #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20839
diff changeset
 10882
18802
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
 10883
isWeakCollection
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10884
    "return true if the receiver has weak references to its elements."
18802
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
 10885
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
 10886
    ^ false
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
 10887
!
8966fcaa112d #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18799
diff changeset
 10888
6932
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
 10889
notEmptyOrNil
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
 10890
    "Squeak compatibility:
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
 10891
     return true if I am neither nil nor an empty collection.
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
 10892
     Return true here."
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
 10893
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
 10894
    ^ true
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
 10895
!
1e1d296d4747 + #notEmptyOrNil
penk
parents: 6926
diff changeset
 10896
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10897
notNil
20214
bf72e175ec13 #DOCUMENTATION by mawalch
mawalch
parents: 20184
diff changeset
 10898
    "Return true if the receiver is not nil.
9221
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
 10899
     Because notNil is redefined in UndefinedObject,
d8fff4a78065 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9216
diff changeset
 10900
     the receiver is definitely not nil here, so unconditionally return true.
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10901
     Notice:
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10902
	This method is open coded (inlined) by the compiler(s)
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10903
	- redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10904
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
 10905
    ^ true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10906
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10907
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10908
!Object methodsFor:'tracing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10909
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10910
traceInto:aRequestor level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10911
    "double dispatch into tracer, passing my type implicitely in the selector"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10912
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10913
    ^ aRequestor traceObject:self level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10914
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10915
    "Created: / 2.9.1999 / 09:05:17 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10916
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10917
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10918
!Object methodsFor:'user interaction & notifications'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10919
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10920
activityNotification:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10921
    "this can be sent from deeply nested methods, which are going to perform
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10922
     some long-time activity.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10923
     If there is a handler for the ActivityNotificationSignal signal, that one is raised,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10924
     passing the argument. The handler should show this message whereever it likes,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10925
     and proceed. If there is no handler, this is simply ignored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10926
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10927
     This is very useful to pass busy messages up to some higher level (typically a view)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10928
     which likes to display that message in its label or a busy-box.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10929
     It could also be put into some logfile or printed on the standard output/error."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10930
23403
b41e34660e82 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23390
diff changeset
 10931
    ^ ActivityNotification raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10932
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10933
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10934
     nil activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10935
     self activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10936
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10937
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10938
    "
8330
15ef95301861 Convert more instance based exceptions to class based exceptions
Stefan Vogel <sv@exept.de>
parents: 8324
diff changeset
 10939
     ActivityNotification handle:[:ex |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10940
	ex errorString printCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10941
	ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10942
     ] do:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10943
	'hello' printCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10944
	self activityNotification:'doing some long time computation'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10945
	'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10946
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10947
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10948
23403
b41e34660e82 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23390
diff changeset
 10949
    "Modified: / 16-12-1995 / 18:23:42 / cg"
b41e34660e82 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 23390
diff changeset
 10950
    "Modified (comment): / 05-10-2018 / 17:42:02 / Claus Gittinger"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10951
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10952
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10953
confirm:aString
9694
64f6face84d5 comment
Claus Gittinger <cg@exept.de>
parents: 9657
diff changeset
 10954
    "open a modal yes-no dialog.
64f6face84d5 comment
Claus Gittinger <cg@exept.de>
parents: 9657
diff changeset
 10955
     Return true for yes, false for no.
10527
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10956
     If no GUI is present (headless applications), true is returned.
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10957
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10958
     Someone in the sender chain may redefine the confirmation handler
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10959
     by handling the UserConfirmation."
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10960
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10961
    ^ UserConfirmation raiseRequestErrorString:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10962
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10963
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10964
     nil confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10965
     self confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10966
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10967
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10968
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10969
confirm:aString orCancel:cancelBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10970
    "launch a confirmer, which allows user to enter yes, no or cancel.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10971
     return true for yes, false for no, or the value from cancelBlock for cancel.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10972
     If no GUI is present (headless applications), cancelBlock is returned."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10973
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10974
    |answer|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10975
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10976
    answer := self confirmWithCancel:aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10977
    answer isNil ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 10978
	^ cancelBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10979
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10980
    ^ answer
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10981
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10982
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10983
     self confirm:'hello' orCancel:[self halt]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10984
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10985
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10986
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10987
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10989
confirmWithCancel:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10990
    "launch a confirmer, which allows user to enter yes, no or cancel.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 10991
     return true for yes, false for no, nil for cancel.
10527
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10992
     If no GUI is present (headless applications), nil is returned.
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10993
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10994
     Someone in the sender chain may redefine the confirmation handler
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10995
     by handling the UserConfirmation."
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 10996
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 10997
    ^ self confirmWithCancel:aString defaultAnswer:nil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10998
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 10999
    "
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 11000
     nil confirmWithCancel:'hello'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11001
     self confirmWithCancel:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11002
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11003
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11004
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11005
confirmWithCancel:aString defaultAnswer:defaultAnswerOrNil
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11006
    "launch a confirmer, which allows user to enter yes, no or cancel.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11007
     return true for yes, false for no, nil for cancel.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11008
     If no GUI is present (headless applications), nil is returned.
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11009
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11010
     Someone in the sender chain may redefine the confirmation handler
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11011
     by handling the UserConfirmation."
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11012
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11013
    ^ UserConfirmation new
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11014
	defaultAnswer:defaultAnswerOrNil;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11015
	canCancel:true;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11016
	messageText:aString;
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11017
	raiseRequest
11366
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11018
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11019
    "
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11020
     nil confirmWithCancel:'hello' defaultAnswer:true
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11021
     self confirmWithCancel:'hello' defaultAnswer:false
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11022
    "
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11023
!
97a8331d3e4c + confirmWithCancel defaultAnswer
Claus Gittinger <cg@exept.de>
parents: 11339
diff changeset
 11024
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11025
errorNotify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11026
    "launch a Notifier, showing top stack, telling user something
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11027
     and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11028
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11029
    ^ self
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11030
	errorNotify:aString
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11031
	from:thisContext sender
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11032
	allowDebug:true
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11033
	mayProceed:true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11034
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11035
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11036
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11037
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11038
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11039
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
 11040
    "Modified: / 16.11.2001 / 15:36:49 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11041
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11042
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11043
errorNotify:aString from:aContext
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 11044
    "launch a Notifier, showing top stack (above aContext),
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11045
     telling user something and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11046
15255
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 11047
    ^ self errorNotify:aString from:aContext allowDebug:true mayProceed:true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11048
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11049
    "Modified: / 17.8.1998 / 10:09:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11050
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11051
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11052
errorNotify:aString from:aContext allowDebug:allowDebug
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 11053
    "launch a Notifier, showing top stack (above aContext),
15255
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 11054
     telling user something and give user a chance to enter debugger."
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 11055
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 11056
    ^ self errorNotify:aString from:aContext allowDebug:allowDebug mayProceed:true
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 11057
!
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 11058
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 11059
errorNotify:aString from:aContext allowDebug:allowDebug mayProceed:mayProceed
62f7d4655ba8 class: Object
Stefan Vogel <sv@exept.de>
parents: 15243
diff changeset
 11060
    "launch a Notifier, showing top stack (above aContext),
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11061
     telling user something and optionally give the user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11062
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
 11063
    |currentScreen con sender action boxLabels boxValues default s|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11064
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11065
    Smalltalk isInitialized ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11066
	'errorNotification: ' print. aString printCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11067
	con := aContext ? thisContext methodHome.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11068
	con sender printAllLevels:10.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11069
	^ nil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 11070
    ].
11531
30f1ba816a81 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11530
diff changeset
 11071
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 11072
    (Dialog isNil
6647
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
 11073
     or:[Screen isNil
79c298b93c07 #errorNotify -- allow copying the backtrace
Stefan Vogel <sv@exept.de>
parents: 6631
diff changeset
 11074
     or:[(currentScreen := Screen current) isNil
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 11075
     or:[currentScreen isOpen not]]]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11076
	"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11077
	 on systems without GUI, simply show
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11078
	 the message on the Transcript and abort.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11079
	"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11080
	Transcript showCR:aString.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11081
	AbortOperationRequest raise.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11082
	"not reached"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11083
	^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11084
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11085
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11086
    Processor activeProcessIsSystemProcess ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11087
	action := #debug.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11088
	sender := aContext.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11089
	Debugger isNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11090
	    '****************** Caught Error while in SystemProcess ****************' errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11091
	    aString errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11092
	    Exception handle:[:ex |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11093
		'Caught recursive error while printing backtrace:' errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11094
		ex description errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11095
	    ] do:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11096
		thisContext fullPrintAll.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11097
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11098
	    action := #abort.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11099
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11100
    ] ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11101
	Dialog autoload.        "in case it is autoloaded"
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11102
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11103
	Error handle:[:ex |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11104
	    "/ a recursive error - quickly enter debugger
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11105
	    "/ this happened, when I corrupted the Dialog class ...
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11106
	    ('Object [error]: ' , ex description , ' caught in errorNotification') errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11107
	    action := #debug.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11108
	    ex return.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11109
	] do:[ |s|
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11110
	    sender := aContext.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11111
	    sender isNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11112
		sender := thisContext methodHome sender.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11113
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11114
	    con := sender.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11115
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11116
	    "/ skip intermediate (signal & exception) contexts
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11117
	    DebugView notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11118
		con := DebugView interestingContextFrom:sender
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11119
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11120
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11121
	    "/ show the first few contexts
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11122
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11123
	    s := CharacterWriteStream with:aString.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11124
	    s cr; cr.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11125
	    s nextPutLine:'Calling Chain:'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11126
	    s nextPutLine:'--------------------------------------------------------------'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11127
	    1 to:25 do:[:n |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11128
		con notNil ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11129
		    con printOn:s.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11130
		    s cr.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11131
		    con := con sender
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11132
		]
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11133
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11134
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11135
	    mayProceed ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11136
		boxLabels := #('Proceed').
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11137
		boxValues := #(#proceed).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11138
		default := #proceed.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11139
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11140
		boxLabels := #().
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11141
		boxValues := #().
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11142
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11143
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11144
	    AbortOperationRequest isHandled ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11145
		default := #abort.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11146
		boxLabels := boxLabels , #('Abort').
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11147
		boxValues := boxValues , #(#abort).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11148
		AbortAllOperationRequest isHandled ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11149
		    boxLabels := boxLabels , #('Abort All').
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11150
		    boxValues := boxValues , #(#abortAll).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11151
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11152
		true "allowDebug" ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11153
		    boxLabels := boxLabels , #('Copy Error Details to Clipboard and Abort').
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11154
		    boxValues := boxValues , #(#copyAndAbort).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11155
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11156
	    ] ifFalse:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11157
		mayProceed "and:[allowDebug]" ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11158
		    boxLabels := boxLabels , #('Copy Error Details to Clipboard and Proceed').
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11159
		    boxValues := boxValues , #(#copyAndProceed).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11160
		].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11161
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11162
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11163
	    (allowDebug and:[Debugger notNil]) ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11164
		boxLabels := boxLabels , #('Debug').
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11165
		boxValues := boxValues , #(#debug).
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11166
		default := #debug.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11167
	    ].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11168
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11169
	    action := Dialog
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11170
		    choose:s contents
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11171
		    label:('Exception [' , Processor activeProcess nameOrId , ']')
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11172
		    image:WarningBox errorIconBitmap
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11173
		    labels:boxLabels
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11174
		    values:boxValues
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11175
		    default:default
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11176
		    onCancel:nil.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11177
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11178
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11179
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11180
    action == #debug ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11181
	^ Debugger enter:sender withMessage:aString mayProceed:mayProceed
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
 11182
    ].
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
 11183
    action == #proceed ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11184
	^ nil.
11335
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
 11185
    ].
c061d08b766f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11314
diff changeset
 11186
    (action == #copyAndProceed
23514
2e8a181fb47b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23513
diff changeset
 11187
     or:[action == #copyAndAbort]) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11188
	s := '' writeStream.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11189
	Exception handle:[:ex |
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11190
	    'Caught recursive error while printing backtrace' errorPrintCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11191
	] do:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11192
	    sender fullPrintAllOn:s.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11193
	].
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11194
	currentScreen rootView setClipboardText:s contents.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11195
	action == #copyAndProceed ifTrue:[
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11196
	    ^ nil
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11197
	].
17306
29dcfbfb331c class: Object
Claus Gittinger <cg@exept.de>
parents: 17261
diff changeset
 11198
    ].
29dcfbfb331c class: Object
Claus Gittinger <cg@exept.de>
parents: 17261
diff changeset
 11199
    (action == #abortAll) ifTrue:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11200
	AbortAllOperationRequest raise
18215
5940d5eff81b java preps
Claus Gittinger <cg@exept.de>
parents: 18185
diff changeset
 11201
    ].
11314
0b6e06b60ebe changed the error-notifier for standAlone apps.
Claus Gittinger <cg@exept.de>
parents: 11244
diff changeset
 11202
11236
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
 11203
    AbortOperationRequest raise.
c196f9dedf66 exception description in debugger
Claus Gittinger <cg@exept.de>
parents: 11221
diff changeset
 11204
    "not reached"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11205
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11206
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11207
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11208
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11209
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11210
13165
66a6b37405d1 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13162
diff changeset
 11211
    "Created: / 17-08-1998 / 10:09:26 / cg"
13566
fc4e1055263d changed: #errorNotify:from:allowDebug:
sr
parents: 13565
diff changeset
 11212
    "Modified: / 08-08-2011 / 11:26:17 / sr"
13844
f03a655457f4 changed: #errorNotify:from:allowDebug:
Claus Gittinger <cg@exept.de>
parents: 13812
diff changeset
 11213
    "Modified: / 05-12-2011 / 03:50:59 / cg"
23514
2e8a181fb47b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 23513
diff changeset
 11214
    "Modified: / 06-11-2018 / 18:05:17 / Stefan Vogel"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11215
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11216
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11217
information:aString
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 11218
    "launch an InfoBox, telling user something.
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 11219
     These info-boxes can be suppressed by handling
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11220
     UserNotification or InformationSignal and proceeding in the handler.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11221
     Use #notify: for more important messages.
8371
4493f5ac7405 *** empty log message ***
ca
parents: 8330
diff changeset
 11222
     If nobody handles the exception, the default action of UserNotification
10527
b783c0000f54 #confirm: now uses the UserConfirmation otification to request an answer
Stefan Vogel <sv@exept.de>
parents: 10480
diff changeset
 11223
     pops up an info dialog."
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11224
7035
1d049fb7ae5a Make UserInformation a class based exception
Stefan Vogel <sv@exept.de>
parents: 7033
diff changeset
 11225
    UserInformation raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11226
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11227
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11228
     nil information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11229
     self information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11230
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11231
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11232
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11233
     InformationSignal handle:[:ex |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11234
	'no box popped' printCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11235
	ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11236
     ] do:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11237
	'hello' printCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11238
	self information:'some info'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11239
	'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11240
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11241
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11242
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11243
    "Modified: 24.11.1995 / 22:29:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11244
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11245
24140
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11246
logFacility
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11247
    "the 'log facility';
24319
56927fde4d4c honor mutability flag
Claus Gittinger <cg@exept.de>
parents: 24298
diff changeset
 11248
     this is used by the Logger both as a prefix to the log message,
24140
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11249
     and maybe (later) used to filter and/or control per-facility log thresholds.
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11250
     The default here is to base the facility on my class"
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11251
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11252
    ^ self class logFacility
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11253
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11254
    "Created: / 24-05-2019 / 01:03:49 / Claus Gittinger"
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11255
!
e58984061646 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 24137
diff changeset
 11256
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11257
notify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11258
    "launch a Notifier, telling user something.
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11259
     Use #information: for ignorable messages.
21272
f7669b134b8b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 21258
diff changeset
 11260
     If nobody handles the exception, the default action of UserNotification
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11261
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11262
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11263
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11264
    Smalltalk isInitialized ifFalse:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11265
	"/ thisContext fullPrintAll.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11266
	'information: ' print. aString printCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11267
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11268
    ].
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11269
    UserNotification raiseRequestWith:self errorString:aString.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11270
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11271
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11272
     nil notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11273
     self notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11274
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11275
21272
f7669b134b8b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 21258
diff changeset
 11276
    "Modified: / 20-05-1996 / 10:28:48 / cg"
f7669b134b8b #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 21258
diff changeset
 11277
    "Modified (comment): / 23-01-2017 / 16:17:50 / stefan"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11278
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11279
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11280
warn:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11281
    "launch a WarningBox, telling user something.
10460
8495429eba05 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10457
diff changeset
 11282
     These warn-boxes can be suppressed by handling the
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11283
     UserNotification- or WarningSignal and proceeding in the handler.
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11284
     If nobody handles the exception, the dafault action of Warning
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11285
     pops up a warn dialog."
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11286
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11287
    Warning raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11288
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11289
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11290
     nil warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11291
     self warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11292
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11293
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11294
    "
7033
c4183ea85a71 Now Warning is a subclass of UserNotification.
Stefan Vogel <sv@exept.de>
parents: 7031
diff changeset
 11295
     Warning handle:[:ex |
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11296
	Transcript showCR:ex description.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11297
	ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11298
     ] do:[
23571
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11299
	'hello' printCR.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11300
	self warn:'some info'.
4aa9bc1a2076 extra filename arg to __dumpObject__
Claus Gittinger <cg@exept.de>
parents: 23569
diff changeset
 11301
	'world' printCR.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11302
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11303
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11304
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11305
    "Modified: 20.5.1996 / 10:28:53 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11306
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11307
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 11308
!Object methodsFor:'visiting'!
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 11309
8426
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 11310
acceptVisitor:aVisitor
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 11311
    "double-dispatch onto a Visitor."
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 11312
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 11313
    ^ self acceptVisitor:aVisitor with:nil
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 11314
!
b4195c5f9450 +acceptVisitor
Claus Gittinger <cg@exept.de>
parents: 8413
diff changeset
 11315
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 11316
acceptVisitor:aVisitor with:aParameter
16732
4ba89483ebfa comment/format only
Claus Gittinger <cg@exept.de>
parents: 16591
diff changeset
 11317
    "double-dispatch via visitObject:with: into a Visitor.
4ba89483ebfa comment/format only
Claus Gittinger <cg@exept.de>
parents: 16591
diff changeset
 11318
     Subclasses redefine this to pass their type in the message name (i.e. visitXXX:)"
8397
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 11319
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 11320
    ^ aVisitor visitObject:self with:aParameter
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 11321
! !
a1cff241e853 Generalize visitor pattern and define #visit...:with: -methods instead
Stefan Vogel <sv@exept.de>
parents: 8383
diff changeset
 11322
25046
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
 11323
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
 11324
4090d25e8f33 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 24977
diff changeset
 11325
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11326
!Object class methodsFor:'documentation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
 11327
14056
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
 11328
version
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18440
diff changeset
 11329
    ^ '$Header$'
14056
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
 11330
!
24d7f7bf46c7 inspector2TabForBasicInspect
Claus Gittinger <cg@exept.de>
parents: 14055
diff changeset
 11331
12050
bd0013f79e4f added: #notYetImplemented
Claus Gittinger <cg@exept.de>
parents: 11976
diff changeset
 11332
version_CVS
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18440
diff changeset
 11333
    ^ '$Header$'
20538
606af0e9fd86 fix typo
Stefan Vogel <sv@exept.de>
parents: 20535
diff changeset
 11334
! !
13416
6eb7ca0bdd35 Jan's changes
vrany
parents: 13350
diff changeset
 11335
20762
e2a745bdd401 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20538
diff changeset
 11336
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
 11337
Object initialize!