Object.st
author Stefan Vogel <sv@exept.de>
Tue, 07 May 2002 18:57:28 +0200
changeset 6537 7906825ad5c3
parent 6533 8396a7332890
child 6549 8664491c4428
permissions -rw-r--r--
Do not allow to proceed in debugger on SIGSEGV
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     1
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     2
 COPYRIGHT (c) 1988 by Claus Gittinger
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
     3
	      All Rights Reserved
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     4
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     5
 This software is furnished under a license and may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     6
 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
     7
 inclusion of the above copyright notice.   This software may not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     8
 be provided or otherwise made available to, or used by, any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
     9
 other person.  No title to or ownership of the software is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    10
 hereby transferred.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    11
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    12
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    13
"{ Package: 'stx:libbasic' }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    14
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    15
nil subclass:#Object
6157
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    16
	instanceVariableNames:''
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    17
	classVariableNames:'ErrorSignal HaltSignal MessageNotUnderstoodSignal
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    18
		UserInterruptSignal RecursionInterruptSignal
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    19
		ExceptionInterruptSignal SubscriptOutOfBoundsSignal
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    20
		IndexNotFoundSignal NonIntegerIndexSignal NotFoundSignal
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    21
		KeyNotFoundSignal ElementOutOfBoundsSignal UserNotificationSignal
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    22
		InformationSignal WarningSignal PrimitiveFailureSignal
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    23
		DeepCopyErrorSignal AbortSignal ErrorRecursion Dependencies
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    24
		InfoPrinting ActivityNotificationSignal InternalErrorSignal
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    25
		NonWeakDependencies SynchronizationSemaphores ObjectAttributes
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    26
		OSSignalInterruptSignal FinalizationLobby
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    27
		RecursiveStoreStringSignal AbortAllSignal'
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    28
	poolDictionaries:''
5b61e11fc4dd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6146
diff changeset
    29
	category:'Kernel-Objects'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    30
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    31
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    32
!Object class methodsFor:'documentation'!
3023
674376809496 general listView support (#displayOn / widthOn / heightOn)
ca
parents: 3010
diff changeset
    33
5754
333aba8041c2 checkin from browser
tm
parents: 5706
diff changeset
    34
copyright
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
 COPYRIGHT (c) 1988 by Claus Gittinger
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
    37
	      All Rights Reserved
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    38
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    39
 This software is furnished under a license and may be used
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    40
 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
    41
 inclusion of the above copyright notice.   This software may not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    42
 be provided or otherwise made available to, or used by, any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    43
 other person.  No title to or ownership of the software is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    44
 hereby transferred.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    45
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    46
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    47
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    48
dependencies
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    49
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    50
   ST/X dependencies are slightly modified from ST-80's 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    51
   (we think they are better ;-).
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
   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
    54
   cannot be garbage collected because some dependency is present,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    55
   having the object as a dependent of some other object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    56
   In ST-80, this association remains alive (because a Dictionary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    57
   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
    58
   to dependent or the dependee.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    59
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    60
   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
    61
   prevent memory leaks.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    62
   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
    63
   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
    64
   need to care about dependencies.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    65
   From a philosophical point of view, why should some object depend on 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    66
   something that the programmer considers a dead object ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    67
   (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
    68
    that behavior)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    69
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    70
   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
    71
   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
    72
   so these dependents go away, once the model is reclaimed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    73
   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
    74
   needed, with general objects it is mandatory.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    75
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    76
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    77
   In ST/X, dependencies are implemented using a WeakDictionary; this means,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    78
   that once the dependee dies, the dependency association is removed automatically,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    79
   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
    80
   references exist to the dependent.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    81
   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
    82
   (in case your application heavily depends on the ST-80 mechanism), complementary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    83
   protocol to add nonWeak dependencies is provided 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    84
   (see #addNonWeakDependent / #removeNonWeakDependent).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    85
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    86
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    87
   Caveat:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    88
      since interests are implemented using InterestConverter (which are simply
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    89
      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
    90
      automatically).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    91
      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
    92
      and those would be reclaimed if stored in a weakDictionary.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    93
      This means, that those interests MUST be removed with #retractInterest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    94
      (which is bug-compatible to ST-80). 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    95
      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
    96
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    97
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
    98
   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
    99
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   100
!
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
documentation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   103
"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   104
   Object is the superclass of most other classes. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   105
   (except for nil-subclasses, which inherit nothing,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   106
    to catch any message into their #doesNotUnderstand: method)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   107
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   108
   Protocol which is common to every object is defined here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   109
   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
   110
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   111
   Object has no instance variables (and may not get any added). One reason is, that
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   112
   UndefinedObject and SmallInteger are also inheriting from Object - these two cannot 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   113
   have instance variables (due to their implementation). 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   114
   The other reason is that the runtime system (VM) knows about the layout of some built-in 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   115
   classes (think of Class, Method, Block and also Integer or Float). 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   116
   If you were allowed to add instance variables to Object, the VM had to be recompiled 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   117
   (and also rewritten in some places).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   118
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   119
   [Class variables:]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   120
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   121
	ErrorSignal     <Signal>        Signal raised for error/error: messages
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   122
					also, parent of all other signals.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   123
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   124
	HaltSignal      <Signal>        Signal raised for halt/halt: messages
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   125
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   126
	MessageNotUnderstoodSignal      Signals raised for various error conditions
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   127
	UserInterruptSignal
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   128
	RecursionInterruptSignal 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   129
	ExceptionInterruptSignal
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   130
	SubscriptOutOfBoundsSignal 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   131
	NonIntegerIndexSignal
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   132
	NotFoundSignal 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   133
	KeyNotFoundSignal 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   134
	ElementOutOfBoundsSignal
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   135
	InformationSignal
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   136
	WarningSignal
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   137
	DeepCopyErrorSignal
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   138
	InternalErrorSignal
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   139
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   140
	AbortSignal      <Signal>       Signal raised by debugger, to abort a computation
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   141
					BUT, the debugger will only raise it if it is handled.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   142
					By handling the abortSignal, you can control where the
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   143
					debuggers abort-function resumes execution in case of
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   144
					an error.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   145
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   146
	ErrorRecursion   <Boolean>      controls behavior when recursive errors occur (i.e. 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   147
					an error while handling an error).
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   148
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   149
	Dependencies     <WeakDependencyDictionary>  
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   150
					keeps track of object dependencies.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   151
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   152
	InfoPrinting     <Boolean>      controls weather informational messages 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   153
					are printed.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   154
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   155
	ActivityNotificationSignal <QuerySignal> 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   156
					 raised on #activityNotification:
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   157
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   158
	NonWeakDependencies <Dictionary> keeps track of object dependencies.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   159
					 Dependents stay alive.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   160
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   161
	SynchronizationSemaphores <WeakIdentityDictionary>
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   162
					 Semaphores for per-object-monitor.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   163
                                        
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   164
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   165
    [author:]
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   166
	Claus Gittinger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   167
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   168
"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   171
!Object class methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   172
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   173
initSignals
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   174
    "called only once - initialize signals"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   175
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   176
    ErrorSignal := Error.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   177
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   178
    ControlInterrupt notifierString:'control interrupted'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   179
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   180
"/    HaltSignal := ControlInterrupt newSignalMayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   181
"/    HaltSignal nameClass:self message:#haltSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   182
    HaltSignal := HaltInterrupt.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   183
    HaltSignal notifierString:'halt encountered'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   184
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   185
"/    MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   186
"/    MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   187
    MessageNotUnderstoodSignal := MessageNotUnderstood.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   188
    MessageNotUnderstoodSignal notifierString:'message not understood'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   189
6000
d6fbafc5879e more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   190
"/    PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true.
d6fbafc5879e more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   191
"/    PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal.
d6fbafc5879e more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5995
diff changeset
   192
    PrimitiveFailureSignal := PrimitiveFailure.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   193
    PrimitiveFailureSignal notifierString:'primitive failed'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   194
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   195
    InternalErrorSignal := ErrorSignal newSignalMayProceed:false.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   196
    InternalErrorSignal nameClass:self message:#internalErrorSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   197
    InternalErrorSignal notifierString:'VM internal error: '.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   198
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   199
"/        UserInterruptSignal := (Signal new) mayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   200
"/    UserInterruptSignal := ControlInterrupt newSignalMayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   201
"/    UserInterruptSignal nameClass:self message:#userInterruptSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   202
    UserInterruptSignal := UserInterrupt.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   203
    UserInterruptSignal notifierString:'user Interrupt'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   204
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   205
"/        RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false.
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   206
"/    RecursionInterruptSignal := (Signal new) mayProceed:true.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   207
"/    RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   208
    RecursionInterruptSignal := RecursionError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   209
    RecursionInterruptSignal notifierString:'recursion limit reached'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   210
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   211
    ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   212
    ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   213
    ExceptionInterruptSignal notifierString:'exception Interrupt'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   214
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   215
"/    NotFoundSignal := ErrorSignal newSignalMayProceed:true.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   216
"/    NotFoundSignal nameClass:self message:#notFoundSignal.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   217
    NotFoundSignal := NotFoundError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   218
    NotFoundSignal notifierString:'no such element'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   219
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   220
"/    IndexNotFoundSignal := NotFoundSignal newSignalMayProceed:true.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   221
"/    IndexNotFoundSignal nameClass:self message:#indexNotFoundSignal.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   222
    IndexNotFoundSignal := IndexNotFoundError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   223
    IndexNotFoundSignal notifierString:'bad index: '.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   224
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   225
"/    SubscriptOutOfBoundsSignal := IndexNotFoundSignal newSignalMayProceed:true.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   226
"/    SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   227
    SubscriptOutOfBoundsSignal := SubscriptOutOfBoundsError.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   228
    SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   229
5977
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   230
"/    NonIntegerIndexSignal := IndexNotFoundSignal newSignalMayProceed:true.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   231
"/    NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   232
    NonIntegerIndexSignal := NonIntegerIndexError.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   233
    NonIntegerIndexSignal notifierString:'index must be integer'.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   234
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   235
    KeyNotFoundSignal := NotFoundSignal newSignalMayProceed:true.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   236
    KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   237
    KeyNotFoundSignal notifierString:'no such key: '.
1aa80a42ed64 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5971
diff changeset
   238
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   239
    ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   240
    ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   241
    ElementOutOfBoundsSignal notifierString:'element not appropriate or out of bounds'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   242
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   243
    UserNotificationSignal := QuerySignal new.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   244
    UserNotificationSignal nameClass:self message:#userNotificationSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   245
    UserNotificationSignal notifierString:'user notifiaction wanted'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   246
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   247
    InformationSignal := UserNotificationSignal newSignalMayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   248
    InformationSignal nameClass:self message:#informationSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   249
    InformationSignal notifierString:'information'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   250
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   251
    WarningSignal := UserNotificationSignal newSignalMayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   252
    WarningSignal nameClass:self message:#warningSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   253
    WarningSignal notifierString:'warning'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   254
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   255
    ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   256
    ActivityNotificationSignal nameClass:self message:#activityNotificationSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   257
    ActivityNotificationSignal notifierString:'activity'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   258
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   259
    DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   260
    DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   261
    DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   262
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   263
    "
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   264
     AbortSignal is not a child of ErrorSignal -
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   265
     this would complicate abort from within a signal handler
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   266
    "
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   267
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   268
"/    AbortSignal := Signal genericSignal newSignalMayProceed:true.
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   269
"/    AbortSignal nameClass:self message:#abortSignal.
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   270
    AbortSignal := AbortOperationRequest.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   271
    AbortSignal notifierString:'unhandled abort signal'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   272
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   273
    AbortAllSignal := Signal genericSignal newSignalMayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   274
    AbortAllSignal nameClass:self message:#abortAllSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   275
    AbortAllSignal notifierString:'unhandled abortAll signal'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   276
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   277
    "
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   278
     OSSignalInterruptSignal is not a child of ErrorSignal -
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   279
     it requires explicit catching.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   280
     If unhandled, a debugger is entered.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   281
    "
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   282
    OSSignalInterruptSignal := Signal genericSignal newSignalMayProceed:true.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   283
    OSSignalInterruptSignal nameClass:self message:#osSignalInterruptSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   284
    OSSignalInterruptSignal notifierString:'OS signal interrupt'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   285
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   286
    RecursiveStoreStringSignal := QuerySignal new.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   287
    RecursiveStoreStringSignal nameClass:self message:#recursiveStoreStringSignal.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   288
    RecursiveStoreStringSignal notifierString:'attempt to generate storeString of recursive object'.
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   289
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   290
    SubclassResponsibilityError notifierString:'subclass responsibility'.
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   291
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   292
    "
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   293
     Object initSignals
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   294
    "
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   295
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   296
    "Modified: / 22.1.1998 / 21:23:40 / av"
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   297
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
6203
d39d75849383 class based exceptions - abortSignal
Claus Gittinger <cg@exept.de>
parents: 6199
diff changeset
   298
    "Modified: / 16.11.2001 / 16:30:08 / cg"
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   299
!
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   300
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   301
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   302
    "called only once - initialize signals"
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
    ErrorSignal isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   305
	self initSignals
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   306
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   307
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   308
    ObjectAttributes isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   309
	ObjectAttributes := WeakIdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   310
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   311
    Dependencies isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   312
	Dependencies := WeakDependencyDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   313
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   314
    NonWeakDependencies isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   315
	NonWeakDependencies := IdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   316
    ].
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   317
    SynchronizationSemaphores isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   318
	SynchronizationSemaphores := WeakIdentityDictionary new.
5971
686ef746dacc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5926
diff changeset
   319
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   320
    FinalizationLobby isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   321
	FinalizationLobby := Registry new.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   322
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   323
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   324
    "/ initialize InfoPrinting to the VM's infoPrint setting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   325
    "/ (which can be turned off via a command line argument)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   326
    InfoPrinting := ObjectMemory infoPrinting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   327
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   328
    "Object initialize"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   329
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   330
    "Modified: / 22.1.1998 / 21:23:40 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   331
    "Modified: / 3.2.1998 / 18:55:09 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   332
    "Modified: / 4.8.1999 / 08:54:06 / stefan"
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
!Object class methodsFor:'Compatibility - ST80'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   336
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   337
rootError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   338
    "return the signal used for error/error: - handling.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   339
     Same as errorSignal for ST80 compatibility."
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
    ^ ErrorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   342
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   343
    "Created: / 15.1.1998 / 23:47:05 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   344
! !
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
!Object class methodsFor:'Signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   347
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   348
abortAllSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   349
    "return the signal used to abort user actions (much like AbortSignal).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   350
     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
   351
     the loop (such as when confirming multiple class deletions etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   352
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   353
    ^ AbortAllSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   354
!
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
abortSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   357
    "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
   358
     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
   359
     currently active doIt/printIt or inspectIt. (also some others use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   360
     this for a save abort)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   361
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   362
    ^ AbortSignal
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   365
activityNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   366
    "return the signal used for activity notifications.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   367
     A handler for this signal gets all #activityNotification: sends"
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
    ^ ActivityNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   370
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   371
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   372
deepCopyErrorSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   373
    "return the signal raised when a deepcopy is asked for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   374
     an object which cannot do this (for example, BlockClosures
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   375
     or Contexts)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   376
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   377
    ^ DeepCopyErrorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   378
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   379
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   380
elementOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   381
    "return the signal used for element error reporting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   382
     (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
   383
      be put into a bytearray)"
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
    ^ ElementOutOfBoundsSignal
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   388
errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   389
    "return the signal used for error/error: - handling"
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
    ^ ErrorSignal
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   394
exceptionInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   395
    "return the signal used for exception (display errors) error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   396
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   397
    ^ ExceptionInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   398
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   399
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   400
haltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   401
    "return the signal used for halt/halt: - handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   402
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   403
    ^ HaltSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   404
!
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
indexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   407
    "return the signal used for bad index error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   408
     This is also the parentSignal of the nonIntegerIndex- and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   409
     subscriptOutOfBoundsSignal"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   410
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   411
    ^ IndexNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   412
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   413
    "Created: / 8.11.1997 / 19:15:48 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   416
informationSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   417
    "return the signal used for informations. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   418
     A handler for this signal gets all #information: sends"
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
    ^ InformationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   421
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   422
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   423
internalErrorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   424
    "return the signal used to report internal (VM-) errors."
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
    ^ InternalErrorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   427
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   428
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   429
keyNotFoundSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   430
    "return the signal used for no such key error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   431
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   432
    ^ KeyNotFoundSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   433
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   434
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   435
messageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   436
    "return the signal used for doesNotUnderstand: - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   437
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   438
    ^ MessageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   439
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   440
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   441
nonIntegerIndexSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   442
    "return the signal used for bad subscript error reporting"
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
    ^ NonIntegerIndexSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   445
!
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
notFoundSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   448
    "return the signal used for no element found error reporting"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   449
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   450
    ^ NotFoundSignal
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   453
osSignalInterruptSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   454
    "return the signal used for OS-signal error reporting;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   455
     This is only raised if handled - otherwise, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   456
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   457
    ^ OSSignalInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   458
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   459
    "Modified: / 12.6.1998 / 16:27:26 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   460
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   461
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   462
primitiveFailureSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   463
    "return the signal used for primitiveFailed - error handling"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   464
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   465
    ^ PrimitiveFailureSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   466
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   467
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   468
privateMethodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   469
    "return the signal used for privateMethod - error handling"
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
    ^ MessageNotUnderstoodSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   472
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   473
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   474
recursionInterruptSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   475
    "return the signal used for recursion overflow error handling"
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
    ^ RecursionInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   478
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   479
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   480
recursiveStoreStringSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   481
    "return the query signal used to report storeString generation of recursive objects"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   482
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   483
    ^ RecursiveStoreStringSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   484
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   485
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   486
     Object recursiveStoreStringSignal handle:[:ex |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   487
	self halt
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   488
     ] do:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   489
	|a|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   490
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   491
	a := Array new:1.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   492
	a at:1 put:a.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   493
	a storeOn:Transcript
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   494
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   495
    "
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   498
     |a|
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
     a := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   501
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   502
     a storeOn:Transcript
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   503
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   505
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   508
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   509
subclassResponsibilitySignal
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   510
    "return the signal used for subclassResponsibility error reporting.
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   511
     (this signal is used to signal incomplte subclasses - i.e. a programmers error)"
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   512
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   513
    ^ SubclassResponsibilityError
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   514
!
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
   515
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   516
subscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   517
    "return the signal used for subscript error reporting.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   518
     (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
   519
      index less than 1 or greater than the array size)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   520
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   521
    ^ SubscriptOutOfBoundsSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   522
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   523
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   524
userInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   525
    "return the signal used for ^C interrupts handling"
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
    ^ UserInterruptSignal
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   530
userNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   531
    "the parent signal used with information and warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   532
     Handling this allows handling of both information- and warning notifications."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   533
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   534
    ^ UserNotificationSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   535
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   536
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   537
warningSignal 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   538
    "return the signal used for warnings.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   539
     A handler for this signal gets all #warn: sends"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   540
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   541
    ^ WarningSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   542
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   543
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   544
!Object class methodsFor:'info messages'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   545
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   546
infoPrinting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   547
    "return the flag which controls information messages."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   548
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   549
    ^ InfoPrinting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   550
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   551
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   552
infoPrinting:aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   553
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   554
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   555
    "turn on/off printing of information messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   556
     If the argument, aBoolean is false, infoPrint will not output
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   557
     messages. The default is true."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   558
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   559
    InfoPrinting := aBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   560
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   561
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   562
!Object class methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   563
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   564
isBuiltInClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   565
    "return true, if this class is known by the run-time-system,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   566
     i.e. you cannot add/remove instance variables without recompiling
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   567
     the VM.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   568
     Here, true is returned for myself, false for subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   569
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   570
    ^ self == Object
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
    "Modified: 23.4.1996 / 16:00:07 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   573
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   574
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   575
!Object methodsFor:'Compatibility - ST80'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   576
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   577
isMetaclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   578
    ^ self isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   579
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   580
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   581
!Object methodsFor:'Compatibility - Squeak'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   582
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   583
as: aSimilarClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   584
    "Create an object of class aSimilarClass that has similar contents to the receiver."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   585
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   586
    ^ aSimilarClass newFrom:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   587
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   588
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   589
     #[1 2 3 4] as:ByteArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   590
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   591
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   592
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   593
asString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   594
    ^ self printString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   595
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   596
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   597
clone
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   598
    ^ self shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   599
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   600
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   601
copyTwoLevel
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   602
    "one more level than a shallowCopy"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   603
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   604
    ^ self copyToLevel:2
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   605
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   606
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   607
     |original copy elL1 elL2 elL3 copyOfElL1|
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   608
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   609
     original := Array new:3.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   610
     original at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   611
     original at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   612
     original at:3 put:(elL1 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   613
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   614
     elL1 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   615
     elL1 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   616
     elL1 at:3 put:(elL2 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   617
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   618
     elL2 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   619
     elL2 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   620
     elL2 at:3 put:(elL3 := Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   621
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   622
     elL3 at:1 put:1234.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   623
     elL3 at:2 put:'hello'.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   624
     elL3 at:3 put:(Array new:3).
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   625
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   626
     copy := original copyTwoLevel.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   627
     (original at:2) ~~ (copy at:2) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   628
     (original at:3) ~~ (copy at:3) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   629
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   630
     copyOfElL1 := copy at:3.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   631
     (elL1 at:2) == (copyOfElL1 at:2) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   632
     (elL1 at:3) == (copyOfElL1 at:3) ifFalse:[self halt].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   633
    "
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   634
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
   635
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   636
currentHand
5912
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   637
    "Return a usable HandMorph -- the one associated with the object's current environment.  This method will always return a hand, even if it has to conjure one up as a last resort.  If a particular hand is actually handling events at the moment (such as a remote hand or a ghost hand), it will be returned."
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   638
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   639
    |w h|
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   640
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   641
    w := self currentWorld.
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   642
    h := w activeHand.
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   643
    h isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   644
	h := w hands first
5912
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   645
    ].
8e3d9ac02b3b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5893
diff changeset
   646
    ^ h
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   647
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   648
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   649
currentWorld
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   650
	^ Utilities currentWorld
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   651
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   652
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   653
newTileMorphRepresentative
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   654
	^ TileMorph new setLiteral: self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   655
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   656
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   657
stringForReadout
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   658
	^ self stringRepresentation
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   659
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   660
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   661
stringRepresentation
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   662
	"Answer a string that represents the receiver.  For most objects this is simply its printString, but for strings themselves, it's themselves.  6/12/96 sw"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   663
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   664
	^ self printString 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   665
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   666
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   667
veryDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   668
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   669
     ^(self deepCopyUsing:(IdentityDictionary new)) postDeepCopyFrom:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   670
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   671
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   672
!Object methodsFor:'accessing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   673
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   674
at:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   675
    "return the indexed instance variable with index, anInteger;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   676
     this method can be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   677
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   678
    ^ self basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   679
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   680
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   681
at:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   682
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   683
     this method can be redefined in subclasses. Returns anObject (sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   684
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   685
    ^ self basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   686
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   687
    "Modified: 19.4.1996 / 11:13:29 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   688
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   689
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   690
basicAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   691
    "return the indexed instance variable with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   692
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   693
     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
   694
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   695
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   696
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   697
    REGISTER int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   698
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   699
    REGISTER char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   700
#ifdef alpha64
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   701
#   define int32        int
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   702
#else
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   703
#   define int32        long
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   704
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   705
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   706
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   707
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   708
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   709
     * this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   710
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   711
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   712
    if (__isSmallInteger(index)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   713
	myClass = __qClass(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   714
	indx = __intVal(index) - 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   715
	n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   716
	n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   717
	nbytes = __qSize(self) - n /* nInstBytes */;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   718
	pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   719
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   720
	switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   721
	    case __MASKSMALLINT(POINTERARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   722
	    case __MASKSMALLINT(WKPOINTERARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   723
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   724
		 * pointers
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   725
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   726
		if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   727
		    OBJ *op;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   728
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   729
		    op = (OBJ *)pFirst + indx;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   730
		    RETURN ( *op );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   731
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   732
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   733
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   734
	    case __MASKSMALLINT(BYTEARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   735
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   736
		 * (unsigned) bytes
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   737
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   738
		if ((unsigned)indx < nbytes) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   739
		    unsigned char *cp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   740
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   741
		    cp = (unsigned char *)pFirst + indx;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   742
		    RETURN ( __MKSMALLINT( (INT)(*cp & 0xFF)) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   743
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   744
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   745
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   746
	    case __MASKSMALLINT(FLOATARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   747
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   748
		 * native floats
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   749
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   750
		if ((unsigned)indx < (nbytes / sizeof(float))) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   751
		    float *fp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   752
		    float f;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   753
		    OBJ v;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   754
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   755
		    fp = (float *)pFirst + indx;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   756
		    f = *fp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   757
		    if (f == 0.0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   758
			v = __float0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   759
		    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   760
			__qMKSFLOAT(v, f);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   761
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   762
		    RETURN (v);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   763
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   764
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   765
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   766
	    case __MASKSMALLINT(DOUBLEARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   767
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   768
		 * native doubles
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   769
		 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   770
#ifdef __NEED_DOUBLE_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   771
		if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   772
		    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   773
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   774
		    pFirst += delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   775
		    nbytes -= delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   776
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   777
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   778
		if ((unsigned)indx < (nbytes / sizeof(double))) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   779
		    double *dp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   780
		    double d;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   781
		    OBJ v;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   782
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   783
		    dp = (double *)pFirst + indx;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   784
		    d = *dp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   785
		    if (d == 0.0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   786
			v = __float0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   787
		    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   788
			__qMKFLOAT(v, d);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   789
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   790
		    RETURN (v);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   791
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   792
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   793
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   794
	    case __MASKSMALLINT(WORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   795
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   796
		 * unsigned 16bit ints
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   797
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   798
		/* Notice: the hard coded shifts are by purpose;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   799
		 * it makes us independent of the short-size of the machine
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   800
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   801
		if ((unsigned)indx < (nbytes>>1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   802
		    unsigned short *sp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   803
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   804
		    sp = (unsigned short *)(pFirst + (indx<<1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   805
		    RETURN ( __MKSMALLINT( (INT)(*sp & 0xFFFF)) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   806
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   807
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   808
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   809
	    case __MASKSMALLINT(SWORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   810
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   811
		 * signed 16bit ints
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   812
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   813
		/* Notice: the hard coded shifts are by purpose;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   814
		 * it makes us independent of the short-size of the machine
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   815
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   816
		if ((unsigned)indx < (nbytes>>1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   817
		    short *ssp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   818
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   819
		    ssp = (short *)(pFirst + (indx<<1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   820
		    RETURN ( __MKSMALLINT( (INT)(*ssp) ));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   821
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   822
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   823
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   824
	    case __MASKSMALLINT(LONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   825
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   826
		 * unsigned 32bit ints
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   827
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   828
		/* Notice: the hard coded shifts are by purpose;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   829
		 * it makes us independent of the int-size of the machine
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   830
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   831
		if ((unsigned)indx < (nbytes>>2)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   832
		    unsigned int32 ul;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   833
		    unsigned int32 *lp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   834
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   835
		    lp = (unsigned int32 *)(pFirst + (indx<<2));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   836
		    ul = *lp;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   837
#ifdef alpha64
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   838
		    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   839
			unsigned  INT ull = (unsigned INT)ul;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   840
			RETURN ( __MKSMALLINT(ull) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   841
		    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   842
#else
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   843
		    if (ul <= _MAX_INT) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   844
			RETURN ( __MKSMALLINT(ul) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   845
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   846
		    RETURN ( __MKULARGEINT(ul) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   847
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   848
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   849
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   850
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   851
	    case __MASKSMALLINT(SLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   852
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   853
		 * signed 32bit ints
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   854
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   855
		/* Notice: the hard coded shifts are by purpose;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   856
		 * it makes us independent of the int-size of the machine
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   857
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   858
		if ((unsigned)indx < (nbytes>>2)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   859
		    int32 *slp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   860
		    int32 l;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   861
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   862
		    slp = (int32 *)(pFirst + (indx<<2));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   863
		    l = *slp;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   864
#ifdef alpha64
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   865
		    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   866
			INT ll = (INT)l;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   867
			RETURN ( __MKSMALLINT(ll) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   868
		    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   869
#else
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   870
		    if (__ISVALIDINTEGER(l)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   871
			RETURN ( __MKSMALLINT(l) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   872
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   873
		    RETURN ( __MKLARGEINT(l) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   874
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   875
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   876
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   877
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   878
	    case __MASKSMALLINT(SLONGLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   879
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   880
		 * signed 64bit longlongs
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   881
		 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   882
#ifdef __NEED_LONGLONG_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   883
		if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   884
		    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   885
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   886
		    pFirst += delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   887
		    nbytes -= delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   888
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   889
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   890
		/* Notice: the hard coded shifts are by purpose;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   891
		 * it makes us independent of the long/longlong-size of the machine
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   892
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   893
		if ((unsigned)indx < (nbytes>>3)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   894
#ifdef alpha64
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   895
		    INT *slp, ll;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   896
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   897
		    slp = (INT *)(pFirst + (indx<<3));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   898
		    ll = *slp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   899
		    if (__ISVALIDINTEGER(ll)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   900
			RETURN ( __MKSMALLINT(ll) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   901
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   902
		    RETURN ( __MKLARGEINT(ll) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   903
#else
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   904
		    __int64__ *llp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   905
		    extern OBJ __MKINT64();
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   906
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   907
		    llp = (__int64__ *)(pFirst + (indx<<3));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   908
		    RETURN (__MKINT64(llp));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   909
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   910
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   911
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   912
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   913
	    case __MASKSMALLINT(LONGLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   914
		/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   915
		 * unsigned 64bit longlongs
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   916
		 */
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   917
#ifdef __NEED_LONGLONG_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   918
		if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   919
		    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   920
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   921
		    pFirst += delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   922
		    nbytes -= delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   923
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   924
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   925
		/* Notice: the hard coded shifts are by purpose;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   926
		 * it makes us independent of the long/longlong-size of the machine
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   927
		 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   928
		if ((unsigned)indx < (nbytes>>3)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   929
#ifdef alpha64
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   930
		    unsigned INT *ulp, ul;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   931
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   932
		    ulp = (unsigned INT *)(pFirst + (indx<<3));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   933
		    ul = *ulp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   934
		    if (ul <= _MAX_INT) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   935
			RETURN ( __MKSMALLINT(ul) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   936
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   937
		    RETURN ( __MKULARGEINT(ul) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   938
#else
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   939
		    __uint64__ *llp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   940
		    extern OBJ __MKUINT64();
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   941
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   942
		    llp = (__uint64__ *)(pFirst + (indx<<3));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   943
		    RETURN (__MKUINT64(llp));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   944
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   945
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   946
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   947
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   948
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   949
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   950
#   undef int32
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   951
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   952
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   953
    index isInteger ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   954
	^ self indexNotInteger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   955
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   956
    ^ self subscriptBoundsError:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   957
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   958
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   959
basicAt:index put:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   960
    "store the 2nd arg, anObject as indexed instvar with index, anInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   961
     Returns anObject (sigh).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   962
     Trigger an error if the receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   963
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   964
     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
   965
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   966
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   967
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   968
    register int nbytes, indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   969
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   970
    register char *pFirst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   971
#ifdef alpha64
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   972
#   define int32        int
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   973
#else
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   974
#   define int32        long
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   975
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   976
/*    int nInstBytes, ninstvars, flags; */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   977
    REGISTER int n;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   978
    unsigned int u;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   979
    int val;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   980
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   981
    /* notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   982
       this can be done since basicAt: is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   983
       and SmallInteger */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   984
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
   985
    if (__isSmallInteger(index)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   986
	indx = __intVal(index) - 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   987
	myClass = __qClass(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   988
	n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   989
	n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   990
	nbytes = __qSize(self) - n /* nInstBytes */;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   991
	pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   992
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   993
	switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   994
	    case __MASKSMALLINT(POINTERARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   995
	    case __MASKSMALLINT(WKPOINTERARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   996
		if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   997
		    OBJ *op;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   998
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
   999
		    op = (OBJ *)pFirst + indx;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1000
		    *op = anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1001
		    __STORE(self, anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1002
		    RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1003
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1004
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1005
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1006
	    case __MASKSMALLINT(BYTEARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1007
		if (__isSmallInteger(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1008
		    val = __intVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1009
		    if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1010
			if ((unsigned)indx < nbytes) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1011
			    char *cp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1012
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1013
			    cp = pFirst + indx;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1014
			    *cp = val;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1015
			    RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1016
			}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1017
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1018
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1019
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1020
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1021
	    case __MASKSMALLINT(FLOATARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1022
		if ((unsigned)indx < (nbytes / sizeof(float))) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1023
		    float *fp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1024
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1025
		    fp = (float *)pFirst + indx;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1026
		    if (anObject != nil) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1027
			if (! __isSmallInteger(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1028
			    if (__qIsFloatLike(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1029
				*fp = (float)(__floatVal(anObject));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1030
				RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1031
			    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1032
			    if (__qIsShortFloat(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1033
				*fp = __shortFloatVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1034
				RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1035
			    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1036
			} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1037
			    *fp = (float) __intVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1038
			    RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1039
			}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1040
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1041
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1042
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1043
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1044
	    case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1045
#ifdef __NEED_DOUBLE_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1046
		if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1047
		    int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1048
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1049
		    pFirst += delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1050
		    nbytes -= delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1051
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1052
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1053
		if ((unsigned)indx < (nbytes / sizeof(double))) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1054
		    double *dp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1055
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1056
		    dp = (double *)pFirst + indx;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1057
		    if (anObject != nil) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1058
			if (! __isSmallInteger(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1059
			    if (__qIsFloatLike(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1060
				*dp = __floatVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1061
				RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1062
			    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1063
			    if (__qIsShortFloat(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1064
				*dp = (double)__shortFloatVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1065
				RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1066
			    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1067
			} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1068
			    *dp = (double) __intVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1069
			    RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1070
			}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1071
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1072
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1073
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1074
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1075
	    case __MASKSMALLINT(WORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1076
		if (__isSmallInteger(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1077
		    val = __intVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1078
		    if ((unsigned)val <= 0xFFFF) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1079
			if ((unsigned)indx < (nbytes>>1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1080
			    unsigned short *sp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1081
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1082
			    sp = (unsigned short *)(pFirst + (indx<<1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1083
			    *sp = val;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1084
			    RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1085
			}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1086
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1087
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1088
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1089
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1090
	    case __MASKSMALLINT(SWORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1091
		if (__isSmallInteger(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1092
		    val = __intVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1093
		    if ((val >= -32768) && (val < 32768)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1094
			if ((unsigned)indx < (nbytes>>1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1095
			    short *ssp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1096
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1097
			    ssp = (short *)(pFirst + (indx<<1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1098
			    *ssp = val;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1099
			    RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1100
			}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1101
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1102
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1103
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1104
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1105
	    case __MASKSMALLINT(SLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1106
		if ((unsigned)indx < (nbytes>>2)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1107
		    int32 *slp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1108
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1109
		    slp = (int32 *)(pFirst + (indx<<2));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1110
		    if (__isSmallInteger(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1111
			*slp = __intVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1112
			RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1113
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1114
		    n = __signedLongIntVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1115
		    /*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1116
		     * zero means failure for an int larger than 4 bytes 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1117
		     * (would be a smallInteger) 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1118
		     */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1119
		    if (n) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1120
			*slp = n;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1121
			RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1122
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1123
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1124
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1125
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1126
	    case __MASKSMALLINT(LONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1127
		if ((unsigned)indx < (nbytes>>2)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1128
		    unsigned int32 *lp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1129
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1130
		    lp = (unsigned int32 *)(pFirst + (indx<<2));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1131
		    if (anObject == __MKSMALLINT(0)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1132
			*lp = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1133
			RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1134
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1135
		    u = __longIntVal(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1136
		    /*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1137
		     * zero means failure for an int larger than 4 bytes
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1138
		     * (would be a smallInteger)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1139
		     */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1140
		    if (u) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1141
			*lp = u;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1142
			RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1143
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1144
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1145
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1146
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1147
	    case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1148
#ifdef __NEED_LONGLONG_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1149
		if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1150
		    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1151
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1152
		    pFirst += delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1153
		    nbytes -= delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1154
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1155
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1156
		if ((unsigned)indx < (nbytes>>3)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1157
		    __int64__ ll;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1158
		    __int64__ *sllp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1159
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1160
		    sllp = (__int64__ *)(pFirst + (indx<<3));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1161
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1162
		    if (anObject == __MKSMALLINT(0)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1163
			ll.lo = ll.hi = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1164
			*sllp = ll;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1165
			RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1166
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1167
		    if (__signedLong64IntVal(anObject, &ll)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1168
			*sllp = ll;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1169
			RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1170
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1171
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1172
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1173
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1174
	    case __MASKSMALLINT(LONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1175
#ifdef __NEED_LONGLONG_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1176
		if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1177
		    int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1178
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1179
		    pFirst += delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1180
		    nbytes -= delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1181
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1182
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1183
		if ((unsigned)indx < (nbytes>>3)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1184
		    __uint64__ ll;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1185
		    __uint64__ *llp;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1186
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1187
		    llp = (__uint64__ *)(pFirst + (indx<<3));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1188
		    if (anObject == __MKSMALLINT(0)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1189
			ll.lo = ll.hi = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1190
			*llp = ll;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1191
			RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1192
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1193
		    if (__unsignedLong64IntVal(anObject, &ll)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1194
			*llp = ll;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1195
			RETURN ( anObject );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1196
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1197
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1198
		break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1199
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1200
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1201
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1202
#   undef int32
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1203
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1204
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1205
    index isInteger ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1206
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1207
	 the index should be an integer number
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1208
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1209
	^ self indexNotInteger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1210
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1211
    (index between:1 and:self size) ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1212
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1213
	 the index is less than 1 or greater than the size of the
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1214
	 receiver collection
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1215
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1216
	^ self subscriptBoundsError:index
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1217
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1218
    (self class isFloatsOrDoubles) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1219
	anObject isNumber ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1220
	    ^ self basicAt:index put:(anObject asFloat)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1221
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1222
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1223
    anObject isInteger ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1224
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1225
	 the object to put into the receiver collection
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1226
	 should be an integer number
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1227
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1228
	^ self elementNotInteger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1229
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1230
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1231
     the object to put into the receiver collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1232
     is not an instance of the expected element class,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1233
     or the value is  not within the elements valid range.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1234
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1235
    ^ self elementBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1236
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1237
    "Modified: 19.4.1996 / 11:14:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1238
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1239
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1240
byteAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1241
    "return the byte at index. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1242
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1243
     (i.e. byteArrays, wordArrays, floatArrays etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1244
     The receivers indexed instvars are treated as an uninterpreted
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1245
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1246
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1247
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1248
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1249
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1250
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1251
    int nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1252
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1253
    REGISTER OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1254
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1255
    if (__isSmallInteger(index)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1256
	slf = self;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1257
	if (__isNonNilObject(slf)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1258
	    unsigned char *pFirst;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1259
	    int nIndex;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1260
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1261
	    cls = __qClass(slf);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1262
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1263
	    pFirst = __byteArrayVal(slf);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1264
	    pFirst += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1265
	    nIndex = __byteArraySize(slf);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1266
	    indx = __intVal(index) - 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1267
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1268
	    switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1269
		case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1270
#ifdef __NEED_DOUBLE_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1271
		    if ((INT)pFirst & (__DOUBLE_ALIGN-1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1272
			int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1273
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1274
			pFirst += delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1275
			nIndex -= delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1276
		    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1277
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1278
		    /* fall into */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1279
		case __MASKSMALLINT(BYTEARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1280
		case __MASKSMALLINT(WORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1281
		case __MASKSMALLINT(LONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1282
		case __MASKSMALLINT(SWORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1283
		case __MASKSMALLINT(SLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1284
		case __MASKSMALLINT(FLOATARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1285
		    if ((unsigned)indx < (unsigned)nIndex) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1286
			RETURN ( __MKSMALLINT( (INT)(pFirst[indx])) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1287
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1288
		    break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1289
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1290
		case __MASKSMALLINT(LONGLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1291
		case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1292
#ifdef __NEED_LONGLONG_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1293
		    if ((INT)pFirst & (__LONGLONG_ALIGN-1)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1294
			int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1295
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1296
			pFirst += delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1297
			nIndex -= delta;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1298
		    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1299
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1300
		    if ((unsigned)indx < (unsigned)nIndex) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1301
			RETURN ( __MKSMALLINT( (INT)(pFirst[indx])) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1302
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1303
		    break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1304
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1305
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1306
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1307
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1308
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1309
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1310
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1311
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1313
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1314
     Point new byteAt:1
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1315
     (ByteArray with:1 with:2) byteAt:2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1316
     (WordArray with:1) byteAt:1       
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1317
     (FloatArray with:1.0) byteAt:2 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1318
     'hello' byteAt:1               
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1319
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1320
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1321
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1322
byteAt:index put:byteValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1323
    "set the byte at index. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1324
     This is only allowed for non-pointer indexed objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1325
     (i.e. byteArrays, wordArrays, floatArrays etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1326
     The receivers indexed instvars are treated as an uninterpreted
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1327
     collection of bytes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1328
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1329
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1330
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1331
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1332
    REGISTER int indx;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1333
    int val, nIndex;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1334
    REGISTER OBJ slf;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1335
    REGISTER OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1336
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1337
    if (__bothSmallInteger(index, byteValue)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1338
	val = __intVal(byteValue);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1339
	if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1340
	    slf = self;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1341
	    if (__isNonNilObject(slf)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1342
		cls = __qClass(slf);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1343
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1344
		indx = __intVal(index) - 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1345
		switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1346
		    case __MASKSMALLINT(BYTEARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1347
		    case __MASKSMALLINT(WORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1348
		    case __MASKSMALLINT(LONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1349
		    case __MASKSMALLINT(SWORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1350
		    case __MASKSMALLINT(SLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1351
		    case __MASKSMALLINT(LONGLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1352
		    case __MASKSMALLINT(SLONGLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1353
		    case __MASKSMALLINT(FLOATARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1354
		    case __MASKSMALLINT(DOUBLEARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1355
			indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1356
			nIndex = __byteArraySize(slf);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1357
			if ((unsigned)indx < (unsigned)nIndex) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1358
			    __ByteArrayInstPtr(slf)->ba_element[indx] = val;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1359
			    RETURN ( byteValue );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1360
			}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1361
			break;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1362
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1363
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1364
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1365
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1366
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1367
    "/ index not integer or index out of range
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1368
    "/ or non-byte indexable receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1369
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1370
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1371
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
     (ByteArray with:1 with:2) byteAt:2 put:3; yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1374
     'hello' copy byteAt:1 put:105; yourself              
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1375
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1376
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1377
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1378
instVarAt:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1379
    "return a non-indexed instance variable;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1380
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1381
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1382
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1383
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1384
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1385
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1386
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1387
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1388
    if (__isSmallInteger(index)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1389
	myClass = __Class(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1390
	idx = __intVal(index) - 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1391
	/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1392
	 * do not allow returning of non-object fields.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1393
	 * if subclass did not make privisions for that,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1394
	 * we wont do so here ...
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1395
	 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1396
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1397
	    if (idx == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1398
		RETURN ( nil )
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1399
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1400
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1401
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1402
	if ((idx >= 0) && (idx < ninstvars)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1403
	    RETURN ( __InstPtr(self)->i_instvars[idx] );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1404
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1405
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1406
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1407
.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1408
    index isInteger ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1409
	^ self indexNotInteger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1410
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1411
    ^ self subscriptBoundsError:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1412
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1413
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1414
instVarAt:index put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1415
    "change a non-indexed instance variable;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1416
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1417
     - use with care (needed for copy, inspector etc.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1418
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1419
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1420
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1421
    OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1422
    int idx, ninstvars;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1423
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1424
    if (__isSmallInteger(index)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1425
	myClass = __Class(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1426
	idx = __intVal(index) - 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1427
	ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1428
	/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1429
	 * do not allow setting of non-object fields.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1430
	 * if subclass did not make privisions for that,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1431
	 * we wont do so here ...
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1432
	 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1433
	if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1434
	    if (idx == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1435
		RETURN ( nil )
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1436
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1437
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1438
	if ((idx >= 0) && (idx < ninstvars)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1439
	    __InstPtr(self)->i_instvars[idx] = value;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1440
	    __STORE(self, value);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1441
	    RETURN ( value );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1442
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1443
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1444
%}
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
    index isInteger ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1447
	^ self indexNotInteger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1448
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1449
    ^ self subscriptBoundsError:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1450
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1452
instVarNamed:name 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1453
    "return a non-indexed instance variables value by name;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1454
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1455
     - 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
  1456
     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
  1457
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1458
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1459
    ^ self instVarAt:(self class instVarOffsetOf:name)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1460
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1461
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
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1464
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1465
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1466
     p instVarNamed:'x'  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1467
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1468
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1469
    "Modified: 19.4.1996 / 11:12:39 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1470
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1471
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1472
instVarNamed:name ifAbsent:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1473
    "return a non-indexed instance variables value by name,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1474
     or the value of exceptionBlock, if there is no such instance variable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1475
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1476
     - 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
  1477
     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
  1478
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1479
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1480
    |idx|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1481
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1482
    idx := self class instVarOffsetOf:name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1483
    idx isNil ifTrue:[^ exceptionBlock value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1484
    ^ self instVarAt:idx
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1486
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1487
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1488
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1489
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1490
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1491
     p instVarNamed:'x'  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1492
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1493
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1494
    "Created: 6.7.1996 / 23:02:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1495
    "Modified: 6.7.1996 / 23:03:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1496
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1497
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1498
instVarNamed:name put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1499
    "set a non-indexed instance variable by name;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1500
     peeking into an object this way is not very object oriented 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1501
     - if at all, use with care (provided for protocol completeness).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1502
     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
  1503
     parsed ad runtime)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1505
    ^ self instVarAt:(self class instVarOffsetOf:name) put:value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1506
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1507
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1508
     |p|
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
     p := Point x:10 y:20.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1511
     p instVarNamed:'x' put:30.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1512
     p  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1513
    "
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
    "Modified: 19.4.1996 / 11:12:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1516
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1517
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1518
!Object methodsFor:'attributes access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1519
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1520
objectAttributeAt:attributeKey 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1521
    "return the attribute for a given key or nil if not found"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1522
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1523
    | attrs |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1524
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1525
    attrs := self objectAttributes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1526
    (attrs notNil and:[attrs size > 0]) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1527
	^ attrs at:attributeKey ifAbsent:[]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1528
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1529
    ^ nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1530
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1531
    "Created: / 22.1.1998 / 21:29:17 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1532
    "Modified: / 3.2.1998 / 18:55:55 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1533
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1534
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1535
objectAttributeAt:attributeKey put:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1536
    "store the attribute anObject referenced by key into the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1537
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1538
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1539
    "/ is possibly accessed from multiple threads ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1540
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1541
	| attrs |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1542
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1543
	attrs := self objectAttributes.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1544
	(attrs isNil or:[attrs size == 0]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1545
	    attrs := WeakIdentityDictionary new.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1546
	    attrs at:attributeKey put:anObject.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1547
	    self objectAttributes:attrs.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1548
	] ifFalse:[ 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1549
	    attrs at:attributeKey put:anObject.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1550
	].
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1551
    ] valueUninterruptably
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1552
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1553
    "Attaching additional attributes (slots) to an arbitrary object:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1554
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1555
     |p|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1556
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1557
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1558
     p objectAttributeAt:#color put:#green.
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
     p objectAttributeAt:#color
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1561
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1562
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1563
    "Created: / 22.1.1998 / 21:29:25 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1564
    "Modified: / 3.2.1998 / 18:57:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1565
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1566
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1567
objectAttributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1568
    "return a Collection of attributes - nil if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1569
     The default implementation here uses a global WeakDictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1570
     attributes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1571
     This may be too slow for high frequency slot access,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1572
     therefore, some classes may redefine this for better performance.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1573
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1574
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1575
    ^ ObjectAttributes at:self ifAbsent:[nil]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1576
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1577
    "Created: / 22.1.1998 / 21:29:30 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1578
    "Modified: / 18.2.2000 / 11:34:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1579
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1580
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1581
objectAttributes:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1582
    "set the collection of attributes.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1583
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1584
     attributes which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1585
     Therefore, some classes may redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1586
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1587
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1588
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1589
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1590
    (OperatingSystem blockInterrupts) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1591
	"/ the common case - already blocked
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1592
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1593
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1594
	    ObjectAttributes removeKey:self ifAbsent:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1595
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1596
	    ObjectAttributes at:self put:aCollection
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1597
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1598
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1599
    ].
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
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1602
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1603
	    ObjectAttributes removeKey:self ifAbsent:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1604
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1605
	    ObjectAttributes at:self put:aCollection
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1606
	].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  1607
    ] ensure:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1608
	OperatingSystem unblockInterrupts
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1609
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1610
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1611
    "Created: / 22.1.1998 / 21:29:35 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1612
    "Modified: / 3.2.1998 / 18:58:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1613
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1614
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1615
removeObjectAttribute:attributeKey
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1616
    "make the argument, anObject be no attribute of the receiver"
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
    "/ must do this save from interrupts, since the attributes collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1619
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1620
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1621
	|attrs n a|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1622
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1623
	attrs := self objectAttributes.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1624
	attrs size == 0 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1625
	    self objectAttributes:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1626
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1627
	    attrs removeKey:attributeKey ifAbsent:nil.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1628
	    attrs size == 0 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1629
		self objectAttributes:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1630
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1631
	]
6323
9dbabd4270d3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6321
diff changeset
  1632
    ] valueUninterruptably
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1633
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1634
    "Created: / 22.1.1998 / 21:29:39 / av"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1635
    "Modified: / 18.2.2000 / 11:32:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1636
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1637
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1638
!Object methodsFor:'binary storage'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1639
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1640
hasSpecialBinaryRepresentation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1641
    "return true, if the receiver has a special binary representation;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1642
     default here is false, but can be redefined in class which provide
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1643
     their own storeBinary/readBinary methods.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1644
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1645
     Normal user classes should not use this, it is meant as a hook for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1646
     special classes such as True, False, UndefinedObject or SmallInteger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1647
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1648
     If your instances should be stored in a special way, see
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1649
     #representBinaryOn: and #readBinaryContentsFromdata:manager:."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1650
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1651
    ^ false
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
readBinaryContentsFrom:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1655
    "reconstruct the receivers instance variables by reading a binary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1656
     binary representation from stream. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1657
     This is a general implementation, walking over instances 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1658
     and loading each recursively using manager.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1659
     Redefined by some classes to read a more compact representations
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1660
     (see String, SmallInteger etc).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1661
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1662
     Notice, that the object is already recreated as an empty corps
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1663
     with instance variables all nil and bit-instances (bytes, words etc.) 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1664
     already read and restored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1665
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1666
     Also notice: this method is not called for if a private representation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1667
     has been stored (see representBinaryOn:). 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1668
     In that case, #readBinaryContentsFromData:manager: is called, which
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1669
     has to be reimplemented in the objects class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1670
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1671
    |size "{ Class: SmallInteger }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1672
     instvarArray|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1673
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1674
    stream next == 1 ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1675
	"/
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1676
	"/ special representation ...
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1677
	"/
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1678
	instvarArray := Array new:(size := stream nextNumber:3).
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1679
	1 to:size do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1680
	    instvarArray basicAt:i put:(manager nextObject)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1681
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1682
	self readBinaryContentsFromData:instvarArray manager:manager.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1683
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1684
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1685
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1686
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1687
    "/ standard representation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1688
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1689
    size := self basicSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1690
    size ~~ 0 ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1691
	self class isPointers ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1692
	    1 to:size do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1693
		self basicAt:i put:(manager nextObject)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1694
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1695
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1696
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1697
    size := self class instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1698
    1 to:size do:[:i |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1699
	self instVarAt:i put:(manager nextObject)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1700
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1701
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1702
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1703
readBinaryContentsFromData:instvarArray manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1704
    "reconstruct the receivers instance variables by filling instance
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1705
     variables with values from instvarArray. This array contains the instvars
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1706
     as specified in #representBinaryOn: when the object was stored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1707
     It is the receivers responsibility to set its instance variables in the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1708
     same order from that array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1709
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1710
    ^ self subclassResponsibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1711
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1712
    "typical implementation (see also comment in #representBinaryOn:)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1713
     (for an object with foo, bar and baz as instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1714
      which did not store baz and wants baz to be reinitialized to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1715
      some constant string)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1716
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1717
	foo := instvarArray at:1.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1718
	bar := instvarArray at:2.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1719
	baz := 'aConstant'.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1720
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1721
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1722
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1723
representBinaryOn:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1724
    "this method is called by the storage manager to ask objects
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1725
     if they wish to provide their own binary representation.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1726
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1727
     If they want to do so, they should return an array containing all
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1728
     instance variables (named & indexed pointer) to be stored. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1729
     If not redefined, this method returns nil which means that all 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1730
     instance variables are to be stored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1731
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1732
     It should be redefined in objects which do not want all instance variables
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1733
     to be stored (for example: objects which keep references to a view etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1734
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1735
     If this is redefined returning non-nil, the corresponding class needs
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1736
     a redefined instance method named #readBinaryContentsFromData:manager:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1737
     which has to fill the receivers named (and optionally indexed pointer)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1738
     instance variables with corresponding values from a data array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1739
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1740
    ^ nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1741
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1742
    "typical implementation:  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1743
     (see also comment in #readBinaryContentsFromData:manager:)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1744
     for an object with foo, bar and baz as instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1745
     which does not want to store baz:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1746
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1747
     representBinaryOn:manager
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1748
	|data|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1749
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1750
	data := Array new:2.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1751
	data at:1 put:foo.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1752
	data at:2 put:bar.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1753
	^ data
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1754
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1755
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1756
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1757
storeBinaryDefinitionBodyOn:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1758
    "append a binary representation of the receivers body onto stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1759
     This is a general implementation walking over instances storing
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1760
     each recursively as an ID using manager.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1761
     Can be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1762
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1763
    |basicSize    "{ Class: SmallInteger }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1764
     instSize     "{ Class: SmallInteger }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1765
     specialSize  "{ Class: SmallInteger }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1766
     myClass specialRep pointers|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1767
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1768
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1769
    instSize := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1770
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1771
    (pointers := myClass isPointers) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1772
	"/
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1773
	"/ inst size not needed - if you uncomment the line below,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1774
	"/ also uncomment the corresponding line in
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1775
	"/ Object>>binaryDefinitionFrom:manager:
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1776
	"/
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1777
	"/ stream nextPut:instSize. "mhmh this limits us to 255 named instvars"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1778
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1779
	myClass isVariable ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1780
	    stream nextNumber:3 put:(basicSize := self basicSize)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1781
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1782
	    basicSize := 0
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1783
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1784
    ] ifFalse: [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1785
	stream nextNumber:4 put:(basicSize := self basicSize).
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1786
	myClass isBytes ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1787
	    1 to:basicSize do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1788
		stream nextPut:(self basicAt:i)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1789
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1790
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1791
	    myClass isWords ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1792
		1 to:basicSize do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1793
		    stream nextNumber:2 put:(self basicAt: i)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1794
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1795
	    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1796
		myClass isLongs ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1797
		    1 to:basicSize do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1798
			stream nextNumber:4 put:(self basicAt: i)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1799
		    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1800
		] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1801
		    myClass isFloats ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1802
			"could do it in one big write on machines which use IEEE floats ..."
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1803
			1 to:basicSize do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1804
			    Float storeBinaryIEEESingle:(self basicAt:i) on:stream
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1805
			]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1806
		    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1807
			myClass isDoubles ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1808
			    "could do it in one big write on machines which use IEEE doubles ..."
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1809
			    1 to:basicSize do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1810
				Float storeBinaryIEEEDouble:(self basicAt:i) on:stream
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1811
			    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1812
			] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1813
			    "/ should never be reached ...
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1814
			    1 to:basicSize do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1815
				manager putIdOf:(self basicAt:i) on:stream
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1816
			    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1817
			]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1818
		    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1819
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1820
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1821
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1822
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1823
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1824
    (pointers or:[instSize ~~ 0]) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1825
	specialRep := self representBinaryOn:manager.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1826
	specialRep notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1827
	    specialSize := specialRep basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1828
	    stream nextPut:1.     "/ means: private representation follows
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1829
	    stream nextNumber:3 put:specialSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1830
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1831
	    1 to:specialSize do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1832
		manager putIdOf:(specialRep at:i) on:stream
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1833
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1834
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1835
	    stream nextPut:0.     "/ means: normal representation follows
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1836
				  "/ index pointers followed by named instanceVars
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1837
	    pointers ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1838
		basicSize ~~ 0 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1839
		    1 to:basicSize do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1840
			manager putIdOf:(self basicAt:i) on:stream
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1841
		    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1842
		].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1843
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1844
	    instSize ~~ 0 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1845
		1 to:instSize do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1846
		    manager putIdOf:(self instVarAt:i) on:stream
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1847
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1848
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1852
    "Modified: / 2.11.1997 / 14:43:29 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1853
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1854
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1855
storeBinaryDefinitionOn:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1856
    "append a binary representation of the receiver onto stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1857
     This is an internal interface for binary storage mechanism.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1858
     This method first stores the class, then the body, which is done
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1859
     in a separate method to allow redefinition of the bodies format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1860
     Can be redefined in subclasses to write more compact representations
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1861
     (see String, SmallInteger etc)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1862
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1863
    manager putIdOfClass:(self class) on:stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1864
    self storeBinaryDefinitionBodyOn:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1865
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1866
    "Modified: 23.4.1996 / 09:31:12 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1867
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1868
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1869
storeBinaryOn:aStreamOrFilename
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1870
    "Writes a description of the receiver onto aStreamOrFilename, in a way that allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1871
     the object's structure to be reconstructed from the stream's contents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1872
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1873
    BinaryOutputManager store:self on:aStreamOrFilename
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1874
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1875
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1876
     |a s1 s2|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1877
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1878
     s1 := 'hello'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1879
     s2 := 'world'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1880
     a := Array new:5.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1881
     a at:1 put:s1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1882
     a at:2 put:s2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1883
     a at:3 put:s1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1884
     a at:4 put:s2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1885
     a storeBinaryOn:'test.boss'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1886
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1887
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
     (BinaryObjectStorage onOld:'test.boss' asFilename readStream)
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1890
	next
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1891
	    inspect
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1892
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1893
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1894
    "Modified: / 1.11.1997 / 21:16:24 / cg"
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
storeBinaryOn:stream manager:manager
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1898
    "append a binary representation of the receiver onto stream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1899
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1900
    manager putIdOf:self on:stream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1901
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1902
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1903
!Object methodsFor:'change & update'!
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
broadcast:aSelectorSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1906
    "send a message with selector aSelectorSymbol to all my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1907
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1908
    self dependentsDo:[:dependent | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1909
	dependent perform:aSelectorSymbol
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1910
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1911
!
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
broadcast:aSelectorSymbol with:anArgument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1914
    "send a message with selector aSelectorSymbol with an additional
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1915
     argument anArgument to all my dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1916
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1917
    self dependentsDo:[:dependent | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1918
	dependent perform:aSelectorSymbol with:anArgument
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1919
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1920
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1921
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1922
changeRequest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1923
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1924
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1925
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1926
    self dependentsDo:[:dependent | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1927
	dependent updateRequest ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1928
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1929
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1930
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1931
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1932
changeRequest:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1933
    "the receiver wants to change - check if all dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1934
     grant the request, and return true if so"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1935
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1936
    self dependentsDo:[:dependent | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1937
	(dependent updateRequest:aParameter) ifFalse:[^ false].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1938
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1939
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1940
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1941
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1942
changeRequest:aParameter from:anObject
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1948
    self dependentsDo:[:dependent | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1949
	dependent == anObject ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1950
	    (dependent updateRequest:aParameter) ifFalse:[^ false].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1962
    self dependentsDo:[:dependent | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1963
	dependent == anObject ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  1964
	    (dependent updateRequest) ifFalse:[^ false].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
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.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1988
     Each dependent gets a  '#update:with:from:'-message, with aParameter
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  1991
    self dependentsDo:[:dependent | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2021
    "return true, if an update request is granted.
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2029
     it returns true. The others must decide in updateRequest and
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2033
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2034
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2035
updateRequest:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2036
    "return true, if an update request is granted.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2037
     Default here a simple updateRequest"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2038
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2039
    ^ self 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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2042
!Object methodsFor:'cleanup'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2043
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2044
lowSpaceCleanup
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2045
    "ignored here - redefined in some classes to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2046
     cleanup in low-memory situations"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2047
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2048
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2049
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2050
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2051
!Object methodsFor:'comparing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2052
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2053
= anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2054
    "return true, if the receiver and the arg have the same structure.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2055
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2056
	This method is partially open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2057
	identical objects are always considered equal.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2058
	redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2059
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2060
    ^ self == anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2061
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2062
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2063
== anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2064
    "return true, if the receiver and the arg are the same object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2065
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2066
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2067
	This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2068
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2069
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2070
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2071
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2072
    RETURN ( (self == anObject) ? true : false );
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2075
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2076
deepSameContentsAs:anObject
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2077
    "return true, if the receiver and the arg have the same contents
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2078
     in both the named instance vars and any indexed instVars.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2079
     This method descends into referenced objects, where #sameContentsAs: does not descend"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2080
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2081
    |myClass val
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2082
     sz "{ Class: SmallInteger }" |
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2083
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2084
    myClass := self class.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2085
    myClass isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2086
	sz := self basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2087
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2088
	"compare the indexed variables"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2089
	1 to:sz do:[:i |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2090
	    val := self basicAt:i.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2091
	    val isLiteral ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2092
		val = (anObject basicAt:i) ifFalse:[^ false].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2093
	    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2094
		(val deepSameContentsAs:(anObject basicAt:i)) ifFalse:[^ false].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2095
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2096
	]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2097
    ].
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2098
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2099
    "compare the instance variables"
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2100
    sz := myClass instSize.
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2101
    1 to:sz do:[:i | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2102
	val := self instVarAt:i.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2103
	val isLiteral ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2104
	    val = (anObject instVarAt:i) ifFalse:[^ false].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2105
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2106
	    (val deepSameContentsAs:(anObject instVarAt:i)) ifFalse:[^ false].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2107
	]
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2108
    ].
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
    ^ true
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2111
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2112
    "
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2113
     #(1 2 3 4) deepSameContentsAs:#[1 2 3 4] asArray 
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2114
     (1@2) deepSameContentsAs:(1->2)
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2115
    "
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2116
!
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2117
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2118
hash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2119
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2120
     This hash should return same values for objects with same
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2121
     contents (i.e. use this to hash on structure)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2122
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2123
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2124
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2125
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2126
identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2127
    "return an Integer useful as a hash key for the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2128
     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
  2129
     this to hash on identity of objects).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2130
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2131
     We cannot use the Objects address (as other smalltalks do) since
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2132
     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
  2133
     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
  2134
     Id in the object header itself as its hashed upon.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2135
     (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
  2136
     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
  2137
     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
  2138
     hashed-upon objects could add an instvar containing the hash value."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2139
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2140
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2141
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2142
    REGISTER unsigned INT hash;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2143
    static unsigned nextHash = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2144
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2145
    if (__isNonNilObject(self)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2146
	hash = __GET_HASH(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2147
	if (hash == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2148
	    /* has no hash yet */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2149
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2150
	    if (++nextHash > __MAX_HASH__) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2151
		nextHash = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2152
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2153
	    hash = nextHash;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2154
	    __SET_HASH(self, hash);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2155
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2156
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2157
	/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2158
	 * now, we got 11 bits for hashing;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2159
	 * make it as large as possible; since most hashers use the returned
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2160
	 * key and take it modulo some prime number, this will allow for
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2161
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2162
	 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2163
	hash = __MAKE_HASH__(hash);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2164
	RETURN ( __MKSMALLINT(hash) );
5755
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
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2167
    ^ 0 "never reached, since redefined in UndefinedObject and SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2168
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2169
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2170
identityHashForBinaryStore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2171
    "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
  2172
     and does not #become something else, while the hash is used.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2173
     This is only used by the binary storage mechanism, during the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2174
     object writing phase."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2175
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2176
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2177
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2178
    REGISTER unsigned INT hash, hash1, hash2, sz;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2179
    OBJ o;
5806
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2180
    static unsigned INT nextHash = 0;
a7361ebe686a avoid warnings on alpha (int-size)
Claus Gittinger <cg@exept.de>
parents: 5769
diff changeset
  2181
    static unsigned INT nextClassHash = 0;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2182
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2183
    if (__isNonNilObject(self)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2184
	/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2185
	 * my own identityHash
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2186
	 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2187
	hash1 = __GET_HASH(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2188
	if (hash1 == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2189
	    /* has no hash yet */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2190
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2191
	    if (++nextHash > __MAX_HASH__) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2192
		nextHash = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2193
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2194
	    hash1 = nextHash;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2195
	    __SET_HASH(self, hash1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2196
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2197
	/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2198
	 * my classes identityHash
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2199
	 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2200
	o = __qClass(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2201
	hash2 = __GET_HASH(o);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2202
	if (hash2 == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2203
	    /* has no hash yet */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2204
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2205
	    if (++nextClassHash > __MAX_HASH__) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2206
		nextClassHash = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2207
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2208
	    hash2 = nextClassHash;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2209
	    __SET_HASH(o, hash2);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2210
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2211
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2212
	/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2213
	 * some bits of my size
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2214
	 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2215
	sz = __qSize(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2216
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2217
	/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2218
	 * now, we got 11 + 11 + 8 bits for hashing;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2219
	 * make it as large as possible; since most hashers use the returned
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2220
	 * key and take it modulo some prime number, this will allow for
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2221
	 * better distribution (i.e. bigger empty spaces) in hashed collection.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2222
	 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2223
	hash = (hash1 << 11) | hash2;           /* 22 bits */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2224
	hash = (hash << 8) | (sz & 0xFC);       /* 30 bits */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2225
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2226
	while ((hash & 0x20000000) == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2227
	    hash <<= 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2228
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2229
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2230
	RETURN ( __MKSMALLINT(hash) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2231
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2232
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2233
    "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
  2234
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2235
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2236
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2237
sameContentsAs:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2238
    "return true, if the receiver and the arg have the same contents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2239
     in both the named instance vars and any indexed instVars."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2240
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  2241
    |myClass
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2242
     sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2243
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2244
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2245
    myClass isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2246
	sz := self basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2247
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2248
	"compare the indexed variables"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2249
	1 to:sz do:[:i | 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2250
	    (self basicAt:i) == (anObject basicAt:i) ifFalse:[^ false].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2251
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2252
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2253
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2254
    "compare the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2255
    sz := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2256
    1 to:sz do:[:i | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2257
	(self instVarAt:i) == (anObject instVarAt:i) ifFalse:[^ false].
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2260
    ^ true
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
    "
5814
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2263
     #(1 2 3 4) sameContentsAs:#[1 2 3 4] asArray 
f4f6da3e7631 Define #deepSameContentsAs:
Stefan Vogel <sv@exept.de>
parents: 5806
diff changeset
  2264
     (1@2) sameContentsAs:(1->2)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2265
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2266
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2267
    "Created: / 21.4.1998 / 15:56:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2268
    "Modified: / 21.4.1998 / 15:58:15 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2269
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2270
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2271
~= anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2272
    "return true, if the receiver and the arg do not have the same structure.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2273
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2274
	This method is partially open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2275
	identical objects are never considered unequal.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2276
	redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2277
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2278
    ^ (self = anObject) not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2279
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2280
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2281
~~ anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2282
    "return true, if the receiver and the arg are not the same object.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2283
     Never redefine this in any class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2284
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2285
	This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2286
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2287
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2288
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2289
    RETURN ( (self == anObject) ? false : true );
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2293
!Object methodsFor:'converting'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2294
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2295
-> anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2296
    "return an association with the receiver as key and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2297
     the argument as value"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2298
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2299
    ^ Association key:self value:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2300
!
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
asCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2303
    "return myself as a Collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2304
     Redefined in collection to return themself."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2305
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2306
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2307
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2308
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2309
asSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2310
    "return myself as a SequenceableCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2311
     Redefined in SequenceableCollection"
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
    ^ Array with:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2314
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2315
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2316
asValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2317
    "return a valueHolder for for the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2318
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2319
    ^ ValueHolder with:self
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2320
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2321
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2322
collect
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2323
    "return mySelf"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2324
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2325
    ^ self
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2326
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2327
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2328
deepCollect
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2329
    "return mySelf"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2330
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2331
    ^ self
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2332
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2333
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2334
deepSelect
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2335
    "return mySelf"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2336
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2337
    ^ self
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2338
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2339
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2340
select
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2341
    "return mySelf"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2342
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2343
    ^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2344
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2345
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2346
!Object methodsFor:'copying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2347
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2348
cloneFrom:anObject 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2349
    "Helper for copy:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2350
     copy all instance variables from anObject into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2351
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2352
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2353
    self cloneFrom:anObject performing:#yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2354
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2355
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2356
     |x|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2357
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2358
     x := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2359
     x cloneFrom:#(1 2 3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2360
    "
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2363
cloneFrom:anObject performing:aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2364
    "Helper for copy:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2365
     for each instance variables from anObject, send it aSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2366
     and store the result into the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2367
     which should be of the same class as the argument."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2368
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2369
    |myClass sz "{ Class: SmallInteger }" t |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2370
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2371
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2372
    myClass isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2373
	sz := self basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2374
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2375
	"copy the indexed variables"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2376
	1 to:sz do:[:i | 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2377
	    t := anObject basicAt:i.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2378
	    aSymbol ~~ #yourself ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2379
		t := t perform:aSymbol.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2380
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2381
	    self basicAt:i put:t.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2382
	]
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2385
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2386
    sz := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2387
    1 to:sz do:[:i | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2388
	t := anObject instVarAt:i.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2389
	aSymbol ~~ #yourself ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2390
	    t := t perform:aSymbol
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2391
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2392
	self instVarAt:i put:t
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2393
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2394
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2395
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2396
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2399
cloneInstanceVariablesFrom:aPrototype
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2400
    "Shallow copy variables from a prototype into myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2401
     This copies instVars by name - i.e. same-named variables are
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2402
     copied, others are not.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2403
     The variable slots are copied as available 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2404
     (i.e. the min of both indexed sizes is used)."
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
    |myInfo otherInfo|
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
    myInfo := self class instanceVariableOffsets.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2409
    otherInfo := aPrototype class instanceVariableOffsets.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2410
    myInfo keysAndValuesDo:[:name :index | |varIndexAssoc|
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2411
	varIndexAssoc := otherInfo at:name ifAbsent:[].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2412
	varIndexAssoc notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2413
	    self instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value))
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2414
	]
5755
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
    self isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2417
	1 to:(self basicSize min:aPrototype basicSize) do:[:index |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2418
	    self basicAt:index put:(aPrototype basicAt:index)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2419
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2420
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2421
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2422
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2423
     Class withoutUpdatingChangesDo:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2424
	 Point subclass:#Point3D
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2425
	   instanceVariableNames:'z'
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2426
	   classVariableNames:''
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2427
	   poolDictionaries:''
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2428
	   category:'testing'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2429
	 (Point3D new cloneInstanceVariablesFrom:1@2) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2430
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2431
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2432
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2433
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2434
     Class withoutUpdatingChangesDo:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2435
	 Point variableSubclass:#Point3D
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2436
	   instanceVariableNames:'z'
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2437
	   classVariableNames:''
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2438
	   poolDictionaries:''
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2439
	   category:'testing'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2440
	 ((Point3D new:2) cloneInstanceVariablesFrom:#(1 2 3)) inspect.
5755
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2443
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2444
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2445
     |someObject|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2446
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2447
     Class withoutUpdatingChangesDo:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2448
	 Object subclass:#TestClass1 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2449
	   instanceVariableNames:'foo bar'
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2450
	   classVariableNames:''
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2451
	   poolDictionaries:''
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2452
	   category:'testing'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2453
	 someObject := TestClass1 new.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2454
	 someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2455
	 Object subclass:#TestClass2 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2456
	   instanceVariableNames:'bar foo'
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2457
	   classVariableNames:''
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2458
	   poolDictionaries:''
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2459
	   category:'testing'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2460
	 (TestClass2 new cloneInstanceVariablesFrom:someObject) inspect.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2461
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2462
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2463
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2464
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2465
     |top b b1|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2466
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2467
     top := StandardSystemView new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2468
     top extent:100@100.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2469
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2470
     b := Button in:top.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2471
     b label:'hello'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2472
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2473
     b1 := ArrowButton new cloneInstanceVariablesFrom:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2474
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2475
     top open.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2476
     b1 inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2477
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2478
!
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
copy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2481
    "return a copy of the receiver - defaults to shallowcopy here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2482
     Notice, that copy does not copy dependents."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2483
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2484
    ^ self shallowCopy postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2485
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2486
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2487
copyToLevel:level
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2488
    "one more level than a shallowCopy"
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2489
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2490
    | newObject class index |
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2491
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2492
    level == 1 ifTrue:[^ self shallowCopy].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2493
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2494
    class _ self class.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2495
    newObject _ self clone.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2496
    newObject == self ifTrue: [^ self].
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2497
    class isVariable
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2498
	    ifTrue: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2499
		    [index _ self basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2500
		    [index > 0]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2501
			    whileTrue: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2502
				    [newObject basicAt: index put: ((self basicAt: index) copyToLevel:(level-1)).
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2503
				    index _ index - 1]].
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2504
    index _ class instSize.
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2505
    [index > 0]
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2506
	    whileTrue: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2507
		    [newObject instVarAt: index put: ((self instVarAt: index) copyToLevel:(level-1)).
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2508
		    index _ index - 1].
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2509
    ^newObject
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2510
!
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  2511
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2512
deepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2513
    "return a copy of the object with all subobjects also copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2514
     This method DOES handle cycles/self-refs and preserves object identity; 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2515
     however the receivers class is not copied (to avoid the 'total' copy).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2516
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2517
     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
  2518
     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
  2519
     copied object does not include duplicates (or you do not care) and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2520
     no cycles are involved, you can use the old simpleDeepCopy, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2521
     which avoids this overhead (but may run into trouble).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2522
     Notice, that deepCopy does not copy dependents."
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
    ^ (self deepCopyUsing:(IdentityDictionary new)) postDeepCopyFrom:self
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
    "an example which is not handled by the old deepCopy:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2527
    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2528
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2529
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2530
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2531
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2532
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2533
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
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2536
     a := Color black onDevice:Screen current.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2537
     a deepCopy inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2538
    "
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
    "Modified: 27.3.1996 / 16:31:20 / stefan"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2543
deepCopyError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2544
    "{ Pragma: +optSpace }"
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
    "raise a signal, that deepCopy is not allowed for this object"
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
    ^ DeepCopyErrorSignal raise
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2549
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2550
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2551
deepCopyUsing:aDictionary
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2552
    "a helper for deepCopy; return a copy of the object with 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2553
     all subobjects also copied. If the to-be-copied object is in the dictionary, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2554
     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
  2555
     This method DOES handle cycles/self references."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2556
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2557
    |myClass aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2558
     sz "{ Class: SmallInteger }" 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2559
     iOrig iCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2560
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2561
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2562
    myClass isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2563
	sz := self basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2564
	aCopy := myClass basicNew:sz.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2565
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2566
	sz := 0.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2567
	aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2568
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2569
    aCopy setHashFrom:self.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2570
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2571
    aDictionary at:self put:aCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2572
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2573
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2574
     copy indexed instvars - if any
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2575
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2576
    sz ~~ 0 ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2577
	myClass isBits ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2578
	    "block-copy indexed instvars"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2579
	    aCopy replaceFrom:1 to:sz with:self startingAt:1
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2580
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2581
	    "individual deep copy the indexed variables"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2582
	    1 to:sz do:[:i | 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2583
		iOrig := self basicAt:i.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2584
		iOrig notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2585
		    (aDictionary includesKey:iOrig) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2586
			iCopy := aDictionary at:iOrig
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2587
		    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2588
			iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2589
		    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2590
		    aCopy basicAt:i put:iCopy
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2591
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2592
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2593
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2594
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2595
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2596
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2597
     copy the instance variables
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2598
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2599
    sz := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2600
    1 to:sz do:[:i |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2601
	(self skipInstvarIndexInDeepCopy:i) ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2602
	    iOrig := self instVarAt:i.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2603
	    iOrig notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2604
		(aDictionary includesKey:iOrig) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2605
		    iCopy := aDictionary at:iOrig
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2606
		] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2607
		    iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2608
		].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2609
		aCopy instVarAt:i put:iCopy
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2610
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2611
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2612
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2613
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2614
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2615
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2616
     |a b c copyOfC|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2617
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2618
     a := Array with:'hello' with:'world' with:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2619
     b := 99 @ 999.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2620
     a at:3 put:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2621
     c := Array with:a with:b with:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2622
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2623
     Transcript showCR: (c at:1) == (c at:3).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2624
     copyOfC := c deepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2625
     Transcript showCR: (copyOfC at:1) == (copyOfC at:3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2626
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2627
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2628
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2629
postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2630
    "this is for compatibility with ST-80 code, which uses postCopy for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2631
     cleanup after copying, while ST/X passes the original in postCopyFrom:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2632
     (see there)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2633
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2634
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2635
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2636
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2637
postDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2638
    "allows for cleanup after deep copying"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2639
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2640
    ^ self postCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2641
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2642
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2643
postDeepCopyFrom:aSource
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2644
    "allows for cleanup after deep copying"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2645
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2646
    ^ self postDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2647
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2648
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2649
setHashFrom:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2650
    "set my identity-hash key to be the same as anObjects hash key. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2651
     This is an ST/X speciality, which is NOT available in other (especially OT based) 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2652
     Smalltalks, and may not be available in future ST/X versions.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2653
     DO NEVER use this for normal application code."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2654
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2655
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2656
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2657
    REGISTER unsigned h;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2658
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2659
    if (__isNonNilObject(self) && __isNonNilObject(anObject)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2660
	h = __GET_HASH(anObject);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2661
	__SET_HASH(self, h);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2662
	RETURN (self);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2663
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2664
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2665
    self primitiveFailed    "neither receiver not arg may be nil or SmallInteger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2666
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2667
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2668
shallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2669
    "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
  2670
     i.e. the copy shares referenced instvars with its original."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2671
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2672
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2673
    int ninsts, spc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2674
    int sz;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2675
    OBJ theCopy;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2676
    OBJ cls;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2677
    int flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2678
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2679
    cls = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2680
    flags = __intVal(__ClassInstPtr(cls)->c_flags);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2681
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2682
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2683
     * bail out for special objects ..
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
    if (((flags & ~ARRAYMASK) == 0)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2686
     && ((flags & ARRAYMASK) != WKPOINTERARRAY)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2687
	sz = __qSize(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2688
	__PROTECT__(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2689
	__qNew(theCopy, sz);    /* OBJECT ALLOCATION */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2690
	__UNPROTECT__(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2691
	if (theCopy) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2692
	    cls = __qClass(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2693
	    spc = __qSpace(theCopy);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2694
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2695
	    theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2696
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2697
	    sz = sz - OHDR_SIZE;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2698
	    if (sz) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2699
		char *src, *dst;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2700
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2701
		src = (char *)(__InstPtr(self)->i_instvars);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2702
		dst = (char *)(__InstPtr(theCopy)->i_instvars);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2703
#ifdef bcopy4
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2704
		{
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2705
		    /* care for odd-number of longs */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2706
		    int nW = sz >> 2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2707
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2708
		    if (sz & 3) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2709
			nW++;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2710
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2711
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2712
		    bcopy4(src, dst, nW);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2713
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2714
#else
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2715
		bcopy(src, dst, sz);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2716
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2717
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2718
		flags &= ARRAYMASK;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2719
		if (flags == POINTERARRAY) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2720
		    ninsts = __BYTES2OBJS__(sz);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2721
		} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2722
		    ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2723
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2724
		if (ninsts) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2725
		    do {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2726
			OBJ el;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2727
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2728
			el = __InstPtr(theCopy)->i_instvars[ninsts-1];
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2729
			__STORE_SPC(theCopy, el, spc);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2730
		    } while (--ninsts);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2731
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2732
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2733
	    RETURN (theCopy);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2734
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2735
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2736
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2737
    "/ fallBack for special objects & memoryAllocation failure case
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2738
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2739
    ^ self slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2740
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2741
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2742
simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2743
    "return a copy of the object with all subobjects also copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2744
     This method does NOT handle cycles - but is included to allow this 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2745
     slightly faster copy in situations where it is known that
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2746
     no recursive references occur (LargeIntegers for example).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2747
     NOTICE: you will run into trouble, when trying this with recursive
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2748
     objects (usually recursionInterrupt or memory-alert).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2749
     This method corresponds to the 'traditional' deepCopy found in
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2750
     the Blue book."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2751
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2752
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2753
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2754
    (myClass := self class) isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2755
	aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2756
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2757
	aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2758
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2759
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2760
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2761
    aCopy cloneFrom:self performing:#simpleDeepCopy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2762
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2763
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2764
    "a bad example (but ST/X should survive ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2765
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2766
     |a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2767
     a := Array new:3.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2768
     a at:3 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2769
     a simpleDeepCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2770
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2771
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2772
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2773
skipInstvarIndexInDeepCopy:index
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2774
    "a helper for deepCopy; only indices for which this method returns
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2775
     false are copied in a deep copy.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2776
     The default is false here - which means that everything is copied.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2777
     Can be redefined in subclasses for partial copies"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2778
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2779
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2780
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2781
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2782
slowShallowCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2783
    "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
  2784
     i.e. the copy shares referenced instvars with its original.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2785
     This method is only invoked as a fallback from #shallowCopy."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2786
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2787
    |myClass aCopy|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2788
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2789
    (myClass := self class) isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2790
	aCopy := myClass basicNew:(self basicSize).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2791
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2792
	aCopy := myClass basicNew
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2793
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2794
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2795
    "copy the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2796
    aCopy cloneFrom:self performing:#yourself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2797
    ^ aCopy
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2798
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2799
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2800
!Object methodsFor:'debugging'!
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
basicInspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2803
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2804
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2805
    "launch an inspector on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2806
     this method should NOT be redefined in subclasses."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2807
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2808
    Inspector isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2809
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2810
	 for systems without GUI
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2811
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2812
	Transcript showCR:'no Inspector'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2813
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2814
	Inspector openOn:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2815
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2816
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2817
    "Modified: 18.5.1996 / 15:43:25 / cg"
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
5995
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2820
browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2821
    "open a browser on the receivers class"
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2822
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2823
    self class theNonMetaclass browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2824
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2825
    "
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2826
     10 browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2827
     Collection browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2828
     Collection class browse
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2829
    "
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2830
!
21ba36ffaf3e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5980
diff changeset
  2831
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2832
inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2833
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2834
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2835
    "launch an inspector on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2836
     this method (or better: inspectorClass) can be redefined in subclasses 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2837
     to start special inspectors."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2838
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2839
    |cls|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2840
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2841
    cls := self inspectorClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2842
    cls isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2843
	^ self basicInspect
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2844
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2845
    cls openOn:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2846
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2847
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2848
     Object new inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2849
     (1 @ 2) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2850
     Smalltalk inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2851
     #(1 2 3) asOrderedCollection inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2852
     (Color red) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2853
     (Image fromFile:'bitmaps/garfield.gif') inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2854
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2855
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2856
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2857
inspectorClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2858
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2859
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2860
    "return the class to use for inspect. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2861
     Can (should) be redefined in classes for which a better inspector is available"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2862
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2863
    ^ Inspector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2864
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2865
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2866
mustBeBoolean
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2867
    "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
  2868
     in an if* or while* message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2869
     Caveat: for now, this is only sent by the interpreter;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2870
     both the JIT and the stc compiler treat it as undefined."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2871
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2872
    self error:'Non boolean receiver - proceed for truth' mayProceed:true.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2873
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2874
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2875
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2876
mustBeKindOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2877
    "for compatibility & debugging support: 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2878
     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
  2879
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2880
	it is VERY questionable, if it makes sense to add manual
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2881
	type checks to a dynamically typed language like smalltalk. 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2882
	It will, at least, slow down performance,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2883
	make your code less reusable and clutter your code with stupid sends
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2884
	of this selector. Also, read the comment in isKindOf:, regarding the
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2885
	use of isXXX check methods.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2886
     You see: The author does not like this at all ..."
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
    (self isKindOf:aClass) ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2889
	self error:'argument is not of expected type'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2890
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2891
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2892
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2893
obsoleteMethodWarning
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2894
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2895
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2896
    "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
  2897
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2898
     used which is going to be removed in later ST/X versions.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2899
     Find all methods which will be obsolete soon by looking at senders
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2900
     of this message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2901
     Hopefully, this warning message is annoying enough for you to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2902
     change the code ... ;-)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2903
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2904
    self obsoleteMethodWarning:nil from:thisContext sender
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2907
obsoleteMethodWarning:message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2908
    "{ Pragma: +optSpace }"
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
    "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
  2911
     this method is used to tell programmers that a method is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2912
     used which is going to be removed in later ST/X versions.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2913
     Find all methods which will be obsolete soon by looking at senders
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2914
     of this message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2915
     Hopefully, this warning message is annoying enough for you to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2916
     change the code ... ;-)"
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
    self obsoleteMethodWarning:message from:thisContext sender
5879
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2919
!
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2920
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2921
obsoleteMethodWarning:message from:aContext
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2922
    "{ Pragma: +optSpace }"
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2923
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2924
    "in methods which are going to be obsoleted, a self-send to
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2925
     this method is used to tell programmers that a method is
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2926
     used which is going to be removed in later ST/X versions.
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2927
     Find all methods which will be obsolete soon by looking at senders
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2928
     of this message.
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2929
     Hopefully, this warning message is annoying enough for you to
6405
bbee0a853e2f #obsoleteMethodWarning now uses infoPrint instead of errorPrint.
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  2930
     change the code ... ;-).
bbee0a853e2f #obsoleteMethodWarning now uses infoPrint instead of errorPrint.
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  2931
     This message is intended for application developers, so print it as info message."
5879
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2932
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2933
    |spec|
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2934
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2935
    spec := aContext methodPrintString.
6405
bbee0a853e2f #obsoleteMethodWarning now uses infoPrint instead of errorPrint.
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  2936
    ('WARNING: the ''' , spec , ''' method is obsolete.') infoPrintCR.
bbee0a853e2f #obsoleteMethodWarning now uses infoPrint instead of errorPrint.
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  2937
    ('         And may not be present in future ST/X versions.') infoPrintCR.
bbee0a853e2f #obsoleteMethodWarning now uses infoPrint instead of errorPrint.
Stefan Vogel <sv@exept.de>
parents: 6388
diff changeset
  2938
    ('         called from ' , aContext sender printString) infoPrintCR.
5879
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2939
    message notNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2940
	'------>  ' infoPrint. message infoPrintCR
5879
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2941
    ]
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2942
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2943
    "
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2944
     Object obsoleteMethodWarning:'foo' from:thisContext sender sender
1fbb9035e1cf stefan: careful - do not check in corrupt classes !!!!
Claus Gittinger <cg@exept.de>
parents: 5869
diff changeset
  2945
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2946
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2947
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2948
!Object methodsFor:'dependents access'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2949
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2950
addDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2951
    "make the argument, anObject be a dependent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2952
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2953
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2954
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2955
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2956
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2957
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2958
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2959
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2960
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2961
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2962
	|deps dep|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2963
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2964
	deps := self dependents.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2965
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2966
	"/ to save a fair amount of memory in case of
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2967
	"/ many dependencies, we store a single dependent in
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2968
	"/ a WeakArray, and switch to a WeakSet if more dependents are
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2969
	"/ added.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2970
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2971
	(deps isNil or:[deps size == 0]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2972
	    self dependents:(WeakArray with:anObject)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2973
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2974
	    deps class == WeakArray ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2975
		dep := deps at:1.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2976
		dep ~~ anObject ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2977
		    (dep isNil or:[dep == 0]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2978
			deps at:1 put:anObject
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2979
		    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2980
			self dependents:(WeakIdentitySet with:dep with:anObject)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2981
		    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2982
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2983
	    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2984
		deps add:anObject
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2985
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2986
	]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  2987
    ] ensure:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2988
	wasBlocked ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2989
	    OperatingSystem unblockInterrupts
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  2990
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2991
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2992
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2993
    "Modified: / 27.10.1997 / 19:35:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2994
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2995
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2996
breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2997
    "remove all dependencies from the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2998
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  2999
    self dependents:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3000
    self nonWeakDependents:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3001
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3002
    "Modified: / 19.4.1996 / 10:55:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3003
    "Created: / 27.2.1998 / 11:26:11 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3004
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3005
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3006
dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3007
    "return a Collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3008
     The default implementation here uses a global WeakDictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3009
     dependents 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3010
     This may be too slow for high frequency change&update,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3011
     therefore, some classes (Model) redefine this for better performance.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3012
     Notice the mentioning of a WeakDictionary - read the classes documentation."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3013
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3014
    |deps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3015
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3016
    (deps := Dependencies at:self ifAbsent:nil) isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3017
	^ #().
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3018
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3019
    ^ deps
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3020
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3021
    "Modified: / 26.1.1998 / 11:18:15 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3022
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3023
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3024
dependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3025
    "set the collection of dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3026
     The default implementation here uses a global Dictionary to store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3027
     dependents which may be too slow for high frequency change&update.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3028
     Therefore, some classes (Model) redefine this for better performance."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3029
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3030
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3031
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3032
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3033
    "/ faster execution (and to avoid creation of garbage blocks).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3034
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3035
    (OperatingSystem blockInterrupts) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3036
	"/ the common case - already blocked
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3037
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3038
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3039
	    Dependencies removeKey:self ifAbsent:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3040
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3041
	    Dependencies at:self put:aCollection
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3042
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3043
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3044
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3045
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3046
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3047
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3048
	    Dependencies removeKey:self ifAbsent:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3049
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3050
	    Dependencies at:self put:aCollection
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3051
	].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3052
    ] ensure:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3053
	OperatingSystem unblockInterrupts
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3054
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3055
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3056
    "Modified: 30.1.1997 / 21:22:10 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3057
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3058
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3059
dependentsDo:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3060
    "evaluate aBlock for all of my dependents"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3061
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3062
    |deps nwDeps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3063
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3064
    deps := self dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3065
    deps size ~~ 0 ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3066
	deps do:[:d | 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3067
		    (d notNil and:[d ~~ 0]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3068
			aBlock value:d
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3069
		    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3070
		]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3071
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3072
    nwDeps := self nonWeakDependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3073
    (nwDeps ~~ deps and:[nwDeps size ~~ 0]) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3074
	nwDeps do:aBlock 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3075
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3076
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3077
    "Modified: / 30.1.1998 / 14:03:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3078
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3079
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3080
myDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3081
    "same as dependents - ST-80 compatibility"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3082
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3083
    ^ self dependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3084
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3085
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3086
release
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3087
    "remove all references to objects that may refer to self.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3088
     Subclasses may redefine this method but should do a 'super release'."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3089
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3090
    self breakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3091
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3092
    "Modified: / 27.2.1998 / 11:29:35 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3093
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3094
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3095
removeDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3096
    "make the argument, anObject be independent of the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3097
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3098
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3099
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3100
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3101
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3102
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3103
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3104
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3105
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3106
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3107
	|deps n d|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3108
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3109
	deps := self dependents.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3110
	deps size ~~ 0 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3111
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3112
	    "/ to save a fair amount of memory in case of
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3113
	    "/ many dependencies, we store a single dependent in
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3114
	    "/ a WeakArray, and switch to a WeakSet if more dependents are
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3115
	    "/ added. Here we have to do the inverse ...
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3116
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3117
	    deps class == WeakArray ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3118
		((d := deps at:1) == anObject 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3119
		or:[d isNil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3120
		or:[d == 0]]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3121
		    self dependents:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3122
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3123
	    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3124
		deps remove:anObject ifAbsent:[].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3125
		(n := deps size) == 0 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3126
		    self dependents:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3127
		] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3128
		    n == 1 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3129
			d := deps firstIfEmpty:nil.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3130
			d notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3131
			    deps := WeakArray with:d
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3132
			] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3133
			    deps := nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3134
			].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3135
			self dependents:deps.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3136
		    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3137
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3138
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3139
	]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3140
    ] ensure:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3141
	wasBlocked ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3142
	    OperatingSystem unblockInterrupts
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3143
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3144
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3145
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3146
    "Modified: / 26.1.1998 / 19:51:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3147
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3148
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3149
!Object methodsFor:'dependents access (nonWeak)'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3150
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3151
addNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3152
    "make the argument, anObject be a nonWeak dependent of the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3153
     Be careful: this nonWeakDependency will prevent the dependent from being 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3154
     garbage collected unless the dependency is removed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3155
     This is a private mechanism, for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3156
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3157
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3158
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3159
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3160
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3161
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3162
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3163
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3164
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3165
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3166
	|deps dep|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3167
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3168
	deps := self nonWeakDependents.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3169
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3170
	"/ to save a fair amount of memory in case of
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3171
	"/ many dependencies, we store a single dependent in
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3172
	"/ an Array, and switch to a Set if more dependents are
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3173
	"/ added.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3174
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3175
	deps size == 0 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3176
	    self nonWeakDependents:(Array with:anObject)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3177
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3178
	    deps class == Array ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3179
		dep := deps at:1.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3180
		dep ~~ anObject ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3181
		    self nonWeakDependents:(IdentitySet with:dep with:anObject)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3182
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3183
	    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3184
		deps add:anObject
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3185
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3186
	]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3187
    ] ensure:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3188
	wasBlocked ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3189
	    OperatingSystem unblockInterrupts
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3190
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3191
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3192
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3193
    "Created: / 19.4.1996 / 10:54:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3194
    "Modified: / 30.1.1998 / 14:03:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3195
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3196
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3197
nonWeakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3198
    "return a Collection of nonWeakDependents - empty if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3199
     This is a private mechanism for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3200
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3201
    NonWeakDependencies isNil ifTrue:[^ #()].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3202
    ^ NonWeakDependencies at:self ifAbsent:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3203
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3204
    "Created: / 19.4.1996 / 10:55:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3205
    "Modified: / 30.1.1998 / 14:06:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3206
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3207
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3208
nonWeakDependents:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3209
    "set the collection of nonWeak dependents.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3210
     This is a private helper for directed dependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3211
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3212
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3213
	(aCollection isNil or:[aCollection isEmpty]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3214
	    NonWeakDependencies removeKey:self ifAbsent:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3215
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3216
	    NonWeakDependencies at:self put:aCollection
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3217
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3218
    ] valueUninterruptably
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3219
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3220
    "Created: 19.4.1996 / 11:07:47 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3221
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3222
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3223
removeNonWeakDependent:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3224
    "remove a nonWeak dependency from the receiver to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3225
     (i.e. make it independent of the receiver)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3226
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3227
    |wasBlocked|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3228
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3229
    "/ must do this save from interrupts, since the dependents collection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3230
    "/ is possibly accessed from multiple threads.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3231
    "/ Used to use #valueUninterruptably here; inlined that code for slightly
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3232
    "/ faster execution.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3233
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3234
    wasBlocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3235
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3236
	|deps n|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3237
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3238
	deps := self nonWeakDependents.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3239
	deps size ~~ 0 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3240
	    deps class == Array ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3241
		(deps at:1) == anObject ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3242
		    self nonWeakDependents:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3243
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3244
	    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3245
		deps remove:anObject ifAbsent:[].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3246
		(n := deps size) == 0 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3247
		    self nonWeakDependents:nil
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3248
		] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3249
		    n == 1 ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3250
			self nonWeakDependents:(Array with:(deps first))
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3251
		    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3252
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3253
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3254
	]
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  3255
    ] ensure:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3256
	wasBlocked ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3257
	    OperatingSystem unblockInterrupts
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3258
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3259
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3260
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3261
    "Created: / 19.4.1996 / 11:44:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3262
    "Modified: / 30.1.1998 / 14:04:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3263
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3264
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3265
!Object methodsFor:'displaying'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3266
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3267
displayOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3268
    "ST-80 Compatibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3269
     display the receiver in a graphicsContext at 0@0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3270
     - this method allows for any object to be displayed in some view
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3271
     (although the fallBack is to display its printString ...)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3273
    ^ self displayOn:aGC x:0 y:0.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3275
    "Created: 29.5.1996 / 16:28:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3276
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3277
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3278
displayOn:aGC at:aPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3279
    "ST-80 Compatibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3280
     display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3281
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3282
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3283
    ^ self displayOn:aGC x:(aPoint x) y:(aPoint y).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3284
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3285
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3286
displayOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3287
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3288
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3289
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3290
    self displayOn:aGC x:x y:y opaque:false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3291
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3292
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3293
!
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
displayOn:aGc x:x y:y opaque:opaque
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3296
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3297
     for any object to be displayed in a ListView - for example.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3298
     The fallBack here shows the receivers displayString."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3299
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3300
    |s yBaseline|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3301
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3302
    s := self displayString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3303
    "/ although correct, this breaks DataSet, and it must be fixed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3304
    "/ there first ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3305
    yBaseline := y + aGc font ascent.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3306
    yBaseline := y "+ aGc font ascent".
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3307
    opaque ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3308
	aGc displayOpaqueString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3309
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3310
	aGc displayString:s x:x y:yBaseline.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3311
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3313
    "Modified: 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3314
!
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
displayOpaqueOn:aGC x:x y:y
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3317
    "display the receiver in a graphicsContext - this method allows
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3318
     for any object to be displayed in a ListView - for example."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3319
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3320
    self displayOn:aGC x:x y:y opaque:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3321
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3322
    "Modified: / 29.5.1996 / 16:29:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3323
    "Created: / 26.10.1997 / 15:01:36 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3324
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3325
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3326
displayString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3327
    "return a string used when displaying the receiver in a view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3328
     for example an Inspector. This is usually the same as printString,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3329
     but sometimes redefined for a better look."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3330
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3331
    ^ self printString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3332
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3333
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3334
     #(1 2 3) printString    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3335
     #(1 2 3) displayString  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3336
     #(1 2 3) storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3337
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3338
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3339
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3340
heightOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3341
    "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
  3342
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3343
    ^ (aGC font onDevice:aGC device) heightOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3344
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3345
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3346
widthOn:aGC
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3347
    "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
  3348
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3349
    ^ (aGC font onDevice:aGC device) widthOf:(self displayString)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3350
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3351
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3352
!Object methodsFor:'encoding & decoding'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3353
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3354
decodeAsLiteralArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3355
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3356
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3357
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3358
encodeOn:anEncoder with:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3359
    "double-dispatch onto an ObjectEncoder.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3360
     Subclasses redefine this"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3361
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3362
    anEncoder encodeObject:self with:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3363
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3364
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3365
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3366
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3367
fromLiteralArrayEncoding:aSpecArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3368
    "read my attributes from aSpecArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3369
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3370
    |sel val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3371
     stop   "{ Class:SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3372
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3373
    stop := aSpecArray size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3374
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3375
    2 to:stop by:2 do:[:i|
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3376
	sel := aSpecArray at:i.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3377
	val := aSpecArray at:i + 1.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3378
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3379
	(self respondsTo:sel) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3380
	    self perform:sel with:(val decodeAsLiteralArray)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3381
	] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3382
	    Transcript show:self class name; show:': unhandled literalArrayEncoding attribute: '.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3383
	    Transcript showCR:sel.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3384
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3385
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3386
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3387
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3388
!
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
literalArrayEncoding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3391
    "generate a literalArrayEncoding array for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3392
     This uses #literalArrayEncodingSlotOrder which defines the slots and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3393
     order and #skippedInLiteralEncoding which defines slots to skip.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3394
     For most subclasses, there is no need to redefine those."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3395
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3396
    |names encoding cls skipped|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3397
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3398
    self isLiteral ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3399
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3400
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3401
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3402
    skipped  := self skippedInLiteralEncoding.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3403
    cls      := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3404
    names    := cls allInstVarNames.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3405
    encoding := OrderedCollection with:(cls name).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3406
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3407
    (self literalArrayEncodingSlotOrder) do:[:instSlot |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3408
	|value nm|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3409
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3410
	nm := names at:instSlot.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3411
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3412
	(skipped includes:nm) ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3413
	    (value := self instVarAt:instSlot) notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3414
		encoding add:(nm , ':') asSymbol.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3415
		encoding add:value literalArrayEncoding
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3416
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3417
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3418
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3419
    ^ encoding asArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3420
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3421
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3422
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3423
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3424
literalArrayEncodingSlotOrder
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3425
    "define the order in which inst-slots are saved when generating
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3426
     a literalArrayEncoding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3427
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3428
    ^ 1 to:self class instSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3429
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3430
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3431
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3432
skippedInLiteralEncoding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3433
    "return a Collection with it's elements are slots for skipping
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3434
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3435
    ^ #()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3436
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3437
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3438
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3439
!Object methodsFor:'error handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3440
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3441
appropriateDebugger:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3442
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3443
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3444
    "return an appropriate debugger to use.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3445
     If there is already a debugger active on the stack, and it is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3446
     the DebugView, return MiniDebugger (as a last chance) otherwise abort."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3447
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3448
    |context|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3449
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3450
    "DebugView cannot run without system processes"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3451
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3452
    (Processor isNil 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3453
    or:[Processor activeProcessIsSystemProcess
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3454
    or:[Smalltalk isInitialized not]]) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3455
	^ MiniDebugger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3456
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3457
    (Screen isNil or:[Screen default isNil]) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3458
	Debugger isNil ifTrue:[^ Debugger].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3459
	^ MiniDebugger
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3460
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3461
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3462
    context := thisContext.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3463
    context := context findNextContextWithSelector:aSelector or:nil or:nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3464
    [context notNil] whileTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3465
	((context receiver class == Debugger) 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3466
	 and:[context selector == aSelector]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3467
	    "we are already in some Debugger"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3468
	    (Debugger == MiniDebugger) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3469
		"we are already in the MiniDebugger"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3470
		ErrorRecursion ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3471
		    Smalltalk fatalAbort:'recursive error ...'
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3472
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3473
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3474
	    MiniDebugger isNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3475
		Smalltalk fatalAbort:'no debugger'
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3476
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3477
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3478
	    "ok, an error occured while in the graphical debugger;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3479
	     lets try MiniDebugger"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3480
	    ^ MiniDebugger
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3481
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3482
	context := context findNextContextWithSelector:aSelector or:nil or:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3483
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3484
    "not within Debugger - no problem"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3485
    ^ Debugger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3486
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3487
    "Modified: / 23.9.1996 / 12:14:52 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3488
    "Modified: / 19.5.1999 / 18:05:00 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3489
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3490
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3491
cannotSendMessage:aMessage to:someReceiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3492
    "this message is sent by the runtime system (VM),
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3493
     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
  3494
     a valid behavior (see documentation in Behavior)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3495
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3496
    ^ InternalErrorSignal
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3497
	  raiseWith:someReceiver
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3498
	  errorString:('bad class in send of #' , aMessage selector)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3499
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3500
    "Modified: 23.1.1997 / 00:05:39 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3501
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3502
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3503
doesNotUnderstand:aMessage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3504
    "this message is sent by the runtime system (VM) when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3505
     a message is not understood by some object (i.e. there
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3506
     is no method for that selector). The original message has
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3507
     been packed into aMessage (i.e. the receiver, selector and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3508
     any arguments) and the original receiver is then sent the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3509
     #doesNotUnderstand: message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3510
     Here, we raise another signal which usually enters the debugger.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3511
     You can of course redefine #doesNotUnderstand: in your classes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3512
     to implement message delegation, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3513
     or handle the MessageNotUnderstoodSignal gracefully."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3514
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3515
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3516
5821
c11bb6c8cc8f Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5814
diff changeset
  3517
    |sel selStr errorString cls|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3518
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3519
    sel := aMessage selector.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3520
    selStr := sel printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3521
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3522
    "/ Although sel should always be a symbol,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3523
    "/ always use printStrings in the code below.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3524
    "/ Non-symbol selector may happen when things go mad in a primitive, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3525
    "/ or a method has been called by valueWithReceiver: with a wrong arg.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3526
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3527
    "/ handle the case of an error during early startup
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3528
    "/ (output streams not yet initialized)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3529
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3530
    Stdout isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3531
	Smalltalk fatalAbort:'error during init: ' , selStr , ' not understood'.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3532
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3533
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3534
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3535
    "/ extract the class that should have implemented the message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3536
    "/ (in case of a super-send, this is not the receivers class)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3537
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3538
    cls := thisContext sender searchClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3539
    cls isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3540
	"it was NOT a super or directed send ..."
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3541
	cls := self class
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3542
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3543
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3544
    cls notNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3545
	"/
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3546
	"/ displayString is better than 'cls name',
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3547
	"/ since it appends (obsolete) for outdated classes.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3548
	"/ (this happens if you send messages to old instances
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3549
	"/  after changing a classes definition)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3550
	"/
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3551
	errorString := cls displayString.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3552
    ] ifFalse:[    
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3553
	errorString := '(** nil-class **)'
5755
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
    sel class ~~ Symbol ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3556
	errorString := errorString , ' nonSymbol selector: ' , selStr , ' not understood'.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3557
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3558
	errorString := errorString , ' does not understand: ' , selStr.
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3561
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3562
    "/ this only happens, when YOU play around with my classvars ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3563
    "/ (or an error occurs during very early startup, when signals are not yet set)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3564
    "/
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  3565
    MessageNotUnderstood isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3566
	^ MiniDebugger 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3567
	    enterWithMessage:'oops - MessageNotUnderstoodSignal is gone (nil)'
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3568
	    mayProceed:true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3569
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3570
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3571
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3572
    "/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3573
    "/
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  3574
    ^ MessageNotUnderstood
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3575
		raiseRequestWith:aMessage
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3576
		errorString:errorString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3577
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3578
    "Modified: / 9.6.1999 / 17:46:17 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3579
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3580
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3581
elementBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3582
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3583
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3584
    "report an error that badElement is out of bounds 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3585
     (i.e. cannot be put into that collection).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3586
     The error is reported by raising the ElementOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3587
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3588
    ^ ElementOutOfBoundsSignal raise
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3589
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3590
    "Modified: 8.5.1996 / 09:12:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3591
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3592
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3593
elementNotCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3594
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3595
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3596
    "report an error that object to be stored is no Character.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3597
     (usually when storing into Strings).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3598
     The error is reported by raising the ElementOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3599
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3600
    ^ ElementOutOfBoundsSignal raise
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3601
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3602
    "Modified: 8.5.1996 / 09:12:49 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3605
elementNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3606
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3607
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3608
    "report an error that object to be stored is not Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3609
     (in collections that store integers only).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3610
     The error is reported by raising the ElementOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3611
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3612
    ^ ElementOutOfBoundsSignal raise
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3613
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3614
    "Modified: 8.5.1996 / 09:12:51 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3615
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3616
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3617
error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3618
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3619
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3620
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3621
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3622
    "report error that an error occured.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3623
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3624
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3625
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3626
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3627
    Error raiseWith:#error:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3628
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3629
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3630
     nil error
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3631
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3632
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3633
    "Modified: / 8.5.1996 / 09:13:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3634
    "Modified: / 2.8.1999 / 17:00:19 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3635
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3636
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3637
error:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3638
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3639
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3640
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3641
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3642
    "Raise an error with error message aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3643
     The error is reported by raising the Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3644
     which is non-proceedable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3645
     If no handler has been setup, a debugger is entered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3646
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3647
    Error raiseWith:#error: errorString:aString 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3648
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3649
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3650
      nil error:' bad bad bad'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3651
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3652
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3653
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3654
!
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
error:aString mayProceed:mayProceed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3657
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3658
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3659
    "enter debugger with error-message aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3660
     The error is reported by raising either the 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3661
     non-proceedable Error exception,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3662
     or the ProceedableError exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3663
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3664
    mayProceed ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3665
	^ ProceedableError raiseRequestWith:#error: errorString:aString 
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3668
    Error raiseWith:#error: errorString:aString 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3669
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3670
    "Modified: 8.5.1996 / 09:13:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3671
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3672
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3673
errorKeyNotFound:aKey
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3674
    "{ Pragma: +optSpace }"
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
    "report an error that a key was not found in a collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3677
     The error is reported by raising the KeyNotFoundSignal exception."
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
    ^ KeyNotFoundSignal raiseRequestWith:aKey
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3680
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3681
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3682
     #(1 2) at:3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3683
    "
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3686
errorNotFound
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3687
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3688
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3689
    "report an error that no element was found in a collection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3690
     The error is reported by raising the NotFoundSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3691
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3692
    ^ NotFoundSignal raiseRequestWith:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3693
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3694
    "Modified: / 8.5.1996 / 09:13:11 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3695
    "Modified: / 26.7.1999 / 10:51:50 / stefan"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3698
errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3699
    ^ self class errorSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3700
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3701
    "Created: / 19.6.1998 / 02:32:32 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3704
halt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3705
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3706
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3707
    "enter debugger with halt-message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3708
     The error is reported by raising the HaltSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3709
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  3710
    ^ HaltInterrupt raiseRequestWith:#halt
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  3711
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3712
    "Modified: / 2.8.1999 / 17:00:29 / stefan"
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  3713
    "Modified: / 17.11.2001 / 22:47:44 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3714
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3715
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3716
halt:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3717
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3718
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3719
    "enter debugger with halt-message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3720
     The error is reported by raising the HaltSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3722
    ^ HaltSignal raiseRequestWith:#halt: errorString:aString
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
    "Modified: 8.5.1996 / 09:13:23 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3727
implementedBySubclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3728
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3729
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3730
    "this is sent by ST/V code - its the same as #subclassResponsibility"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3731
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3732
    ^ self subclassResponsibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3733
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3734
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3735
indexNotInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3736
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3737
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3738
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3739
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3740
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3741
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3742
    ^ NonIntegerIndexSignal raiseRequestWith:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3743
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3744
    "Modified: / 8.5.1996 / 09:13:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3745
    "Modified: / 26.7.1999 / 10:57:43 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3746
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3747
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3748
indexNotInteger:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3749
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3750
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3751
    "report an error that index is not an Integer.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3752
     (when accessing collections indexed by an integer key).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3753
     The error is reported by raising the NonIntegerIndexSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3754
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3755
    ^ NonIntegerIndexSignal raiseRequestWith:anIndex 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3756
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3757
    "Created: / 16.5.1998 / 19:39:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3758
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3759
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3760
integerCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3761
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3762
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3763
    "generated when a variable declared with an integer type gets a bad
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3764
     value assigned"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3765
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3766
    ^ self error:'bad assign of ' , self printString , 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3767
		  ' (' , self class name , ') to integer-typed variable'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3768
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3769
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3770
invalidCodeObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3771
    "{ Pragma: +optSpace }"
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
    self error:'not an executable code object'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3774
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3775
    "Created: 1.8.1997 / 00:16:44 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3778
invalidMessage 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3779
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3780
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3781
    "this is sent by ST/V code - its the same as #shouldNotImplement"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3782
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3783
    ^ self shouldNotImplement
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3784
!
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
mustBeRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3787
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3788
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3789
    "report an argument-not-rectangle-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3790
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3791
    ^ self error:'argument must be a Rectangle'
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3794
mustBeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3795
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3796
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3797
    "report an argument-not-string-error"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3798
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3799
    ^ self error:'argument must be a String'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3800
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3801
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3802
notIndexed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3803
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3804
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3805
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3806
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3807
    "report an error that receiver has no indexed instance variables.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3808
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3809
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3810
    ^ SubscriptOutOfBoundsSignal 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3811
	raiseErrorString:'receiver has no indexed variables'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3812
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3813
    "Modified: 26.7.1996 / 16:43:13 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3814
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3815
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3816
openDebuggerOnException:ex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3817
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3818
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3819
    "enter the debugger on some unhandled exception"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3820
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3821
    |msgString debugger|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3822
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3823
    msgString := ex errorString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3824
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3825
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3826
     if there is no debugger,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3827
     ask for ignore or exit. Exit will terminate the applciation.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3828
     ignore will raise an abortSignal.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3829
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3830
    Debugger isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3831
	msgString := 'error: ' , msgString.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3832
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3833
	Smalltalk isStandAloneApp ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3834
	    Dialog notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3835
		(Dialog 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3836
		    confirm:msgString 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3837
		    title:(Smalltalk commandName)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3838
		    yesLabel:'ignore' noLabel:'exit'
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3839
		) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3840
		    ^ AbortSignal raise
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3841
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3842
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3843
	    msgString errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3844
	    OperatingSystem exit:1
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3845
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3846
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3847
	msgString errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3848
	Smalltalk fatalAbort:'no Debugger defined'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3849
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3850
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3851
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3852
     find an appropriate debugger to use
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3853
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3854
    debugger := self appropriateDebugger:(thisContext selector).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3855
    debugger isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3856
	^ AbortSignal raise
5755
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
    ^ debugger 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3860
	enter:ex suspendedContext
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3861
	withMessage:msgString 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3862
	mayProceed:(ex mayProceed).
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3863
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3864
    "Modified: 24.7.1997 / 10:09:20 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3865
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3866
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3867
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3868
primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3869
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3870
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3871
    "report an error that some primitive code failed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3872
     The error is reported by raising the PrimitiveFailureSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3873
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3874
    ^ PrimitiveFailureSignal raiseRequestWith:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3875
6005
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3876
    "
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3877
     1234 primitiveFailed
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3878
    "
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3879
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3880
    "Modified: / 8.5.1996 / 09:14:07 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3881
    "Modified: / 26.7.1999 / 10:58:08 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3882
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3883
6005
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3884
primitiveFailed:messageString
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3885
    "{ Pragma: +optSpace }"
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3886
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3887
    "report an error that some primitive code failed.
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3888
     The error is reported by raising the PrimitiveFailureSignal exception."
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3889
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3890
    ^ PrimitiveFailureSignal raiseRequestWith:nil errorString:messageString
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3891
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3892
    "
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3893
     1234 primitiveFailed:'this is a test'
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3894
    "
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3895
!
012813d02bf7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6000
diff changeset
  3896
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3897
shouldNotImplement
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3898
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3899
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3900
    "report an error that this message should not be implemented"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3901
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3902
    ^ self error:'method not appropriate for this class'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3903
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3904
    "Modified: 8.5.1996 / 09:09:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3905
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3906
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3907
subclassResponsibility
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3908
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3909
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3910
    "report an error that this message should have been reimplemented in a
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3911
     subclass"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3912
5980
5fd29de6d596 more class based exceptions
Claus Gittinger <cg@exept.de>
parents: 5977
diff changeset
  3913
    ^ Object subclassResponsibilitySignal
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3914
	raiseErrorString:'method must be reimplemented in subclass'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3915
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3916
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3917
subscriptBoundsError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3918
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3919
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3920
    "report an error that some index is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3921
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3922
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3923
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3924
    ^ SubscriptOutOfBoundsSignal raiseRequestWith:nil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3925
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3926
    "Modified: / 26.7.1996 / 16:45:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3927
    "Modified: / 26.7.1999 / 10:58:27 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3928
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3929
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3930
subscriptBoundsError:anIndex
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3931
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3932
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3933
    "report an error that anIndex is out of bounds.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3934
     (when accessing indexable collections).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3935
     The error is reported by raising the SubscriptOutOfBoundsSignal exception."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3936
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  3937
    ^ SubscriptOutOfBoundsError 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3938
	raiseRequestWith:anIndex 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3939
	errorString:('subscript (' , anIndex printString , ') out of bounds')
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3940
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  3941
    "Modified: / 17.11.2001 / 22:49:56 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3942
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3943
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3944
typeCheckError
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3945
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3946
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3947
    "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
  3948
     value assigned"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3949
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3950
    ^ self error:'bad assign of ' , self printString ,
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3951
		  ' (' , self class name , ') to typed variable'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3952
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3953
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3954
!Object methodsFor:'evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3955
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3956
value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3957
    "return the receiver itself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3958
     This allows every object to be used where blocks or valueHolders
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3959
     are typically used, and allows for valueHolders and blocks to be
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3960
     used interchangably in some situations.
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
     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
  3963
     style ... (the idea was borrowed from the Self language).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3964
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3965
     WARNING: dont 'optimize' away ifXXX: blocks 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3966
	      (i.e. do NOT replace 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3967
			foo ifTrue:[var1] ifFalse:[var2]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3968
	       by:
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3969
			foo ifTrue:var1 ifFalse:var2
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3970
	      )
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3971
	      - the compilers will only generate inline code for the if, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3972
		iff the argument(s) are blocks - otherwise, a true send is
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3973
		generated.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3974
	      This 'oprimization' will work semantically correct,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  3975
	      but execute SLOWER instead."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3976
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3977
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3978
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3979
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3980
     #(1 2 3 4) indexOf:5 ifAbsent:0     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3981
     #(1 2 3 4) indexOf:5 ifAbsent:[0]     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3982
     1 > 2 ifTrue:['yes'] ifFalse:['no']  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3983
     1 > 2 ifTrue:'yes' ifFalse:'no'       
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3984
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3985
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3986
    "DO NOT DO THIS (its slower)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3987
     (1 > 4) ifTrue:'oops' ifFalse:'ok'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3988
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3989
     USE (the compiler optimizes blocks in if/while):
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3990
     (1 > 4) ifTrue:['oops'] ifFalse:['ok']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3991
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3992
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3993
    "Modified: 3.5.1996 / 11:57:08 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3996
!Object methodsFor:'finalization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3997
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  3998
disposed
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  3999
    "OBSOLETE INTERFACE: use #finalize
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4000
     this is invoked for objects which have been registered
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4001
     in a Registry, when the original object dies.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4002
     Subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4003
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4004
    <resource: #obsolete>
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4005
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4006
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4007
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4008
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4009
executor
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4010
    "Return the object which does the finalization for me.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4011
     This interface is also VW & Sqeak compatible,"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4012
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4013
    "for now, send #shallowCopyForFinalization, to be compatible with
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4014
     classes designed for old ST/X versions"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4015
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4016
    ^ self shallowCopyForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4017
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4018
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4019
finalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4020
    "answer a Registry used for finalization.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4021
     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
  4022
     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
  4023
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4024
    ^ FinalizationLobby
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4025
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4026
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4027
finalize
6439
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4028
    "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
  4029
     in a Registry, when the original object dies.
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4030
     Subclasses may redefine this method
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4031
     This interface is also VW-compatible"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4032
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4033
    "send #disposed for compatibility with existing classes that still
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4034
     implement the obsolete #disposed message"
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4035
0f841258ec4a Use #finalize instead of #disposed
Stefan Vogel <sv@exept.de>
parents: 6421
diff changeset
  4036
    ^ self disposed
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4037
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4038
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4039
reRegisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4040
    "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
  4041
     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
  4042
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4043
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4044
    self finalizationLobby registerChange:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4045
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4046
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4047
registerForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4048
    "register mySelf for later finalization.
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4049
     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
  4050
     the receiver is garbage collected."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4051
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4052
    self finalizationLobby register:self
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4053
!
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4054
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4055
shallowCopyForFinalization
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4056
    "OBSOLETE INTERFACE: use #executor.
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4057
     This is used to aquire a copy to be used for finalization -
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4058
     (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
  4059
     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
  4060
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4061
    <resource: #obsolete>
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4062
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4063
    ^ self shallowCopy
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4064
!
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
unregisterForFinalization
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4067
    "unregister mySelf from later finalization"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4068
6461
f5efaff3457b Allow #registerForFinalization for classes defining their own Lobby.
Stefan Vogel <sv@exept.de>
parents: 6439
diff changeset
  4069
    self finalizationLobby unregister:self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4070
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4071
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4072
!Object methodsFor:'initialization'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4073
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4074
initialize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4075
    "just to ignore initialize to objects which do not need it"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4076
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4077
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4078
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4079
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4080
!Object methodsFor:'interest'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4081
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4082
addInterest:anInterest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4083
    "install an interest forwarder.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4084
     Here, we use the nonWeakDependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4085
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4086
    self addNonWeakDependent:anInterest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4087
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4088
    "Created: 14.10.1996 / 22:27:34 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4089
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4090
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4091
expressInterestIn:aspect for:anObject sendBack:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4092
    "arrange for aSelector to be sent to anObject whenever the receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4093
     changes aspect."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4094
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4095
    "/ for now, use an interestConverter, which is somewhat less efficient.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4096
    "/ In the future, a more intelligent DependencyCollection class is planned for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4097
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4098
    self addInterest:(InterestConverter 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4099
			    destination:anObject 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4100
			    selector:aSelector 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4101
			    aspect:aspect)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4102
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4103
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4104
     |p b|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4105
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4106
     b := [Transcript showCR:' -> the point changed'].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4107
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4108
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4109
     Transcript showCR:'interest in #foo:'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4110
     p expressInterestIn:#foo for:b sendBack:#value.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4111
     p x:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4112
     Transcript showCR:'now changing #bar ... (expect no notification)'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4113
     p changed:#bar.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4114
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4115
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4116
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4117
     Transcript showCR:'now changing #foo ... (expect notification)'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4118
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4119
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4120
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4121
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4122
     Transcript showCR:'no more interest in #foo:'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4123
     p retractInterestIn:#foo for:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4124
     Transcript showCR:'now changing #foo ... (expect no notification)'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4125
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4126
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4127
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4128
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4129
     Transcript showCR:'interest in #bar now:'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4130
     p expressInterestIn:#bar for:b sendBack:#value.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4131
     Transcript showCR:'now changing #foo ... (expect no notification)'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4132
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4133
     Transcript showCR:'now changing #bar ... (expect notification)'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4134
     p changed:#bar.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4135
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4136
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4137
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4138
     Transcript showCR:'interest in #foo now:'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4139
     p expressInterestIn:#foo for:b sendBack:#value.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4140
     Transcript showCR:'now changing #foo ... (expect notification)'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4141
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4142
     Transcript showCR:'now changing #bar ... (expect notification)'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4143
     p changed:#bar.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4144
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4145
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4146
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4147
     Transcript showCR:'no more interests:'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4148
     p retractInterestsFor:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4149
     Transcript showCR:'now changing #foo ... (expect no notification)'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4150
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4151
     Transcript showCR:'now changing #bar...  (expect no notification)'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4152
     p changed:#bar.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4153
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4154
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4155
     p release.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4156
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4157
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4158
    "Created: 19.4.1996 / 10:26:22 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4159
    "Modified: 19.4.1996 / 12:34:08 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4160
    "Modified: 14.10.1996 / 22:28:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4161
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4162
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4163
interests
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4164
    "return a Collection of interests - empty if there is none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4165
     Here, we use the nonWeakDependents for interests."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4166
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4167
    ^ self nonWeakDependents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4168
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4169
    "Created: / 14.10.1996 / 22:20:51 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4170
    "Modified: / 30.1.1998 / 14:07:35 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4171
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4172
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4173
interestsFor:someOne
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4174
    "return a collection of interests of someOne - empty if there is none."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4175
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4176
    |coll deps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4177
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4178
    deps := self interests.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4179
    deps size == 0 ifTrue:[^ #()].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4180
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4181
    coll := IdentitySet new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4182
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4183
    deps do:[:dep |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4184
	(dep isMemberOf:InterestConverter) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4185
	    dep destination == someOne ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4186
		coll add:dep.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4187
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4188
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4189
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4190
    ^ coll
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4191
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4192
    "Created: / 30.1.1998 / 14:02:26 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4193
    "Modified: / 30.1.1998 / 14:08:24 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4194
!
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
onChangeEvaluate:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4197
    "arrange for aBlock to be evaluated whenever the receiver changes."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4198
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4199
    ^ self onChangeSend:#value to:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4200
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4201
    "Created: / 29.1.1999 / 16:01:22 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4202
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4203
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4204
onChangeSend:aSelector to:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4205
    "arrange for aSelector to be sent to anObject whenever the receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4206
     changes."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4207
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4208
    "/ for now, use an interestConverter, which is somewhat less efficient.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4209
    "/ In the future, a more intelligent DependencyCollection class is planned for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4210
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4211
    self addInterest:(InterestConverter 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4212
			  destination:anObject 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4213
			  selector:aSelector)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4214
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4215
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4216
     |p b|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4217
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4218
     b := [Transcript showCR:'the point changed'].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4219
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4220
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4221
     p onChangeSend:#value to:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4222
     p x:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4223
     Transcript showCR:'now changing'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4224
     p changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4225
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4226
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4227
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4228
     Transcript showCR:'now changing'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4229
     p changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4230
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4231
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4232
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4233
     Transcript showCR:'no more interest'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4234
     p retractInterestsFor:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4235
     Transcript showCR:'now changing again'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4236
     p changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4237
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4238
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4239
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4240
     Transcript showCR:'interest again'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4241
     p onChangeSend:#value to:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4242
     Transcript showCR:'now changing again'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4243
     p changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4244
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4245
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4246
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4247
    "Created: 19.4.1996 / 10:26:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4248
    "Modified: 19.4.1996 / 12:34:26 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4249
    "Modified: 14.10.1996 / 22:28:27 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4250
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4251
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4252
removeInterest:anInterest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4253
    "remove an interest forwarder.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4254
     Here, we use the nonWeakDependencies."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4255
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4256
    self removeNonWeakDependent:anInterest
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4257
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4258
    "Created: 14.10.1996 / 22:21:59 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4259
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4260
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4261
retractInterestIn:aspect for:someOne
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4262
    "remove the interest of someOne in the receiver changing aspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4263
     (as installed with #expressInterestIn:for:sendBack:)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4264
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4265
    "/ for now, remove the interestConverter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4266
    "/ In the future, a more intelligent DependencyCollection class is planned for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4267
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4268
    "/ cannot removeDependent within the loop - the collection rehashes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4269
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4270
    |deps coll|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4271
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4272
    deps := self interests.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4273
    deps size ~~ 0 ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4274
	coll := IdentitySet new.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4275
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4276
	deps do:[:dep |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4277
	    (dep isMemberOf:InterestConverter) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4278
		dep destination == someOne ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4279
		    dep aspect == aspect ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4280
			self removeInterest:dep.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4281
			^ self
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4282
		    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4283
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4284
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4285
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4286
	coll do:[:dep |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4287
	    self removeInterest:dep.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4288
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4289
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4290
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4291
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
     |p b|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4294
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4295
     b := [Transcript showCR:'the point changed'].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4296
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4297
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4298
     Transcript showCR:'interest in #foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4299
     p expressInterestIn:#foo for:b sendBack:#value.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4300
     p x:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4301
     Transcript showCR:'now changing #bar'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4302
     p changed:#bar.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4303
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4304
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4305
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4306
     Transcript showCR:'now changing #foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4307
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4308
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4309
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4310
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4311
     Transcript showCR:'no more interest in #foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4312
     p retractInterestIn:#foo for:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4313
     Transcript showCR:'now changing #foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4314
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4315
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4316
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4317
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4318
     Transcript showCR:'interest in #bar now'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4319
     p expressInterestIn:#bar for:b sendBack:#value.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4320
     Transcript showCR:'now changing #foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4321
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4322
     Transcript showCR:'now changing #bar'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4323
     p changed:#bar.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4324
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4325
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4326
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4327
     Transcript showCR:'interest in #foo now'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4328
     p expressInterestIn:#foo for:b sendBack:#value.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4329
     Transcript showCR:'now changing #foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4330
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4331
     Transcript showCR:'now changing #bar'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4332
     p changed:#bar.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4333
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4334
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4335
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4336
     Transcript showCR:'no more interests'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4337
     p retractInterestsFor:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4338
     Transcript showCR:'now changing #foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4339
     p changed:#foo.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4340
     Transcript showCR:'now changing #bar'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4341
     p changed:#bar.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4342
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4343
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4344
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4345
    "Created: / 19.4.1996 / 10:27:11 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4346
    "Modified: / 14.10.1996 / 22:21:19 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4347
    "Modified: / 30.1.1998 / 14:05:34 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4348
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4349
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4350
retractInterestsFor:someOne
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4351
    "remove the interest of someOne in the receiver 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4352
     (as installed with #onChangeSend:to:)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4353
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4354
    "/ for now, remove the interestConverter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4355
    "/ In the future, a more intelligent DependencyCollection class is planned for
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4356
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4357
    |coll deps|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4358
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4359
    "/ cannot removeDependent within the loop - the collection rehashes
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4360
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4361
    deps := self interests.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4362
    deps size ~~ 0 ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4363
	coll := IdentitySet new.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4364
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4365
	deps do:[:dep |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4366
	    (dep isMemberOf:InterestConverter) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4367
		dep destination == someOne ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4368
		    coll add:dep.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4369
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4370
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4371
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4372
	coll do:[:dep |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4373
	    self removeInterest:dep.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4374
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4375
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4376
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4377
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4378
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4379
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4380
     |p b|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4381
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4382
     b := [Transcript showCR:'the point changed'].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4383
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4384
     p := Point new.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4385
     p onChangeSend:#value to:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4386
     p x:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4387
     Transcript showCR:'now changing'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4388
     p changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4389
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4390
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4391
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4392
     Transcript showCR:'now changing'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4393
     p changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4394
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4395
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4396
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4397
     Transcript showCR:'no more interest'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4398
     p retractInterestsFor:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4399
     Transcript showCR:'now changing again'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4400
     p changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4401
     Transcript cr.
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
     Delay waitForSeconds:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4404
     Transcript showCR:'interest again'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4405
     p onChangeSend:#value to:b.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4406
     Transcript showCR:'now changing again'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4407
     p changed.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4408
     Transcript cr.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4409
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4410
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4411
    "Created: / 19.4.1996 / 10:23:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4412
    "Modified: / 14.10.1996 / 22:21:25 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4413
    "Modified: / 30.1.1998 / 14:04:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4414
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4415
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4416
!Object methodsFor:'interrupt handling'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4418
childSignalInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4419
    "death of a child process (unix process) - do nothing"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4420
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4421
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4422
!
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
customInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4425
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4426
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4427
    "a custom interrupt - but no handler has defined"
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
    self error:'custom interrupt' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4430
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4431
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4432
errorInterrupt:errorID with:aParameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4433
    "subsystem error. The arguments errorID and aParameter are the values passed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4434
     to the 'errorInterruptWithIDAndParameter(id, param)' function, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4435
     which can be called from C subsystems to raise an (asynchronous)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4436
     error exception.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4437
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4438
     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
  4439
     used from other C subsystems too, to upcast errors.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4440
     Especially, for subsystems which call errorHandler functions asynchronously.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4441
     IDs (currently) used:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4442
	#DisplayError ..... x-error interrupt
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4443
	#XtError      ..... xt-error interrupt (Xt interface is not yet published)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4444
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4445
6263
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4446
    |handlers handler|
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4447
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4448
    handlers := ObjectMemory registeredErrorInterruptHandlers.
4e7a970e4cfc errorInterrupt:with: fixed (care for nil handlers in Objmem)
Claus Gittinger <cg@exept.de>
parents: 6235
diff changeset
  4449
    handlers notNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4450
	handler := handlers at:errorID ifAbsent:nil.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4451
	handler notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4452
	    "/
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4453
	    "/ handler found; let it do whatever it wants ...
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4454
	    "/
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4455
	    handler errorInterrupt:errorID with:aParameter.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4456
	    ^ self
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4457
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4458
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4459
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
    "/ no handler - raise errorSignal passing the errorId as parameter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4462
    "/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4463
    ^ ErrorSignal 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4464
	raiseRequestWith:errorID 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4465
	errorString:('Subsystem error. ErrorID = ' , errorID printString)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4466
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4467
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4468
exceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4469
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4470
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4471
    "exception interrupt - enter debugger"
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
    self error:'exception Interrupt' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4474
!
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
fpExceptionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4477
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4478
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4479
    "a floating point exception occured - this one
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4480
     has to be handled differently since it comes asynchronous
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4481
     on some machines (for example, on machines with a separate FPU
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4482
     or superscalar architectures. Also, errors from within primitive code
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4483
     (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
  4484
     mechanism this way."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4486
    |where rec|
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
    where := thisContext sender.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4489
    rec := where receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4490
    rec isNumber ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4491
	^ rec class
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4492
	    raise:#domainErrorSignal
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4493
	    receiver:rec
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4494
	    selector:where selector
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4495
	    arguments:(where args asArray)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4496
	    errorString:'floating point exception'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4497
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4498
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4499
    "/ could be in some C-library ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4500
    ^ Float domainErrorSignal raise
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4503
internalError:msg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4504
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4505
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4506
    "this is triggered, when VM hits some bad error,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4507
     such as corrupted class, corrupted method/selector array
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4508
     etc. The argument string gives some more information on what happened.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4509
     (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
  4510
     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
  4511
     this error occurred ...."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4512
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4513
    InternalErrorSignal raiseWith:self errorString:msg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4514
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4515
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4516
ioInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4517
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4518
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4519
    "I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4520
     If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4521
     or it does not understand the ioInterrupt message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4522
     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
  4523
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4524
    self error:'I/O Interrupt - but no handler' mayProceed:true
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4527
memoryInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4528
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4529
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4530
    "out-of-memory interrupt and no handler - enter debugger"
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
    self error:'almost out of memory' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4533
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4534
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4535
recursionInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4536
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4537
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4538
    "recursion limit (actually: stack overflow) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4539
     This interrupt is triggered, when a process stack grows above
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4540
     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
  4541
     could be caught.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4542
     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
  4543
     and the exception can be resumed.
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4544
     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
  4545
     is not proceedable.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4546
     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
  4547
     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
  4548
     or debug for a while.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4549
     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
  4550
     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
  4551
     terminates the process."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4552
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4553
    |con remaining|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4554
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4555
    (con := thisContext) isRecursive ifFalse:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4556
"/        Processor activeProcess usedStackSize < Processor activeProcess maximumStackSize ifTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4557
"/            "/ mhmh - it hit me, but I am not responsible ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4558
"/            'Stray recursionInterrupt ...' infoPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4559
"/            ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4560
"/        ].
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4561
	ObjectMemory infoPrinting ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4562
	    'Object [info]: recursionInterrupt from:' printCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4563
	    con := con sender.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4564
	    remaining := 50.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4565
	    [con notNil and:[remaining > 0]] whileTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4566
		'| ' print. con fullPrint.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4567
		con := con sender.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4568
		remaining := remaining - 1
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4569
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4570
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4571
	^ RecursionInterruptSignal raiseSignal
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4572
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4573
6175
e9970db3e02f recursionInterrupt fixes for win32 (& comment changed)
Claus Gittinger <cg@exept.de>
parents: 6157
diff changeset
  4574
    "Modified: / 10.11.2001 / 15:15:56 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4575
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4576
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4577
schedulerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4578
    "{ Pragma: +optSpace }"
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
    "scheduler interrupt (supposed to be sent to Processor).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4581
     If we arrive here, either the Processor does not understand it,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4582
     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
  4583
     big trouble. Enter debugger."
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
    self error:'schedulerInterrupt - but no Processor' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4586
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4587
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4588
signalInterrupt:signalNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4589
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4590
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4591
    "unix signal occured - some signals are handled as Smalltalk Exceptions 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4592
     (SIGPIPE), others (SIGBUS) are rather fatal ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4593
     In any case, IF a smalltalk-signal has been connected to the OS signal,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4594
     that one is raised.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4595
     Otherwise, a dialog is shown, asking the user on how to handle the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4596
     signal.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4597
     TODO: add another argument, giving more detailed signal info (PC, VADDR,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4598
     exact cause etc.). This helps if segvs occur in primitive code.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4599
     Currently (temporary kludge), these are passed as global variables."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4600
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4601
    |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
  4602
     action title screen|
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4603
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4604
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4605
    "if there has been an ST-signal installed, use it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4606
    sig := OperatingSystem operatingSystemSignal:signalNumber.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4607
    sig notNil ifTrue:[
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4608
        sig raise.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4609
        ^ self.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4610
    ].
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
    "/ if handled, raise OSSignalInterruptSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4613
    OSSignalInterruptSignal isHandled ifTrue:[
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4614
        OSSignalInterruptSignal raiseRequestWith:signalNumber.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4615
        ^ self.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4616
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4617
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4618
    "
5856
6d3df9ad361e save crash image when sigPWR or sigHUP arrives
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  4619
     special case - SIGPWR/SIGHUP: write a crash image
6d3df9ad361e save crash image when sigPWR or sigHUP arrives
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  4620
    "
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4621
    (signalNumber == 30 "OperatingSystem sigPWR" 
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4622
     or:[signalNumber == 1 "OperatingSystem sigHUP"]) ifTrue:[
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4623
        ObjectMemory snapShotOn:'crash.img'.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4624
        ^ self.
5856
6d3df9ad361e save crash image when sigPWR or sigHUP arrives
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  4625
    ].
6d3df9ad361e save crash image when sigPWR or sigHUP arrives
Claus Gittinger <cg@exept.de>
parents: 5824
diff changeset
  4626
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4627
    name := OperatingSystem nameForSignal:signalNumber.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4628
    here := thisContext.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4629
    badContext := here sender.          "the context, in which the signal occurred"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4630
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4631
    "if there is no screen at all, bring up a mini debugger"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4632
    (Screen isNil 
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4633
     or:[(screen := Screen current) isNil
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4634
     or:[(screen := Screen default) isNil]]) ifTrue:[
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4635
        ^ self startMiniDebuggerOrExit:'Signal (' , name, ')'.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4636
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4637
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4638
    "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
  4639
     otherwise display stays locked"
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4640
    screen ungrabPointer; ungrabKeyboard.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4641
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4642
    "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
  4643
    Screen currentScreenQuerySignal answer:screen do:[
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4644
        "
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4645
         SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue)
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4646
         since the system will retry the faulty instruction, which leads to
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4647
         another signal - to avoid frustration, better not offer this option.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4648
        "
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4649
        fatal := OperatingSystem isFatalSignal:signalNumber.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4650
        fatal ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4651
            (Debugger isNil or:[here isRecursive]) ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4652
                'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4653
                ^ self startMiniDebuggerOrExit:'Signal (' , name, ')'.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4654
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4655
            "
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4656
             a hard signal - go into debugger immediately
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4657
            "
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4658
            msg := 'OS-signal: ', name.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4659
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4660
            "/ the IRQ-PC is passed as low-hi, to avoid the need
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4661
            "/ to allocate a LargeInteger in the VM during signal
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4662
            "/ time. I know, this is ugly.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4663
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4664
            InterruptPcLow notNil ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4665
                pc := InterruptPcLow + (InterruptPcHi bitShift:(SmallInteger maxBits + 1 // 2)).
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4666
                pc ~~ 0 ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4667
                    msg := msg , ' PC=' , (pc printStringRadix:16)
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4668
                ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4669
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4670
            InterruptAddrLow notNil ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4671
                addr := InterruptAddrLow + (InterruptAddrHi bitShift:(SmallInteger maxBits + 1 // 2)).
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4672
                addr ~~ 0 ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4673
                    msg := msg , ' ADDR=' , (addr printStringRadix:16)
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4674
                ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4675
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4676
            Debugger enter:here withMessage:msg mayProceed:false.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4677
            "unreachable"
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4678
            ^ nil.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4679
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4680
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4681
        "if possible, open an option box asking the user what do.       
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4682
         Otherwise, start a debugger"
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4683
        Dialog notNil ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4684
            titles := #('save crash image' 'dump core' 'exit ST/X' 'debug').
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4685
            actions := #(save core exit debug).
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4686
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4687
            action := nil.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4688
            title := 'OS Signal caught (' , name, ')'.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4689
            title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4690
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4691
            "/ if cought while in the scheduler or event dispatcher,
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4692
            "/ a modal dialog is not possible ...
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4693
            "/ (therefore, abort & return does not makes sense)
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4694
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4695
            Processor activeProcess isSystemProcess ifFalse:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4696
                titles := #('abort') , titles.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4697
                actions := #(abort), actions. 
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4698
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4699
                badContext canReturn ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4700
                    titles := #('return') , titles.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4701
                    actions :=  #(return), actions.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4702
                ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4703
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4704
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4705
            fatal ifFalse:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4706
                titles := titles, #('ignore').
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4707
                actions := actions , #(ignore).
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4708
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4709
            action := Dialog choose:title
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4710
                             labels:titles
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4711
                             values:actions
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4712
                             default:(fatal ifTrue:[nil] ifFalse:[#ignore]).
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4713
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4714
            "Dialog may fail (if system process), default action is debug"
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4715
            action size == 0 ifTrue:[action := #debug].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4716
        ] ifFalse:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4717
            action := #debug.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4718
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4719
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4720
        action == #save ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4721
            ObjectMemory snapShotOn:'crash.img'
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4722
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4723
        action == #core ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4724
            Smalltalk fatalAbort
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4725
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4726
        action == #exit ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4727
            Smalltalk exit
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4728
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4729
        action == #return ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4730
            badContext return
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4731
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4732
        action == #abort ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4733
            AbortSignal raise.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4734
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4735
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4736
        action == #debug ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4737
            Debugger isNil ifTrue:[
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4738
                ^ self startMiniDebuggerOrExit:'Signal (' , name, ')'.
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4739
            ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4740
            Debugger enter:here withMessage:('Signal ', name) mayProceed:true. 
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4741
        ].
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  4742
        "action == #ignore"
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4743
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4744
!
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
spyInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4747
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4748
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4749
    "spy interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4750
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4751
    self error:'spy Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4752
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4753
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4754
startMiniDebuggerOrExit:text
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4755
    "some critical condition happened.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4756
     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
  4757
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4758
    MiniDebugger isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4759
	"a system without debugging facilities (i.e. a standalone system)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4760
	 output a message and exit."
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4761
	('Object [error]: exit due to ', text, ' - and no debugger.') errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4762
	OperatingSystem exit:99.
6388
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4763
    ].
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4764
    MiniDebugger enterWithMessage:text mayProceed:true.
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4765
!
41396e0cc89f Fix #signalInterrupt: for multi-display and headless.
Stefan Vogel <sv@exept.de>
parents: 6328
diff changeset
  4766
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4767
timerInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4768
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4769
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4770
    "timer interrupt and no handler - enter debugger"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4771
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4772
    self error:'timer Interrupt - but no handler' mayProceed:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4773
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4774
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4775
userInterrupt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4776
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4777
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4778
    "user (^c) interrupt.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4779
     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
  4780
     controlling tty (i.e. in the xterm)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4781
6466
ae28dd895a58 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6461
diff changeset
  4782
    UserInterruptSignal raiseRequest
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4783
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4784
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4785
userInterruptIn:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4786
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4787
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4788
    "user (^c) interrupt - enter debugger, but show aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4789
     as top-context. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4790
     This is used to hide any intermediate scheduler contexts, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4791
     in case of an interrupted process. Typically, this is sent by
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4792
     the WindowGroup, when a keyboardEvent for the ctrl-C key is
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4793
     processed."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4794
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4795
    <context: #return>
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4796
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4797
    UserInterruptSignal raiseRequestWith:nil errorString:nil in:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4798
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4799
    "Created: / 18.10.1996 / 20:46:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4800
    "Modified: / 20.10.1996 / 13:06:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4801
    "Modified: / 26.7.1999 / 10:58:49 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4802
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4803
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4804
!Object methodsFor:'message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4805
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4806
perform:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4807
    "send the message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4808
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4809
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4810
    REGISTER OBJ sel = aSelector;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4811
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4812
    if (InterruptPending == nil) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4813
	struct inlineCache *pIlc;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4814
	static struct inlineCache ilc_0 = __ILCPERF0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4815
	static struct inlineCache ilc_1 = __ILCPERF0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4816
	static struct inlineCache ilc_2 = __ILCPERF0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4817
	static struct inlineCache ilc_3 = __ILCPERF0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4818
	static struct inlineCache ilc_4 = __ILCPERF0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4819
	static OBJ last_0 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4820
	static OBJ last_1 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4821
	static OBJ last_2 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4822
	static OBJ last_3 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4823
	static OBJ last_4 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4824
	static flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4825
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4826
	if (sel == last_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4827
	    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4828
	} else if (sel == last_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4829
	    pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4830
	} else if (sel == last_2) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4831
	    pIlc = &ilc_2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4832
	} else if (sel == last_3) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4833
	    pIlc = &ilc_3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4834
	} else if (sel == last_4) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4835
	    pIlc = &ilc_4;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4836
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4837
	    if (flip == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4838
		pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4839
		flip = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4840
		last_0 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4841
	    } else if (flip == 1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4842
		pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4843
		flip = 2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4844
		last_1 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4845
	    } else if (flip == 2) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4846
		pIlc = &ilc_2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4847
		flip = 3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4848
		last_2 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4849
	    } else if (flip == 3) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4850
		pIlc = &ilc_3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4851
		flip = 4;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4852
		last_3 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4853
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4854
		pIlc = &ilc_4;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4855
		flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4856
		last_4 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4857
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4858
	    pIlc->ilc_func = __SEND0ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4859
	    if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4860
		__flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4861
		pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4862
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4863
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4864
	RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4865
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4866
	static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4867
	RETURN (_SEND0(self, aSelector, nil, &ilc0));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4868
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4869
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4870
    ^ self perform:aSelector withArguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4871
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4872
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4873
perform:aSelector inClass:aClass withArguments:argArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4874
    "send the message aSelector with all args taken from argArray 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4875
     to the receiver as a super-send message.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4876
     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
  4877
     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
  4878
     immediate superclass).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4879
     Thus, it is (theoretically) possible to do 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4880
	 '5 perform:#< inClass:Magnitude withArguments:#(6)'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4881
     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
  4882
     This method is used by the interpreter to evaluate super sends
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4883
     and could be used for very special behavior (language extension ?).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4884
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4885
     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
  4886
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  4887
    |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
  4888
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4889
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4890
     check, if aClass is really a superclass of the receiver
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4891
    "
5769
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  4892
    myClass := self class.
8f874be55bc9 lookup-class check in #perform:inClass was too strong.
Claus Gittinger <cg@exept.de>
parents: 5755
diff changeset
  4893
    (myClass == aClass or:[myClass isSubclassOf:aClass]) ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4894
	self error:'lookup-class argument is not a superclass of the receiver'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4895
	^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4896
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4897
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4898
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4899
    int nargs, i;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4900
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4901
    if (__isArray(argArray)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4902
	nargs = __arraySize(argArray);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4903
	argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4904
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4905
	if (__isNonNilObject(argArray)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4906
	    static struct inlineCache ilcSize = __ILC0(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4907
	    numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4908
	    if (!__isSmallInteger(numberOfArgs)) 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4909
		goto bad;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4910
	    nargs = __intVal(numberOfArgs);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4911
	    argP = (OBJ *)(&a1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4912
	    for (i=1; i <= nargs; i++) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4913
		*argP++ = __AT_(argArray, __MKSMALLINT((INT)i));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4914
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4915
	    argP = (OBJ *)(&a1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4916
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4917
	    nargs = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4918
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4919
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  4920
    switch (nargs) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4921
	case 0:
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4922
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4923
		static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4924
		RETURN ( _SEND0(self, aSelector, aClass, &ilc0));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4925
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4926
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4927
	case 1: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4928
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4929
		static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4930
		RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4931
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4932
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4933
	case 2: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4934
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4935
		static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4936
		RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4937
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4938
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4939
	case 3: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4940
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4941
		static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4942
		RETURN ( _SEND3(self, aSelector, aClass, &ilc3, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4943
				argP[0], argP[1], argP[2]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4944
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4945
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4946
	case 4: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4947
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4948
		static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4949
		RETURN ( _SEND4(self, aSelector, aClass, &ilc4,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4950
				argP[0], argP[1], argP[2], argP[3]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4951
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4952
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4953
	case 5: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4954
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4955
		static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4956
		RETURN ( _SEND5(self, aSelector, aClass, &ilc5, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4957
				argP[0], argP[1], argP[2], argP[3], argP[4]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4958
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4959
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4960
	case 6: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4961
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4962
		static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4963
		RETURN ( _SEND6(self, aSelector, aClass, &ilc6, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4964
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4965
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4966
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4967
	case 7: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4968
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4969
		static struct inlineCache ilc7 = __DUMMYILCSELF7(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4970
		RETURN ( _SEND7(self, aSelector, aClass, &ilc7, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4971
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4972
				argP[6]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4973
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4974
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4975
	case 8: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4976
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4977
		static struct inlineCache ilc8 = __DUMMYILCSELF8(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4978
		RETURN ( _SEND8(self, aSelector, aClass, &ilc8, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4979
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4980
				argP[6], argP[7]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4981
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4982
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4983
	case 9: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4984
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4985
		static struct inlineCache ilc9 = __DUMMYILCSELF9(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4986
		RETURN ( _SEND9(self, aSelector, aClass, &ilc9, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4987
				argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4988
				argP[6], argP[7], argP[8]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4989
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4990
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4991
	case 10: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4992
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4993
		static struct inlineCache ilc10 = __DUMMYILCSELF10(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4994
		RETURN ( _SEND10(self, aSelector, aClass, &ilc10, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4995
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4996
				 argP[6], argP[7], argP[8], argP[9]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4997
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4998
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  4999
	case 11: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5000
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5001
		static struct inlineCache ilc11 = __DUMMYILCSELF11(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5002
		RETURN ( _SEND11(self, aSelector, aClass, &ilc11, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5003
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5004
				 argP[6], argP[7], argP[8], argP[9], argP[10]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5005
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5006
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5007
	case 12: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5008
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5009
		static struct inlineCache ilc12 = __DUMMYILCSELF12(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5010
		RETURN ( _SEND12(self, aSelector, aClass, &ilc12, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5011
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5012
				 argP[6], argP[7], argP[8], argP[9], argP[10], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5013
				 argP[11]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5014
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5015
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5016
	case 13: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5017
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5018
		static struct inlineCache ilc13 = __DUMMYILCSELF13(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5019
		RETURN ( _SEND13(self, aSelector, aClass, &ilc13, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5020
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5021
				 argP[6], argP[7], argP[8], argP[9], argP[10], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5022
				 argP[11], argP[12]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5023
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5024
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5025
	case 14: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5026
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5027
		static struct inlineCache ilc14 = __DUMMYILCSELF14(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5028
		RETURN ( _SEND14(self, aSelector, aClass, &ilc14, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5029
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5030
				 argP[6], argP[7], argP[8], argP[9], argP[10], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5031
				 argP[11], argP[12], argP[13]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5032
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5033
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5034
	case 15: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5035
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5036
		static struct inlineCache ilc15 = __DUMMYILCSELF15(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5037
		RETURN ( _SEND15(self, aSelector, aClass, &ilc15, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5038
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5039
				 argP[6], argP[7], argP[8], argP[9], argP[10], 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5040
				 argP[11], argP[12], argP[13], argP[14]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5041
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5042
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5043
#ifdef _SEND16
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5044
	case 16:
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5045
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5046
		static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5047
		RETURN ( _SEND16(self, aSelector, aClass, &ilc15,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5048
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5049
				 argP[6], argP[7], argP[8], argP[9], argP[10],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5050
				 argP[11], argP[12], argP[13], argP[14], argP[15]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5051
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5052
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5053
#ifdef _SEND17
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5054
	case 17:
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5055
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5056
		static struct inlineCache ilc17 = __DUMMYILCSELF17(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5057
		RETURN ( _SEND17(self, aSelector, aClass, &ilc15,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5058
				 argP[0], argP[1], argP[2], argP[3], argP[4], argP[5],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5059
				 argP[6], argP[7], argP[8], argP[9], argP[10],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5060
				 argP[11], argP[12], argP[13], argP[14], argP[15], argP[16]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5061
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5062
#endif
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5063
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5064
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5065
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5066
bad:;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5067
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5068
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5069
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5070
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5071
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5072
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5073
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5074
perform:aSelector with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5075
    "send the one-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5076
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5077
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5078
    REGISTER OBJ sel = aSelector;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5079
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5080
    if (InterruptPending == nil) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5081
	struct inlineCache *pIlc;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5082
	static struct inlineCache ilc_0 = __ILCPERF1(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5083
	static struct inlineCache ilc_1 = __ILCPERF1(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5084
	static struct inlineCache ilc_2 = __ILCPERF1(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5085
	static struct inlineCache ilc_3 = __ILCPERF1(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5086
	static struct inlineCache ilc_4 = __ILCPERF1(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5087
	static OBJ last_0 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5088
	static OBJ last_1 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5089
	static OBJ last_2 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5090
	static OBJ last_3 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5091
	static OBJ last_4 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5092
	static flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5093
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5094
	if (sel == last_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5095
	    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5096
	} else if (sel == last_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5097
	    pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5098
	} else if (sel == last_2) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5099
	    pIlc = &ilc_2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5100
	} else if (sel == last_3) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5101
	    pIlc = &ilc_3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5102
	} else if (sel == last_4) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5103
	    pIlc = &ilc_4;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5104
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5105
	    if (flip == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5106
		pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5107
		flip = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5108
		last_0 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5109
	    } else if (flip == 1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5110
		pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5111
		flip = 2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5112
		last_1 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5113
	    } else if (flip == 2) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5114
		pIlc = &ilc_2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5115
		flip = 3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5116
		last_2 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5117
	    } else if (flip == 3) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5118
		pIlc = &ilc_3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5119
		flip = 4;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5120
		last_3 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5121
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5122
		pIlc = &ilc_4;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5123
		flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5124
		last_4 = sel;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5125
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5126
	    pIlc->ilc_func = __SEND1ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5127
	    if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5128
		__flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5129
		pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5130
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5131
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5132
	RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5133
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5134
	static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5135
	RETURN (_SEND1(self, aSelector, nil, &ilc1, arg));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5136
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5137
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5138
    ^ self perform:aSelector withArguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5139
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5140
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5141
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5142
perform:aSelector with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5143
    "send the two-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5144
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5145
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5146
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5147
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5148
    if (InterruptPending == nil) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5149
	static struct inlineCache ilc_0 = __ILCPERF2(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5150
	static struct inlineCache ilc_1 = __ILCPERF2(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5151
	static OBJ last_0 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5152
	static OBJ last_1 = nil;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5153
	static flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5154
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5155
	if (aSelector == last_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5156
	    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5157
	} else if (aSelector == last_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5158
	    pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5159
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5160
	    if (flip == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5161
		pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5162
		flip = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5163
		last_0 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5164
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5165
		pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5166
		flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5167
		last_1 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5168
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5169
	    pIlc->ilc_func = __SEND2ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5170
	    if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5171
		__flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5172
		pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5173
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5174
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5175
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5176
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5177
	static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5178
	RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5179
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5180
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5181
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5182
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5183
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5184
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5185
perform:aSelector with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5186
    "send the three-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5187
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5188
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5189
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5190
    static struct inlineCache ilc_0 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5191
    static struct inlineCache ilc_1 = __ILCPERF3(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5192
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5193
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5194
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5195
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5196
    if (InterruptPending == nil) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5197
	if (aSelector != last_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5198
	    if (aSelector != last_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5199
		if (flip) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5200
		    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5201
		    flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5202
		    last_0 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5203
		} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5204
		    pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5205
		    flip = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5206
		    last_1 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5207
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5208
		pIlc->ilc_func = __SEND3ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5209
		if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5210
		    __flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5211
		    pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5212
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5213
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5214
		pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5215
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5216
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5217
	    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5218
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5219
	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
  5220
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5221
	static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5222
	RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5223
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5224
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5225
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5226
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5227
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5228
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5229
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5230
    "send the four-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5231
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5232
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5233
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5234
    static struct inlineCache ilc_0 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5235
    static struct inlineCache ilc_1 = __ILCPERF4(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5236
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5237
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5238
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5239
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5240
    if (InterruptPending == nil) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5241
	if (aSelector != last_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5242
	    if (aSelector != last_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5243
		if (flip) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5244
		    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5245
		    flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5246
		    last_0 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5247
		} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5248
		    pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5249
		    flip = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5250
		    last_1 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5251
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5252
		pIlc->ilc_func = __SEND4ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5253
		if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5254
		    __flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5255
		    pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5256
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5257
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5258
		pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5259
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5260
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5261
	    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5262
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5263
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5264
				     arg1, arg2, arg3, arg4) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5265
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5266
	static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5267
	RETURN (_SEND4(self, aSelector, nil, &ilc4,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5268
		       arg1, arg2, arg3, arg4));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5269
    }
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
    ^ 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
  5272
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5273
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5274
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5275
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
  5276
    "send the five-arg-message aSelector to the receiver"
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
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5279
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5280
    static struct inlineCache ilc_0 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5281
    static struct inlineCache ilc_1 = __ILCPERF5(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5282
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5283
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5284
    static flip = 0;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5285
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5286
    if (InterruptPending == nil) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5287
	if (aSelector != last_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5288
	    if (aSelector != last_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5289
		if (flip) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5290
		    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5291
		    flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5292
		    last_0 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5293
		} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5294
		    pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5295
		    flip = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5296
		    last_1 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5297
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5298
		pIlc->ilc_func = __SEND5ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5299
		if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5300
		    __flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5301
		    pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5302
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5303
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5304
		pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5305
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5306
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5307
	    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5308
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5309
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5310
				     arg1, arg2, arg3, arg4, arg5) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5311
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5312
	static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5313
	RETURN (_SEND5(self, aSelector, nil, &ilc5,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5314
		       arg1, arg2, arg3, arg4, arg5));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5315
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5316
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5317
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5318
						  with:arg5)
5755
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
!
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
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
  5323
    "send the six-arg-message aSelector to the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5324
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5325
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5326
    struct inlineCache *pIlc;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5327
    static struct inlineCache ilc_0 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5328
    static struct inlineCache ilc_1 = __ILCPERF6(@line);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5329
    static OBJ last_0 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5330
    static OBJ last_1 = nil;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5331
    static flip = 0;
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
    if (InterruptPending == nil) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5334
	if (aSelector != last_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5335
	    if (aSelector != last_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5336
		if (flip) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5337
		    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5338
		    flip = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5339
		    last_0 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5340
		} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5341
		    pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5342
		    flip = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5343
		    last_1 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5344
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5345
		pIlc->ilc_func = __SEND6ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5346
		if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5347
		    __flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5348
		    pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5349
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5350
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5351
		pIlc = &ilc_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5352
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5353
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5354
	    pIlc = &ilc_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5355
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5356
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5357
	RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5358
				     arg1, arg2, arg3, arg4, arg5, arg6) );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5359
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5360
	static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5361
	RETURN (_SEND6(self, aSelector, nil, &ilc6,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5362
		       arg1, arg2, arg3, arg4, arg5, arg6));
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5363
    }
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
    ^ self perform:aSelector withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5366
						  with:arg5 with:arg6)
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5367
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5368
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5369
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5370
perform:aSelector withArguments:argArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5371
    "send the message aSelector with all args taken from argArray 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5372
     to the receiver."
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
    |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
  5375
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5376
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5377
    REGISTER OBJ *argP;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5378
    int nargs;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5379
    OBJ l;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5380
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5381
    if (__isArray(argArray)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5382
	nargs = __arraySize(argArray);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5383
	argP = __arrayVal(argArray);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5384
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5385
	if (__isNonNilObject(argArray)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5386
	    static struct inlineCache ilcSize = __ILC0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5387
	    int i;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5388
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5389
	    numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5390
	    if (!__isSmallInteger(numberOfArgs)) 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5391
		goto bad;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5392
	    nargs = __intVal(numberOfArgs);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5393
	    argP = (OBJ *)(&a1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5394
	    for (i=1; i <= nargs; i++) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5395
		*argP++ = __AT_(argArray, __MKSMALLINT((INT)i));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5396
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5397
	    argP = (OBJ *)(&a1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5398
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5399
	    nargs = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5400
	}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5401
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5402
    switch (nargs) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5403
	case 0:
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5404
	    if (InterruptPending == nil) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5405
		static OBJ last0_0 = nil; static struct inlineCache ilc0_0 = __ILCPERF0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5406
		static OBJ last0_1 = nil; static struct inlineCache ilc0_1 = __ILCPERF0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5407
		static OBJ last0_2 = nil; static struct inlineCache ilc0_2 = __ILCPERF0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5408
		static OBJ last0_3 = nil; static struct inlineCache ilc0_3 = __ILCPERF0(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5409
		static int flip0 = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5410
		struct inlineCache *pIlc;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5411
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5412
		if (aSelector == last0_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5413
		    pIlc = &ilc0_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5414
		} else if (aSelector == last0_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5415
		    pIlc = &ilc0_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5416
		} else if (aSelector == last0_2) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5417
		    pIlc = &ilc0_2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5418
		} else if (aSelector == last0_3) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5419
		    pIlc = &ilc0_3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5420
		} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5421
		    if (flip0 == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5422
			pIlc = &ilc0_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5423
			flip0 = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5424
			last0_0 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5425
		    } else if (flip0 == 1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5426
			pIlc = &ilc0_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5427
			flip0 = 2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5428
			last0_1 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5429
		    } else if (flip0 == 2) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5430
			pIlc = &ilc0_2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5431
			flip0 = 3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5432
			last0_2 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5433
		    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5434
			pIlc = &ilc0_3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5435
			flip0 = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5436
			last0_3 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5437
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5438
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5439
		    pIlc->ilc_func = __SEND0ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5440
		    if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5441
			__flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5442
			pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5443
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5444
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5445
		RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5446
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5447
		static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5448
		RETURN (_SEND0(self, aSelector, nil, &ilc0));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5449
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5450
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5451
	case 1: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5452
	    if (InterruptPending == nil) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5453
		static OBJ last1_0 = nil; static struct inlineCache ilc1_0 = __ILCPERF1(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5454
		static OBJ last1_1 = nil; static struct inlineCache ilc1_1 = __ILCPERF1(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5455
		static OBJ last1_2 = nil; static struct inlineCache ilc1_2 = __ILCPERF1(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5456
		static OBJ last1_3 = nil; static struct inlineCache ilc1_3 = __ILCPERF1(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5457
		static int flip1 = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5458
		struct inlineCache *pIlc;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5459
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5460
		if (aSelector == last1_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5461
		    pIlc = &ilc1_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5462
		} else if (aSelector == last1_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5463
		    pIlc = &ilc1_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5464
		} else if (aSelector == last1_2) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5465
		    pIlc = &ilc1_2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5466
		} else if (aSelector == last1_3) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5467
		    pIlc = &ilc1_3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5468
		} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5469
		    if (flip1 == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5470
			pIlc = &ilc1_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5471
			flip1 = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5472
			last1_0 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5473
		    } else if (flip1 == 1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5474
			pIlc = &ilc1_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5475
			flip1 = 2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5476
			last1_1 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5477
		    } else if (flip1 == 2) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5478
			pIlc = &ilc1_2;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5479
			flip1 = 3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5480
			last1_2 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5481
		    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5482
			pIlc = &ilc1_3;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5483
			flip1 = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5484
			last1_3 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5485
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5486
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5487
		    pIlc->ilc_func = __SEND1ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5488
		    if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5489
			__flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5490
			pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5491
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5492
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5493
		RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5494
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5495
		static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5496
		RETURN (_SEND1(self, aSelector, nil, &ilc1, argP[0]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5497
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5498
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5499
	case 2: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5500
	    if (InterruptPending == nil) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5501
		static OBJ last2_0 = nil; static struct inlineCache ilc2_0 = __ILCPERF2(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5502
		static OBJ last2_1 = nil; static struct inlineCache ilc2_1 = __ILCPERF2(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5503
		static int flip2 = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5504
		struct inlineCache *pIlc;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5505
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5506
		if (aSelector == last2_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5507
		    pIlc = &ilc2_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5508
		} else if (aSelector == last2_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5509
		    pIlc = &ilc2_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5510
		} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5511
		    if (flip2 == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5512
			pIlc = &ilc2_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5513
			flip2 = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5514
			last2_0 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5515
		    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5516
			pIlc = &ilc2_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5517
			flip2 = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5518
			last2_1 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5519
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5520
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5521
		    pIlc->ilc_func = __SEND2ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5522
		    if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5523
			__flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5524
			pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5525
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5526
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5527
		RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5528
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5529
		static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5530
		RETURN (_SEND2(self, aSelector, nil, &ilc2, argP[0], argP[1]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5531
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5532
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5533
	case 3: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5534
	    if (InterruptPending == nil) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5535
		static OBJ last3_0 = nil; static struct inlineCache ilc3_0 = __ILCPERF3(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5536
		static OBJ last3_1 = nil; static struct inlineCache ilc3_1 = __ILCPERF3(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5537
		static int flip3 = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5538
		struct inlineCache *pIlc;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5539
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5540
		if (aSelector == last3_0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5541
		    pIlc = &ilc3_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5542
		} else if (aSelector == last3_1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5543
		    pIlc = &ilc3_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5544
		} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5545
		    if (flip3 == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5546
			pIlc = &ilc3_0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5547
			flip3 = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5548
			last3_0 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5549
		    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5550
			pIlc = &ilc3_1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5551
			flip3 = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5552
			last3_1 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5553
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5554
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5555
		    pIlc->ilc_func = __SEND3ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5556
		    if (pIlc->ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5557
			__flushPolyCache(pIlc->ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5558
			pIlc->ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5559
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5560
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5561
		RETURN ((*pIlc->ilc_func)(self, aSelector, nil, pIlc, argP[0], argP[1], argP[2]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5562
	    } else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5563
		static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5564
		RETURN (_SEND3(self, aSelector, nil, &ilc3, argP[0], argP[1], argP[2]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5565
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5566
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5567
	case 4: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5568
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5569
		static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5570
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5571
		if ((InterruptPending != nil) || (aSelector != last4)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5572
		    ilc4.ilc_func = __SEND4ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5573
		    if (ilc4.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5574
			__flushPolyCache(ilc4.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5575
			ilc4.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5576
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5577
		    last4 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5578
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5579
		RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5580
						argP[0], argP[1], argP[2], argP[3]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5581
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5582
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5583
	case 5: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5584
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5585
		static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5586
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5587
		if ((InterruptPending != nil) || (aSelector != last5)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5588
		    ilc5.ilc_func = __SEND5ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5589
		    if (ilc5.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5590
			__flushPolyCache(ilc5.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5591
			ilc5.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5592
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5593
		    last5 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5594
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5595
		RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5596
						argP[0], argP[1], argP[2], argP[3], argP[4]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5597
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5598
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5599
	case 6: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5600
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5601
		static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5602
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5603
		if ((InterruptPending != nil) || (aSelector != last6)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5604
		    ilc6.ilc_func = __SEND6ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5605
		    if (ilc6.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5606
			__flushPolyCache(ilc6.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5607
			ilc6.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5608
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5609
		    last6 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5610
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5611
		RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5612
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5613
						argP[5]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5614
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5615
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5616
	case 7: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5617
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5618
		static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5619
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5620
		if ((InterruptPending != nil) || (aSelector != last7)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5621
		    ilc7.ilc_func = __SEND7ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5622
		    if (ilc7.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5623
			__flushPolyCache(ilc7.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5624
			ilc7.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5625
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5626
		    last7 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5627
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5628
		RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5629
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5630
						argP[5], argP[6]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5631
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5632
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5633
	case 8:
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5634
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5635
		static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5636
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5637
		if ((InterruptPending != nil) || (aSelector != last8)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5638
		    ilc8.ilc_func = __SEND8ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5639
		    if (ilc8.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5640
			__flushPolyCache(ilc8.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5641
			ilc8.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5642
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5643
		    last8 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5644
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5645
		RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5646
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5647
						argP[5], argP[6], argP[7]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5648
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5649
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5650
	case 9: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5651
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5652
		static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5653
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5654
		if ((InterruptPending != nil) || (aSelector != last9)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5655
		    ilc9.ilc_func = __SEND9ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5656
		    if (ilc9.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5657
			__flushPolyCache(ilc9.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5658
			ilc9.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5659
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5660
		    last9 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5661
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5662
		RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5663
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5664
						argP[5], argP[6], argP[7], argP[8]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5665
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5666
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5667
	case 10: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5668
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5669
		static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5670
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5671
		if ((InterruptPending != nil) || (aSelector != last10)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5672
		    ilc10.ilc_func = __SEND10ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5673
		    if (ilc10.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5674
			__flushPolyCache(ilc10.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5675
			ilc10.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5676
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5677
		    last10 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5678
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5679
		RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5680
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5681
						argP[5], argP[6], argP[7], argP[8], argP[9]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5682
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5683
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5684
	case 11: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5685
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5686
		static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5687
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5688
		if ((InterruptPending != nil) || (aSelector != last11)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5689
		    ilc11.ilc_func = __SEND11ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5690
		    if (ilc11.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5691
			__flushPolyCache(ilc11.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5692
			ilc11.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5693
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5694
		    last11 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5695
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5696
		RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5697
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5698
						argP[5], argP[6], argP[7], argP[8], argP[9],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5699
						argP[10]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5700
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5701
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5702
	case 12: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5703
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5704
		static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5705
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5706
		if ((InterruptPending != nil) || (aSelector != last12)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5707
		    ilc12.ilc_func = __SEND12ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5708
		    if (ilc12.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5709
			__flushPolyCache(ilc12.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5710
			ilc12.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5711
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5712
		    last12 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5713
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5714
		RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5715
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5716
						argP[5], argP[6], argP[7], argP[8], argP[9],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5717
						argP[10], argP[11]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5718
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5719
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5720
	case 13: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5721
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5722
		static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5723
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5724
		if ((InterruptPending != nil) || (aSelector != last13)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5725
		    ilc13.ilc_func = __SEND13ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5726
		    if (ilc13.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5727
			__flushPolyCache(ilc13.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5728
			ilc13.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5729
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5730
		    last13 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5731
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5732
		RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5733
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5734
						argP[5], argP[6], argP[7], argP[8], argP[9],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5735
						argP[10], argP[11], argP[12]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5736
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5737
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5738
	case 14: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5739
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5740
		static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5741
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5742
		if ((InterruptPending != nil) || (aSelector != last14)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5743
		    ilc14.ilc_func = __SEND14ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5744
		    if (ilc14.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5745
			__flushPolyCache(ilc14.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5746
			ilc14.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5747
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5748
		    last14 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5749
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5750
		RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5751
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5752
						argP[5], argP[6], argP[7], argP[8], argP[9],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5753
						argP[10], argP[11], argP[12], argP[13]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5754
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5755
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5756
	case 15: 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5757
	    {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5758
		static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5759
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5760
		if ((InterruptPending != nil) || (aSelector != last15)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5761
		    ilc15.ilc_func = __SEND15ADDR__;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5762
		    if (ilc15.ilc_poly) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5763
			__flushPolyCache(ilc15.ilc_poly);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5764
			ilc15.ilc_poly = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5765
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5766
		    last15 = aSelector;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5767
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5768
		RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5769
						argP[0], argP[1], argP[2], argP[3], argP[4],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5770
						argP[5], argP[6], argP[7], argP[8], argP[9],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5771
						argP[10], argP[11], argP[12], argP[13],
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5772
						argP[14]));
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5773
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5774
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5775
bad:;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5776
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5777
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5778
    "/ arrive here, if bad number of arguments (too many)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5779
    "/ ST/X (currently) only allows up to 15 method arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5780
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5781
    ^ self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5782
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5783
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  5784
perform:aSelector withOptionalArgument:arg
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  5785
    "send aSelector-message to the receiver.
6318
3677d346113a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6316
diff changeset
  5786
     If the message expects an argument, pass arg."
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  5787
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  5788
    aSelector numArgs == 1 ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5789
	^ self perform:aSelector with:arg
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  5790
    ].
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  5791
    ^ self perform:aSelector
6319
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5792
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5793
    "
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5794
     |rec sel|
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5795
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5796
     rec := -1.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5797
     sel := #abs.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5798
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5799
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5800
     sel := #max:.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5801
     rec perform:sel withOptionalArgument:2.
75252ef51b38 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6318
diff changeset
  5802
    "
6316
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  5803
!
345f36d2fc65 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6263
diff changeset
  5804
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5805
perform:aSelector withOptionalArgument:optionalArg1 and:optionalArg2
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5806
    "send aSelector-message to the receiver.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5807
     If the message expects argument1, pass optionalArg1 and optionalArg2 as required."
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5808
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5809
    |numArgs|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5810
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5811
    numArgs := aSelector numArgs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5812
    numArgs == 0 ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5813
	^ self perform:aSelector
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5814
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5815
    numArgs == 1 ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5816
	^ self perform:aSelector with:optionalArg1
6321
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5817
    ].
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5818
    ^ self perform:aSelector with:optionalArg1 with:optionalArg2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5819
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5820
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5821
     |rec sel|
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5822
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5823
     rec := -1.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5824
     sel := #abs.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5825
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5826
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5827
     sel := #max:.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5828
     rec perform:sel withOptionalArgument:2.
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5829
    "
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5830
!
8af99331b6e8 #perform:withOptionalArgument:and:
Claus Gittinger <cg@exept.de>
parents: 6319
diff changeset
  5831
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5832
performMethod:aMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5833
    "invoke aMethod on the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5834
     The method should be a zero-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5835
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5836
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5837
     Warning:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5838
	 Take care for the method to be appropriate for the
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5839
	 receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5840
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5841
    ^ aMethod valueWithReceiver:self arguments:#()
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5842
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5843
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5844
     |mthd|
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
     mthd := SmallInteger compiledMethodAt:#negated.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5847
     Transcript showCR:(1 performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5848
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5849
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5850
    "BAD USE example:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5851
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5852
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5853
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5854
     mthd := Point compiledMethodAt:#x.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5855
     Transcript showCR:((1->2) performMethod:mthd)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5856
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5857
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5858
    "Modified: 31.7.1997 / 17:41:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5859
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5860
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5861
performMethod:aMethod arguments:argumentArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5862
    "invoke aMethod on the receiver, passing an argumentArray.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5863
     The size of the argumentArray should match the number of args
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5864
     expected by the method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5865
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5866
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5867
     Warning:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5868
	 Take care for the method to be appropriate for the
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5869
	 receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5870
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5871
    ^ aMethod valueWithReceiver:self arguments:argumentArray
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5874
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5875
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5876
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5877
     Transcript showCR:(1 performMethod:mthd arguments:#(2))
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5878
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5879
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5880
    "Created: 31.7.1997 / 17:46:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5881
!
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
performMethod:aMethod with:arg
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5884
    "invoke aMethod on the receiver, passing an argument.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5885
     The method should be a one-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5886
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5887
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5888
     Warning:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5889
	 Take care for the method to be appropriate for the
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5890
	 receiver - no checking is done by the VM."
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
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5893
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5894
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5895
     |mthd|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5896
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5897
     mthd := SmallInteger compiledMethodAt:#+.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5898
     Transcript showCR:(1 performMethod:mthd with:2)
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
    "Modified: 31.7.1997 / 17:42:32 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5904
performMethod:aMethod with:arg1 with:arg2
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5905
    "invoke aMethod on the receiver, passing two arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5906
     The method should be a two-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5907
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5908
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5909
     Warning:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5910
	 Take care for the method to be appropriate for the
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5911
	 receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5912
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5913
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2)
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5916
     |mthd arr|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5917
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5918
     arr := Array new:1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5919
     mthd := Array compiledMethodAt:#basicAt:put:.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5920
     arr performMethod:mthd with:1 with:'foo'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5921
     Transcript showCR:arr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5922
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5923
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5924
    "Modified: 31.7.1997 / 17:44:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5925
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5926
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5927
performMethod:aMethod with:arg1 with:arg2 with:arg3
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5928
    "invoke aMethod on the receiver, passing three arguments.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5929
     The method should be a three-argument method.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5930
     This is a non-object-oriented entry, applying a method
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5931
     in a functional way on a receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5932
     Warning:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5933
	 Take care for the method to be appropriate for the
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5934
	 receiver - no checking is done by the VM."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5935
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5936
    ^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2 with:arg3)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5937
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5938
    "Created: 31.7.1997 / 17:45:20 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5939
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5940
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5941
!Object methodsFor:'printing & storing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5942
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  5943
basicPrintOn:aStream
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  5944
    "append the receivers className with an articel to the argument, aStream"
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  5945
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  5946
    aStream nextPutAll:self classNameWithArticle
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  5947
!
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  5948
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5949
className
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5950
    "return the classname of the receivers class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5951
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5952
    ^ self class name
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5953
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5954
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5955
     1 className
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5956
     1 class className   'this may change ...'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5957
     $a className
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5958
     $a class className  'this may change ...'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5959
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5960
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5961
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5962
classNameWithArticle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5963
    "return a string consisting of classname preceeded by an article.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5964
     (dont expect me to write national variants for this ... :-)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5965
     If you have special preferences, redefine it ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5966
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5967
    |classname cls|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5968
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5969
    (cls := self class) == self ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5970
	^ 'a funny object'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5971
    ].
6418
0883a068e491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6405
diff changeset
  5972
    classname := cls name. "/ displayString.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5973
    ^ classname article , ' ' , classname
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5974
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5975
    "
6418
0883a068e491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6405
diff changeset
  5976
     1 classNameWithArticle   
0883a068e491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6405
diff changeset
  5977
     (1->2) classNameWithArticle    
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5978
     XWorkstation basicNew classNameWithArticle
6418
0883a068e491 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6405
diff changeset
  5979
     XWorkstation classNameWithArticle 
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5980
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5981
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5982
    "Modified: 13.5.1996 / 12:16:14 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5985
errorPrint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5986
    "print the receiver on the standard error stream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5987
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5988
    Stream streamErrorSignal catch:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  5989
	self printOn:Stderr
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5990
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5991
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5992
    "Modified: 7.3.1996 / 19:11:29 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5993
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5994
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5995
errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5996
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5997
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  5998
    "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
  5999
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6000
    Stream streamErrorSignal catch:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6001
	self printOn:Stderr.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6002
	Stderr cr
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6005
    "Modified: 7.3.1996 / 19:13:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6006
    "Created: 20.5.1996 / 10:20:41 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6007
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6008
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6009
errorPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6010
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6011
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6012
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6013
    "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
  6014
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6015
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6016
    ^ self errorPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6017
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6018
    "Modified: 20.5.1996 / 10:24:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6019
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6020
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6021
errorPrintNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6022
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6023
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6024
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6025
    "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
  6026
     Please use #errorPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6027
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6028
    self errorPrintCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6029
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6030
    "Modified: 20.5.1996 / 10:24:38 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6031
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6032
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6033
infoPrint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6034
    "{ Pragma: +optSpace }"
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
    "print the receiver on the standard error stream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6037
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6038
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6039
     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
  6040
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6041
    InfoPrinting == true ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6042
	self errorPrint
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6043
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6044
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6045
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6046
infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6047
    "{ Pragma: +optSpace }"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6048
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6049
    "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
  6050
     This is meant for information messages which are not warnings
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6051
     or fatal messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6052
     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
  6053
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6054
    InfoPrinting == true ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6055
	self errorPrintCR
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6056
    ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6057
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6058
    "Created: 20.5.1996 / 10:21:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6059
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6060
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6061
infoPrintNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6062
    "{ Pragma: +optSpace }"
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6063
    <resource:#obsolete>
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6064
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6065
    "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
  6066
     Please use #infoPrintCR - this method exists for backward compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6067
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6068
    ^ self infoPrintCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6069
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6070
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6071
print
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6072
    "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
  6073
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6074
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6075
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6076
    "/ (depends on string to respond to #print)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6077
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6078
    Stdout isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6079
	self printString print.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6080
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6081
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6082
    self printOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6083
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6084
    "Modified: 4.11.1996 / 23:36:58 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6085
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6086
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6087
printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6088
    "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
  6089
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6090
    "/ the following allows printCR to be used during
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6091
    "/ the early init-phase, when no Stdout has been set up.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6092
    "/ (depends on string to respond to #printCR)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6093
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6094
    Stdout isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6095
	self printString printCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6096
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6097
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6098
    self printOn:Stdout.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6099
    Stdout cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6100
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6101
    "Created: 20.5.1996 / 10:21:37 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6102
    "Modified: 4.11.1996 / 23:37:06 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6103
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6104
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6105
printNL
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6106
    "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
  6107
     This exists for GNU Smalltalk compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6108
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6109
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6110
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6111
    ^ self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6112
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6113
    "Modified: 20.5.1996 / 10:25:31 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6114
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6115
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6116
printNewline
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6117
    "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
  6118
     This exists for backward compatibility - please use #printCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6119
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6120
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6121
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6122
    self printCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6123
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6124
    "Modified: 20.5.1996 / 10:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6125
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6126
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6127
printOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6128
    "append a user printed representation of the receiver to aStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6129
     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
  6130
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6131
     The default here is to output the receivers class name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6132
     BUT: this method is heavily redefined for objects which
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6133
     can print prettier."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6134
6235
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6135
    self basicPrintOn:aStream.
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6136
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6137
   "
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6138
    (1@2) printOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6139
    (1@2) basicPrintOn:Transcript
8eacf62c458e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 6221
diff changeset
  6140
   "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6141
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6142
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6143
printOn:aStream leftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6144
    "print the receiver on aStream, padding with spaces up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6145
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6146
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6147
    self printOn:aStream leftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6148
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6149
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6150
     123 printOn:Transcript leftPaddedTo:10. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6151
     123 printOn:Transcript leftPaddedTo:2. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6152
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6153
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6154
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6155
printOn:aStream leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6156
    "print the receiver on aStream, padding with padCharacters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6157
     padding is done on the left."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6158
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6159
    aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6160
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6161
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6162
     123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6163
     123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6164
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6165
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6166
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6167
printOn:aStream paddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6168
    "print the receiver on aStream, padding with spaces up to size."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6169
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6170
    self printOn:aStream paddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6171
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6172
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6173
     123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6174
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6175
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6176
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6177
printOn:aStream paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6178
    "print the receiver on aStream, padding with padCharacter up to size"
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
    aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter).
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6183
     123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6184
     123 printOn:Transcript paddedTo:10 with:$. . Transcript cr
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6185
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6186
!
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
printOn:aStream zeroPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6189
    "print the receiver on aStream, padding with zeros up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6190
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6191
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6192
    self printOn:aStream paddedTo:size with:$0.
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6195
     123.0 printOn:Transcript zeroPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6196
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6197
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6198
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6199
printRightAdjustLen:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6200
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6201
     This method will go away ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6202
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6203
    (self printStringLeftPaddedTo:size) printOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6204
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6205
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6206
printString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6207
    "return a string for printing the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6208
     Since we now use printOn: as the basic print mechanism,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6209
     we have to create a stream and print into it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6210
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6211
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6212
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6213
    s := WriteStream on:(String new:30).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6214
    self printOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6215
    ^ s contents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6216
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6217
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6218
printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6219
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6220
     characters on the left are filled with spaces.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6221
     If the printString is longer than size, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6222
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6223
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6224
    ^ self printStringLeftPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6225
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6226
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6227
     10 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6228
     1 printStringLeftPaddedTo:10
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6229
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6230
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6231
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6232
printStringLeftPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6233
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6234
     characters on the left are filled with spaces.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6235
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6236
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6237
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6238
    ^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6239
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6240
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6241
     12   printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6242
     123  printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6243
     1234 printStringLeftPaddedTo:3 ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6244
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6245
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6246
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6247
printStringLeftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6248
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6249
     characters on the left are filled with padCharacter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6250
     If the printString is longer than size, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6251
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6252
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6253
    ^ (self printString) leftPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6254
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6255
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6256
     123 printStringLeftPaddedTo:10 with:$.   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6257
     1 printStringLeftPaddedTo:10 with:$.      
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6258
     (Float pi) printStringLeftPaddedTo:20 with:$*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6259
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6260
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6261
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6262
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6263
    "return my printString as a right-adjusted string of length size;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6264
     characters on the left are filled with padCharacter.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6265
     If the printString is larger than size,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6266
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6267
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6268
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6269
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6270
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6271
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6272
    ^ s leftPaddedTo:size with:padCharacter
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
     12   printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6276
     123  printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6277
     1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6278
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6279
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6280
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6281
printStringOnError:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6282
    "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
  6283
     evaluating exceptionBlock. Useful to print something in an exceptionHandler or other
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6284
     cleanup code."
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
    |rslt|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6287
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6288
    Error handle:[:ex |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6289
	rslt := exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6290
    ] do:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6291
	rslt := self printString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6292
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6293
    ^ rslt
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6294
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6295
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6296
printStringPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6297
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6298
     padded with spaces (at the right) up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6299
     If the printString is longer than size, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6300
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6301
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6302
    ^ self printStringPaddedTo:size with:(Character space)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6303
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6304
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6305
     123 printStringPaddedTo:10    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6306
     1234567890123456 printStringPaddedTo:10  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6307
     'hello' printStringPaddedTo:10   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6308
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6309
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6310
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6311
printStringPaddedTo:size ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6312
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6313
     padded with spaces (at the right) up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6314
     If the resulting printString is too large, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6315
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6316
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6317
    ^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6318
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6319
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6320
     12   printStringPaddedTo:3 ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6321
     123  printStringPaddedTo:3 ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6322
     1234 printStringPaddedTo:3 ifLarger:['***']   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6323
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6324
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6325
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6326
printStringPaddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6327
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6328
     padded with padCharacter (at the right) up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6329
     If the printString is longer than size, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6330
     it is returned unchanged (i.e. not truncated)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6331
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6332
    ^ (self printString) paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6333
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6334
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6335
     123  printStringPaddedTo:10 with:$.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6336
     123  printStringPaddedTo:10 with:$*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6337
     123  printStringPaddedTo:3 with:$*   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6338
     1234 printStringPaddedTo:3 with:$*   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6339
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6340
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6341
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6342
printStringPaddedTo:size with:padCharacter ifLarger:alternative
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6343
    "return a printed representation of the receiver,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6344
     padded with padCharacter (at the right) up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6345
     If the resulting printString is too large, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6346
     return the result from evaluating alternative."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6347
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6348
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6349
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6350
    s := self printString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6351
    s size > size ifTrue:[^ alternative value].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6352
    ^ s paddedTo:size with:padCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6353
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6354
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6355
     123   printStringPaddedTo:3 with:$. ifLarger:['***']
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6356
     12345 printStringPaddedTo:3 with:$. ifLarger:['***']
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6360
printStringRightAdjustLen:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6361
    "obsolete - just a name confusion.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6362
     This method will go away ..."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6363
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6364
    ^ self printStringLeftPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6365
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6366
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6367
printStringZeroPaddedTo:size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6368
    "return a printed representation of the receiver, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6369
     padded with zero (at the right) characters up to size.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6370
     Usually used with float numbers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6371
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6372
    ^ self printStringPaddedTo:size with:$0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6373
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6374
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6375
     123.0 printStringZeroPaddedTo:10 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6376
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6377
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6378
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6379
store
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6380
    "store the receiver on standard output.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6381
     this method is useless, but included for compatibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6382
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6383
    self storeOn:Stdout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6384
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6385
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6386
storeCR
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6387
    "store the receiver on standard output; append a carriage return."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6388
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6389
    self store.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6390
    Character cr print
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6391
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6392
    "Created: 20.5.1996 / 10:26:01 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6393
    "Modified: 20.5.1996 / 10:26:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6394
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6395
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6396
storeNl
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6397
    "store the receiver on standard output; append a newline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6398
     This method is included for backward compatibility-  use #storeCR."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6399
5893
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6400
    <resource:#obsolete>
f92054b38d3c Assign #obsolete resource to obsolete methods
Stefan Vogel <sv@exept.de>
parents: 5879
diff changeset
  6401
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6402
    self storeCR.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6403
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6404
    "Modified: 20.5.1996 / 10:26:49 / cg"
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
storeOn:aStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6408
    "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
  6409
     reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6410
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6411
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6412
     Use storeBinaryOn:, which handles these cases correctly."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6413
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6414
    |myClass hasSemi sz "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6415
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6416
    thisContext isRecursive ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6417
	Object recursiveStoreStringSignal raiseRequestWith:self.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6418
	('Object [error]: storeString of self referencing object.') errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6419
	aStream nextPutAll:'#("recursive")'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6420
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6421
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6422
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6423
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6424
    aStream nextPut:$(.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6425
    aStream nextPutAll:self class name.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6426
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6427
    hasSemi := false.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6428
    myClass isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6429
	aStream nextPutAll:' basicNew:'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6430
	self basicSize printOn:aStream
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6431
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6432
	aStream nextPutAll:' basicNew'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6433
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6434
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6435
    sz := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6436
    1 to:sz do:[:i | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6437
	aStream nextPutAll:' instVarAt:'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6438
	i printOn:aStream.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6439
	aStream nextPutAll:' put:'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6440
	(self instVarAt:i) storeOn:aStream.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6441
	aStream nextPut:$;.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6442
	hasSemi := true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6443
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6444
    myClass isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6445
	sz := self basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6446
	1 to:sz do:[:i | 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6447
	    aStream nextPutAll:' basicAt:'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6448
	    i printOn:aStream.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6449
	    aStream nextPutAll:' put:'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6450
	    (self basicAt:i) storeOn:aStream.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6451
	    aStream nextPut:$;.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6452
	    hasSemi := true
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6453
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6454
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6455
    hasSemi ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6456
	aStream nextPutAll:' yourself'
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6457
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6458
    aStream nextPut:$).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6459
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6460
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6461
     |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6462
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6463
     s := WriteStream on:(String new).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6464
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6465
     s := ReadStream on:(s contents).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6466
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6467
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6468
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6469
     |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6470
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6471
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6472
     ('hello' -> 'world') storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6473
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6474
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6475
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6476
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6477
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6478
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6479
    "does not work example:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6480
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6481
     |s a|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6482
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6483
     a := Array new:2.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6484
     a at:1 put:a.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6485
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6486
     s := 'data' asFilename writeStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6487
     a storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6488
     s close.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6489
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6490
     s := 'data' asFilename readStream.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6491
     (Object readFrom:s) inspect
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6492
    "
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
    "Modified: 28.1.1997 / 00:36:12 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6495
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6496
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6497
storeString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6498
    "return a string representing an expression to reconstruct the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6499
     Notice, that no self referencing or cyclic objects can be represented
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6500
     in this format.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6501
     Use storeBinaryOn:, which handles these cases correctly."
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
    |s|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6504
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6505
    s := WriteStream on:(String new:50).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6506
    self storeOn:s.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6507
    ^ s contents
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6508
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6509
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6510
!Object methodsFor:'private'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6511
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6512
isHierarchicalItem
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6513
    "used to decide if the parent is a hierarchical item
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6514
     or the model
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6515
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6516
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6517
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6518
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6519
!Object methodsFor:'queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6520
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6521
basicSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6522
    "return the number of the receivers indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6523
     0 if it has none.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6524
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6525
     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
  6526
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6527
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6528
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6529
    REGISTER int nbytes;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6530
    REGISTER OBJ myClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6531
    int nInstBytes;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6532
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6533
    /*
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6534
     * notice the missing test for self being a nonNilObject -
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6535
     * this can be done since basicSize is defined both in UndefinedObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6536
     * and SmallInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6537
     */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6538
    myClass = __qClass(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6539
    nbytes = __qSize(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6540
    nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) );
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
    switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6543
	case __MASKSMALLINT(POINTERARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6544
	case __MASKSMALLINT(WKPOINTERARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6545
	    nbytes -= nInstBytes;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6546
	    RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6547
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6548
	case __MASKSMALLINT(BYTEARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6549
	    nbytes -= nInstBytes;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6550
	    RETURN ( __MKSMALLINT(nbytes / sizeof(char)) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6551
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6552
	case __MASKSMALLINT(FLOATARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6553
	    nbytes -= nInstBytes;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6554
	    RETURN ( __MKSMALLINT(nbytes / sizeof(float)) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6555
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6556
	case __MASKSMALLINT(DOUBLEARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6557
#ifdef __NEED_DOUBLE_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6558
	    nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6559
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6560
	    nbytes -= nInstBytes;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6561
	    RETURN ( __MKSMALLINT(nbytes / sizeof(double)) );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6562
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6563
	case __MASKSMALLINT(WORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6564
	case __MASKSMALLINT(SWORDARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6565
	    nbytes -= nInstBytes;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6566
	    RETURN ( __MKSMALLINT(nbytes>>1) ); /* notice the hardcoded 2 here - not sizeof(short) */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6567
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6568
	case __MASKSMALLINT(LONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6569
	case __MASKSMALLINT(SLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6570
	    nbytes -= nInstBytes;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6571
	    RETURN ( __MKSMALLINT(nbytes>>2) ); /* notice the hardcoded 4 here - not sizeof(int) */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6572
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6573
	case __MASKSMALLINT(LONGLONGARRAY):
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6574
	case __MASKSMALLINT(SLONGLONGARRAY):
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6575
#ifdef __NEED_LONGLONG_ALIGN
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6576
	    nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6577
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6578
	    nbytes -= nInstBytes;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6579
	    RETURN ( __MKSMALLINT(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
  6580
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6581
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6582
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6583
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6584
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6585
byteSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6586
    "return the number of bytes in the receivers indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6587
     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
  6588
     instvars i.e. byteArrays, wordArrays etc.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6589
     Notice: for Strings the returned size may look strange.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6590
     Only useful with binary storage."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6591
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6592
    |myClass|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6593
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6594
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6595
    myClass isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6596
	myClass isPointers ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6597
	    myClass isBytes ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6598
		^ self basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6599
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6600
	    myClass isWords ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6601
		^ self basicSize * 2.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6602
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6603
	    myClass isSignedWords ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6604
		^ self basicSize * 2.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6605
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6606
	    myClass isLongs ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6607
		^ self basicSize * 4.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6608
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6609
	    myClass isSignedLongs ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6610
		^ self basicSize * 4.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6611
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6612
	    myClass isLongLongs ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6613
		^ self basicSize * 8.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6614
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6615
	    myClass isSignedLongLongs ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6616
		^ self basicSize * 8.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6617
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6618
	    myClass isFloats ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6619
		^ self basicSize * (ExternalBytes sizeofFloat)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6620
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6621
	    myClass isDoubles ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6622
		^ self basicSize * (ExternalBytes sizeofDouble)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6623
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6624
	    self halt:'oops'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6625
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6626
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6627
    ^ 0
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6628
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6629
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6630
     Point new byteSize   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6631
     'hello' byteSize     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6632
     (ByteArray with:1 with:2) byteSize 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6633
     (FloatArray with:1.5) byteSize    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6634
     (DoubleArray with:1.5) byteSize    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6635
     (WordArray with:1 with:2) byteSize    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6636
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6637
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6638
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6639
class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6640
    "return the receivers class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6641
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6642
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6643
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6644
    RETURN ( __Class(self) );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6645
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6646
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6647
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6648
respondsTo:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6649
    "return true, if the receiver implements a method with selector equal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6650
     to aSelector; i.e. if there is a method for aSelector in either the
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6651
     receivers class or one of its superclasses.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6652
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6653
     Notice, that this does not imply, that such a message can be sent without
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6654
     an error being raised. For example, an implementation could send
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6655
     #shouldNotImplement or #subclassResponsibility."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6656
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6657
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6658
     should we go via the cache, or search (by class) ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6659
     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
  6660
     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
  6661
     For now, use the cache ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6662
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6663
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6664
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6665
    if (__lookup(__Class(self), aSelector) == nil) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6666
	RETURN ( false );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6667
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6668
    RETURN ( true );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6669
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6670
.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6671
    ^ self class canUnderstand:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6672
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6673
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6674
    "'aString' respondsTo:#+"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6675
    "'aString' respondsTo:#,"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6676
    "'aString' respondsTo:#collect:"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6677
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6678
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6679
respondsToArithmetic
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6680
    "return true, if the receiver responds to arithmetic messages.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6681
     false is returned here - the method is redefined in ArithmeticValue."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6682
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6683
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6684
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6685
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6686
size
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6687
    "return the number of the receivers indexed instance variables;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6688
     this method may be redefined in subclasses"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6689
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6690
    ^ self basicSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6691
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6692
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6693
species
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6694
    "return a class which is similar to (or the same as) the receivers class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6695
     This is used to create an appropriate object when creating derived
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6696
     copies in the collection classes (sometimes redefined)."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6697
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6698
    ^ self class
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6699
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6700
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6701
yourself
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6702
    "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
  6703
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6704
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6705
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6706
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6707
!Object methodsFor:'secure message sending'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6708
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6709
askFor:aSelector
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6710
    "try to send the receiver the message, aSelector.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6711
     If it does not understand it, return false. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6712
     Otherwise the real value returned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6713
     Useful to send messages such as: #isColor to unknown
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6714
     receivers."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6715
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6716
    ^ self perform:aSelector ifNotUnderstood:[false]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6717
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6718
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6719
     1 askFor:#isColor     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6720
     Color red askFor:#isColor 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6722
     1 askFor:#isFoo     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6723
     Color red askFor:#isFoo 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6724
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6725
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6726
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6727
perform:aSelector ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6728
    "try to send message aSelector to the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6729
     If its understood, return the methods returned value,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6730
     otherwise return the value of the exceptionBlock"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6731
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6732
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6733
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  6734
    MessageNotUnderstood handle:[:ex |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6735
	"/ reject, if the bad message is not the one
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6736
	"/ we have sent originally
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6737
	ex parameter selector == aSelector ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6738
	    ex reject
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6739
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6740
    ] do:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6741
	val := self perform:aSelector.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6742
	ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6743
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6744
    ok isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6745
	^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6746
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6747
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6748
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6749
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6750
     1.2345 perform:#foo ifNotUnderstood:['sorry'] 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6751
     1.2345 perform:#sqrt ifNotUnderstood:['sorry'] 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6752
     12345 perform:#sqrt ifNotUnderstood:['sorry']  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6753
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6754
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6756
perform:aSelector with:argument ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6757
    "try to send message aSelector to the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6758
     If its understood, return the methods returned value,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6759
     otherwise return the value of the exceptionBlock"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6760
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6761
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6762
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6763
    MessageNotUnderstoodSignal handle:[:ex |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6764
	"/ reject, if the bad message is not the one
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6765
	"/ we have sent originally
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6766
	ex parameter selector == aSelector ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6767
	    ex reject
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6768
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6769
    ] do:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6770
	val := self perform:aSelector with:argument.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6771
	ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6772
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6773
    ok isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6774
	^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6775
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6776
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6777
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6778
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6779
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6780
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6781
     unknown := 1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6782
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6783
     unknown := 'high there'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6784
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6785
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6786
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6787
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6788
perform:aSelector with:arg1 with:arg2 ifNotUnderstood:exceptionBlock
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6789
    "try to send message aSelector to the receiver.
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6790
     If its understood, return the methods returned value,
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6791
     otherwise return the value of the exceptionBlock"
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6792
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6793
    |val ok|
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6794
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6795
    MessageNotUnderstoodSignal handle:[:ex |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6796
	"/ reject, if the bad message is not the one
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6797
	"/ we have sent originally
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6798
	ex parameter selector == aSelector ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6799
	    ex reject
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6800
	]
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6801
    ] do:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6802
	val := self perform:aSelector with:arg1 with:arg2.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6803
	ok := true.
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6804
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6805
    ok isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6806
	^ exceptionBlock value
5926
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6807
    ].
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6808
    ^ val
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6809
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6810
    "
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6811
     |unknown|
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6812
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6813
     unknown := 1.
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6814
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6815
     unknown := 'high there'.
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6816
     (unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline.
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6817
    "
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6818
!
e5ce56a2bd40 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5912
diff changeset
  6819
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6820
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6821
    "try to send message aSelector to the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6822
     If its understood, return the methods returned value,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6823
     otherwise return the value of the exceptionBlock"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6824
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6825
    |val ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6826
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6827
    MessageNotUnderstoodSignal handle:[:ex |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6828
	"/ reject, if the bad message is not the one
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6829
	"/ we have sent originally
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6830
	ex parameter selector == aSelector ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6831
	    ex reject
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6832
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6833
    ] do:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6834
	val := self perform:aSelector withArguments:argumentArray.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6835
	ok := true.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6836
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6837
    ok isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6838
	^ exceptionBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6839
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6840
    ^ val
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6841
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6842
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6843
     |unknown|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6844
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6845
     unknown := 1.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6846
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6847
     unknown := 'high there'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6848
     (unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6849
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6850
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6851
    "Modified: 27.3.1997 / 14:13:16 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6852
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6853
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6854
!Object methodsFor:'signal constants'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6855
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6856
messageNotUnderstoodSignal
6146
88b5066282b1 copyToLevcel: and copyTwoLevel
james
parents: 6086
diff changeset
  6857
    ^ MessageNotUnderstood
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6858
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6859
    "Created: 6.3.1997 / 15:46:52 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6860
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6861
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6862
!Object methodsFor:'special queries'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6863
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6864
allOwners
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6865
    "return a collection of all objects referencing the receiver"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6866
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6867
    ^ ObjectMemory whoReferences:self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6868
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6869
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6870
references:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6871
    "return true, if the receiver refers to the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6872
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6873
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  6874
    ^ self referencesObject:anObject
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6875
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6876
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6877
     |v|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6878
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6879
     v := View new initialize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6880
     v references:Display. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6881
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6882
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6883
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6884
referencesAny:aCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6885
    "return true, if the receiver refers to any object from 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6886
     the argument, aCollection.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6887
     - for debugging only"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6888
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6889
%{  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6890
    OBJ cls, flags;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6891
    int nInsts, inst;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6892
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6893
    if (! __isNonNilObject(self)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6894
	RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6895
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6896
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6897
    if (__isArray(aCollection)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6898
	int nObjs = __arraySize(aCollection);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6899
	char *minAddr = 0, *maxAddr = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6900
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6901
	if (nObjs == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6902
	    RETURN (false);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6903
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6904
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6905
	/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6906
	 * a little optimization: use the fact that all old objects
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6907
	 * refering to a new object are on the remSet; if I am not,
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6908
	 * a trivial reject is possible, if all objects are newbees.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6909
	 * as a side effect, gather min/max addresses
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6910
	 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6911
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6912
	    int allNewBees = 1;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6913
	    int i;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6914
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6915
	    minAddr = (char *)(__ArrayInstPtr(aCollection)->a_element[0]);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6916
	    maxAddr = minAddr;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6917
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6918
	    for (i=0; i<nObjs; i++) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6919
		OBJ anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6920
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6921
		anObject = __ArrayInstPtr(aCollection)->a_element[i];
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6922
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6923
		if (__isNonNilObject(anObject)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6924
		    int spc;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6925
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6926
		    if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6927
			allNewBees = 0;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6928
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6929
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6930
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6931
		if ((char *)anObject < minAddr) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6932
		    minAddr = (char *)anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6933
		} else if ((char *)anObject > maxAddr) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6934
		    maxAddr = (char *)anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6935
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6936
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6937
	    if (allNewBees) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6938
		RETURN (false);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6939
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6940
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6941
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6942
	/*
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6943
	 * fetch min/max in searchList (if not already done)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6944
	 */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6945
	if (minAddr == 0) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6946
	    int i;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6947
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6948
	    for (i=0; i<nObjs; i++) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6949
		OBJ anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6950
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6951
		anObject = __ArrayInstPtr(aCollection)->a_element[i];
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6952
		if ((char *)anObject < minAddr) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6953
		    minAddr = (char *)anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6954
		} else if ((char *)anObject > maxAddr) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6955
		    maxAddr = (char *)anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6956
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6957
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6958
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6959
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6960
	cls = __qClass(self);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6961
	if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6962
#if defined(memsrch4)
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6963
	    if (memsrch4(__arrayVal(aCollection), (INT)cls, nObjs)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6964
		RETURN (true);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6965
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6966
#else
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6967
	    int i;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6968
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6969
	    for (i=0; i<nObjs; i++) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6970
		OBJ anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6971
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6972
		anObject = __ArrayInstPtr(aCollection)->a_element[i];
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6973
		if (cls == anObject) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6974
		    RETURN (true);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6975
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6976
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6977
#endif /* memsrch4 */
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6978
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6979
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6980
	flags = __ClassInstPtr(cls)->c_flags;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6981
	if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6982
	    nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6983
	} else {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6984
	    nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6985
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6986
	if (! nInsts) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6987
	    RETURN (false);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6988
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6989
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6990
	if (nObjs == 1) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6991
	    /* better reverse the loop */
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6992
	    OBJ anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6993
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6994
	    anObject = __ArrayInstPtr(aCollection)->a_element[0];
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6995
#if defined(memsrch4)
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6996
	    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6997
		RETURN (true);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  6998
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  6999
#else
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7000
	    for (inst=0; inst<nInsts; inst++) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7001
		if ((__InstPtr(self)->i_instvars[inst]) == anObject) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7002
		    RETURN (true);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7003
		}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7004
	    }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7005
#endif
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7006
	    RETURN (false);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7007
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7008
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7009
	for (inst=0; inst<nInsts; inst++) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7010
	    OBJ instVar = __InstPtr(self)->i_instvars[inst];
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7011
	    int i;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7012
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7013
	    if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) {
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7014
#if defined(memsrch4)
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7015
		if (memsrch4(__arrayVal(aCollection), (INT)instVar, nObjs)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7016
		    RETURN (true);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7017
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7018
#else
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7019
		for (i=0; i<nObjs; i++) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7020
		    OBJ anObject;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7021
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7022
		    anObject = __ArrayInstPtr(aCollection)->a_element[i];
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7023
		    if (instVar == anObject) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7024
			RETURN (true);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7025
		    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7026
		}
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7027
#endif /* memsrch4 */
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7028
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7029
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7030
	RETURN (false);
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7031
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7032
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7033
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7034
    aCollection do:[:el |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7035
	(self references:el) ifTrue:[^ true].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7036
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7037
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7038
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7039
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7040
referencesDerivedInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7041
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7042
     the argument, aClass or its subclass. This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7043
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7044
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7045
    |myClass 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7046
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7047
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7048
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7049
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7050
    "check the class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7051
    (myClass isKindOf:aClass) ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7052
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7053
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7054
    numInst := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7055
    1 to:numInst do:[:i | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7056
	((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7057
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7058
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7059
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7060
    myClass isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7061
	myClass isPointers ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7062
	    "no need to search in non pointer fields"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7063
	    ((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7064
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7065
	numInst := self basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7066
	1 to:numInst do:[:i | 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7067
	    ((self basicAt:i) isKindOf:aClass) ifTrue:[^ true]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7068
	]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7069
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7070
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7071
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7072
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7073
     (1 @ 3.4) referencesDerivedInstanceOf:Number  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7074
     (1 @ 3.4) referencesDerivedInstanceOf:Array   
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7075
     View new initialize referencesDerivedInstanceOf:DeviceWorkstation  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7076
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7077
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7078
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7079
referencesInstanceOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7080
    "return true, if the receiver refers to an instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7081
     the argument, aClass.This method exists
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7082
     to support searching for users of a class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7083
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7084
    |myClass 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7085
     numInst "{ Class: SmallInteger }" |
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7086
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7087
    myClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7088
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7089
    "check the class"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7090
    (myClass isMemberOf:aClass) ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7091
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7092
    "check the instance variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7093
    numInst := myClass instSize.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7094
    1 to:numInst do:[:i | 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7095
	((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7096
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7097
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7098
    "check the indexed variables"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7099
    myClass isVariable ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7100
	myClass isPointers ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7101
	    "no need to search in non-pointer indexed fields"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7102
	    myClass isLongs ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7103
		(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7104
	    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7105
		myClass isFloatsOrDoubles ifTrue:[^ aClass == Float].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7106
		^ aClass == SmallInteger
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7107
	    ]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7108
	].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7109
	numInst := self basicSize.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7110
	1 to:numInst do:[:i | 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7111
	    ((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7112
	]
5755
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7115
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
     (1 @ 3.4) referencesInstanceOf:Float     
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7118
     (1 @ 3.4) referencesInstanceOf:Fraction    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7119
     View new initialize referencesInstanceOf:(Display class)  
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7120
    "
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7121
!
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7122
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7123
referencesObject:anObject
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7124
    "return true, if the receiver refers to the argument, anObject.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7125
     - for debugging only"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7126
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7127
%{  /* NOCONTEXT */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7128
    OBJ cls, flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7129
    int nInsts, i;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7130
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7131
    if (! __isNonNilObject(self)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7132
	RETURN (false);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7133
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7134
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7135
    /*
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7136
     * 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
  7137
     * 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
  7138
     * 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
  7139
     */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7140
    if (__isNonNilObject(anObject)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7141
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7142
	    int spc;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7143
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7144
	    if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7145
		RETURN (false);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7146
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7147
	}
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7148
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7149
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7150
    cls = __qClass(self);
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7151
    if (cls == anObject) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7152
	RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7153
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7154
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7155
    flags = __ClassInstPtr(cls)->c_flags;
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7156
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7157
	nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7158
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7159
	nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7160
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7161
    if (! nInsts) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7162
	RETURN (false);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7163
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7164
#if defined(memsrch4)
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7165
    if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7166
	RETURN (true);
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7167
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7168
#else
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7169
    for (i=0; i<nInsts; i++) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7170
	if (__InstPtr(self)->i_instvars[i] == anObject) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7171
	    RETURN (true);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7172
	}
6074
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7173
    }
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7174
#endif /* memsrch4 */
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7175
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7176
%}.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7177
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7178
"/    |myClass 
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7179
"/     numInst "{ Class: SmallInteger }" |
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7180
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7181
"/    myClass := self class.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7182
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7183
"/    "check the class"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7184
"/    (myClass == anObject) ifTrue:[^ true].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7185
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7186
"/    "check the instance variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7187
"/    numInst := myClass instSize.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7188
"/    1 to:numInst do:[:i | 
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7189
"/      ((self instVarAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7190
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7191
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7192
"/    "check the indexed variables"
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7193
"/    myClass isVariable ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7194
"/      myClass isPointers ifFalse:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7195
"/          "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7196
"/          "/ 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
  7197
"/          "/ 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
  7198
"/          "/ 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
  7199
"/          "/ 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
  7200
"/          "/ 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
  7201
"/          "/ 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
  7202
"/          "/ 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
  7203
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7204
"/          ^ false.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7205
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7206
"/          "/ alternative:
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7207
"/          "/  anObject isNumber ifFalse:[^ false].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7208
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7209
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7210
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7211
"/      "/ 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
  7212
"/      "/ idenitytIndex method, use it
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7213
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7214
"/      myClass == Array ifTrue:[
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7215
"/          ^ (self identityIndexOf:anObject) ~~ 0
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7216
"/      ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7217
"/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7218
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7219
"/      "/ otherwise, do it the slow way
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7220
"/      "/
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7221
"/      numInst := self basicSize.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7222
"/      1 to:numInst do:[:i | 
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7223
"/          ((self basicAt:i) == anObject) ifTrue:[^ true]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7224
"/      ]
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7225
"/    ].
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7226
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7227
    ^ false
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7228
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7229
    "
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7230
     |v|
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7231
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7232
     v := View new initialize.
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7233
     v references:Display. 
d91c99700e3b renamed #references: (conflict with RB's #references)
Claus Gittinger <cg@exept.de>
parents: 6069
diff changeset
  7234
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7235
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7236
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7237
!Object methodsFor:'synchronized evaluation'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7238
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7239
freeSynchronizationSemaphore    
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7240
    "free synchronizationSemaphore. May be used, to save memory when
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7241
     an object is no longer used synchronized."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7242
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7243
    |sema|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7244
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7245
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7246
    sema notNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7247
	sema wait.              "/ get lock
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7248
	self synchronizationSemaphore:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7249
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7250
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7251
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7252
     self synchronized:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7253
     self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7254
     self freeSynchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7255
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7256
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7257
    "Created: 28.1.1997 / 19:31:20 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7258
    "Modified: 28.1.1997 / 19:47:55 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7259
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7260
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7261
synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7262
    "return the synchronization semaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7263
     subclasses may redefine"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7264
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7265
    ^ SynchronizationSemaphores at:self ifAbsent:[].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7266
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7267
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7268
      self synchronizationSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7269
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7270
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7271
    "Modified: 28.1.1997 / 19:47:09 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7272
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7273
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7274
synchronizationSemaphore:aSemaphore
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7275
    "set the synchronisationSemaphore for myself.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7276
     subclasses may redefine this method"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7277
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7278
    aSemaphore isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7279
	"/ remove Semaphore
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7280
	SynchronizationSemaphores removeKey:self ifAbsent:nil.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7281
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7282
	SynchronizationSemaphores at:self put:aSemaphore.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7283
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7284
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7285
    "Modified: 28.1.1997 / 19:37:48 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7286
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7287
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7288
synchronized:aBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7289
    "evaluate aBlock synchronized, i.e. use a monitor for this object"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7290
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  7291
    |sema blocked gotSema retVal|
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7292
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7293
    blocked := OperatingSystem blockInterrupts.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7294
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7295
    "/ the following avoids creation of an additional
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7296
    "/ block in the common case
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7297
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7298
    sema := self synchronizationSemaphore.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7299
    sema isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7300
	"get a locked semaphore (with count = 0)"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7301
	sema := Semaphore new.  
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7302
	self synchronizationSemaphore:sema.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7303
	blocked ifFalse:[OperatingSystem unblockInterrupts].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7304
	^ aBlock ensure:[sema signal].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7305
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7306
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7307
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7308
     Poll sema (never waits).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7309
     Assuming that this is the common operation, this saves the creation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7310
     of some blocks.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7311
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7312
    (sema waitWithTimeout:0) notNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7313
	blocked ifFalse:[OperatingSystem unblockInterrupts].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7314
	^ aBlock ensure:[sema signal].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7315
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7316
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7317
    [
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7318
	gotSema := sema wait.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7319
	blocked ifFalse:[OperatingSystem unblockInterrupts].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7320
	retVal := aBlock value.
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  7321
    ] ensure:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7322
	gotSema notNil ifTrue:[gotSema signal]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7323
    ].
6421
58dca33cf0fc #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 6418
diff changeset
  7324
    ^ retVal.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7325
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7326
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7327
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7328
       [Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7329
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7330
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7331
    "Created: 28.1.1997 / 17:52:56 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7332
    "Modified: 30.1.1997 / 13:38:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7333
    "Modified: 20.2.1997 / 09:43:35 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7334
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7335
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7336
!Object methodsFor:'system primitives'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7337
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7338
asOop
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7339
    "ST-80 compatibility:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7340
     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
  7341
     or index); since ST/X has no such thing, and the objects address cannot
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7342
     be used (since its changing over time), we return the objects identityHash 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7343
     key, which provides (at least) some identity indication.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7344
     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
  7345
     key of two non-identical objects may be the same.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7346
     You'd better not use it - especially do not misuse it."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7347
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7348
    ^ self identityHash
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7349
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7350
    "Created: 9.11.1996 / 19:09:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7351
    "Modified: 9.11.1996 / 19:16:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7352
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7353
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7354
become:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7355
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7356
     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
  7357
     This can be a very dangerous operation - be warned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7358
     In general, using #become: should be avoided if possible, since it may 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7359
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7360
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7361
     This may also be an expensive (i.e. slow) operation, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7362
     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
  7363
     references to the two objects (although the primitive tries hard to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7364
     limit the search, for acceptable performance in most cases). 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7365
     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
  7366
     or nil, or is a context of a living method (i.e. one that has not already 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7367
     returned).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7368
     (notice that #become: is not used heavily by the system 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7369
      - the Collection-classes have been rewritten to not use it.)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7370
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7371
    if (__primBecome(self, anotherObject)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7372
	RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7373
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7374
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7375
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7376
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7377
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7378
becomeNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7379
    "make all references to the receiver become nil - effectively getting
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7380
     rid of the receiver. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7381
     This can be a very dangerous operation - be warned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7382
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7383
     This may be an expensive (i.e. slow) operation.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7384
     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
  7385
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7386
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7387
    if (__primBecomeNil(self)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7388
	RETURN ( nil );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7389
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7390
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7391
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7392
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7393
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7394
becomeSameAs:anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7395
    "make all references to the receiver become references to anotherObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7396
     but NOT vice versa (as done in #become:).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7397
     This can be a very dangerous operation - be warned.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7398
     In general, using #become: should be avoided if possible, since it may 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7399
     produce many strange effects (think of hashing in Sets, Dictionaries etc.).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7400
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7401
     This may also be an expensive (i.e. slow) operation,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7402
     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
  7403
     references to the two objects (although the primitive tries hard to
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7404
     limit the search, for acceptable performance in most cases).
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7405
     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
  7406
     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
  7407
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7408
    if (__primBecomeSameAs(self, anotherObject)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7409
	RETURN ( self );
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7410
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7411
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7412
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7413
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7414
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7415
changeClassTo:otherClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7416
    "changes the class of the receiver to the argument, otherClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7417
     This is only allowed (possible), if the receivers class and the argument
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7418
     have the same structure (i.e. number of named instance variables and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7419
     type of indexed instance variables). 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7420
     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
  7421
     is UndefinedObject or a Smallinteger, a primitive error is triggered."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7422
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7423
    |myClass ok|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7424
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7425
    "check for UndefinedObject/SmallInteger receiver or newClass"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7426
%{
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7427
    {
6533
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7428
        OBJ other = otherClass;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7429
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7430
        if (__isNonNilObject(self) 
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7431
         && __isNonNilObject(other)
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7432
         && (other != UndefinedObject)
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7433
         && (other != SmallInteger)) {
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7434
            ok = true;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7435
        } else {
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7436
            ok = false;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7437
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7438
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7439
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7440
    ok ifTrue:[
6533
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7441
        ok := false.
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7442
        myClass := self class.
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7443
        myClass flags == otherClass flags ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7444
            myClass instSize == otherClass instSize ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7445
                "same instance layout and types: its ok to do it"
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7446
                ok := true.
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7447
            ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7448
                myClass isPointers ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7449
                    myClass isVariable ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7450
                        ok := true
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7451
                    ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7452
                ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7453
            ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7454
        ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7455
            myClass isPointers ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7456
                "if newClass is a variable class, with instSize <= my instsize,
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7457
                 we can do it (effectively mapping additional instvars into the
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7458
                 variable part) - usefulness is questionable, though"
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7459
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7460
                otherClass isPointers ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7461
                    otherClass isVariable ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7462
                        otherClass instSize <= (myClass instSize + self basicSize) 
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7463
                        ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7464
                            ok := true
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7465
                        ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7466
                    ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7467
                        otherClass instSize == (myClass instSize + self basicSize) 
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7468
                        ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7469
                            ok := true
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7470
                        ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7471
                    ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7472
                ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7473
                    "it does not make sense to convert pointers to bytes ..."
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7474
                ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7475
            ] ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7476
                "does it make sense, to convert bits ?"
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7477
                "could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..."
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7478
                (myClass isBitsExtended and:[otherClass isBitsExtended]) ifTrue:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7479
                    ok := true
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7480
                ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7481
            ]
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7482
        ]
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7483
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7484
    ok ifTrue:[
6533
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7485
        "now, change the receivers class ..."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7486
%{
6533
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7487
        {
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7488
            OBJ me = self;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7489
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7490
            __qClass(me) = otherClass;
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7491
            __STORE(me, otherClass);
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7492
            RETURN (me);
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7493
        }
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7494
%}.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7495
    ].
6533
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7496
    otherClass isLoaded ifFalse:[
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7497
        ^ self changeClassTo:(otherClass autoload).
8396a7332890 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6517
diff changeset
  7498
    ].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7499
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7500
     the receiver cannot be represented as a instance of
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7501
     the desired class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7502
     For example, you cannot change a bitInstance (byteArray etc.) 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7503
     into a pointer object and vice versa.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7504
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7505
    self primitiveFailed
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7506
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7507
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7508
changeClassToThatOf:anObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7509
    "changes the class of the receiver to that of the argument, anObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7510
     This is only allowed (possible), if the receivers class and the arguments
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7511
     class have the same structure (i.e. number of named instance variables and 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7512
     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
  7513
     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
  7514
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7515
    self changeClassTo:(anObject class)
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7516
!
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7517
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7518
replaceReferencesTo:anObject with:newRef
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7519
    "if the receiver refers to the argument, anObject, replace this reference with newRef.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7520
     Return true, if any reference was changed.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7521
     Notice: this does not change the class-reference."
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7522
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7523
%{  /* NOCONTEXT */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7524
    OBJ cls, flags, anyChange;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7525
    int nInsts, i;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7526
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7527
    if (! __isNonNilObject(self)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7528
	RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7529
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7530
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7531
    /*
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7532
     * a little optimization: use the fact that all old objects
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7533
     * 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
  7534
     * a trivial reject is possible, if anObject is a newbee
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7535
     */
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7536
    if (__isNonNilObject(anObject)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7537
	if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7538
	    int spc;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7539
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7540
	    if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7541
		RETURN (false);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7542
	    }
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7543
	}
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7544
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7545
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7546
    cls = __qClass(self);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7547
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7548
    flags = __ClassInstPtr(cls)->c_flags;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7549
    if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7550
	nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7551
    } else {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7552
	nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7553
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7554
    if (! nInsts) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7555
	RETURN (false);
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7556
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7557
    anyChange = false;
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7558
    for (i=0; i<nInsts; i++) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7559
	if (__InstPtr(self)->i_instvars[i] == anObject) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7560
	    __InstPtr(self)->i_instvars[i] = newRef;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7561
	    __STORE(self, newRef);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7562
	    anyChange = true;
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7563
	}
6033
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7564
    }
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7565
    RETURN (anyChange);
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7566
%}.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7567
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7568
    "
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7569
     |v|
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7570
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7571
     v := Array with:1234 with:'hello' with:Array.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7572
     v replaceReferencesTo:Array with:ByteArray.
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7573
     v inspect
be1b7877b425 + #replaceReferencesTo:with:
Claus Gittinger <cg@exept.de>
parents: 6005
diff changeset
  7574
    "
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7575
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7576
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7577
!Object methodsFor:'testing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7578
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7579
? defaultValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7580
     "a syntactic shugar-piece:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7581
      if the receiver is nil, return the defaultValue;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7582
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7583
      This method is only redefined in UndefinedObject - therefore,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7584
      the recevier is retuned here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7585
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7586
      Thus, if foo and bar are simple variables or constants,
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7587
	  foo ? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7588
      is the same as:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7589
	  (foo isNil ifTrue:[bar] ifFalse:[foo])
5755
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
      if they are message sends, the equivalent code is:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7592
	  [
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7593
	      |t1 t2|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7594
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7595
	      t1 := foo.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7596
	      t2 := bar.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7597
	      t1 isNil ifTrue:[t2] ifFalse:[t1]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7598
	  ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7599
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7600
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7601
      as in:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7602
	  foo := arg ? #defaultValue
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7603
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7604
      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
  7605
      Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7606
	 This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7607
	 - redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7608
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7609
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7610
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7611
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7612
     1 ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7613
     nil ? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7614
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7615
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7616
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7617
    "Modified: / 19.5.1998 / 17:39:56 / cg"
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
?? defaultValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7621
     "a syntactic shugar-piece:
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7622
      much like ?, but sends #value to the argument if required.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7623
      (i.e. its the same as #ifNil:)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7624
      If the receiver is nil, return the defaultValues value;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7625
      otherwise, return the receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7626
      This method is only redefined in UndefinedObject - therefore,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7627
      the recevier is retuned here.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7628
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7629
      Thus, if foo and bar are simple variables or constants,
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7630
	  foo ?? bar
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7631
      is the same as:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7632
	  (foo isNil ifTrue:[bar value] ifFalse:[foo])
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7633
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7634
      if they are message sends, the equivalent code is:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7635
	  [
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7636
	      |t t2|
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7637
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7638
	      t := foo.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7639
	      t isNil ifTrue:[bar value] ifFalse:[t]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7640
	  ] value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7641
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7642
      Can be used to provide defaultValues to variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7643
      as in:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7644
	  foo := arg ?? [ self computeDefault ]
5755
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
      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
  7647
     "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7648
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7649
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7650
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7651
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7652
     1 ?? #default 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7653
     nil ?? #default
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7654
     1 ?? [ self halt. 1 + 2 ] 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7655
     nil ?? [ self halt. 1 + 2 ] 
6069
9aff12a37f5e comment
Claus Gittinger <cg@exept.de>
parents: 6068
diff changeset
  7656
     1 ?? [Date today]   
9aff12a37f5e comment
Claus Gittinger <cg@exept.de>
parents: 6068
diff changeset
  7657
     nil ?? [Date today]  
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7658
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7659
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7660
    "Created: / 4.11.1996 / 20:36:19 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7661
    "Modified: / 19.5.1998 / 17:42:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7662
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7663
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7664
ifNil:aBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7665
    "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
  7666
     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
  7667
     receiver.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7668
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7669
	This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7670
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7671
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7672
    ^ self
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7673
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7674
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7675
ifNil:nilBlockOrValue ifNotNil:notNilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7676
    "return the value of the first arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7677
     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
  7678
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7679
	This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7680
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7681
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7682
    ^ notNilBlockOrValue value
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7685
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7686
ifNotNil:aBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7687
    "return myself if nil, or the result from evaluating the argument, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7688
     if I am not nil.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7689
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7690
	This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7691
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7692
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7693
    ^ aBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7694
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7697
ifNotNil:notNilBlockOrValue ifNil:nilBlockOrValue
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7698
    "return the value of the 2nd arg, if I am nil,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7699
     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
  7700
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7701
	This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7702
	- redefining it may not work as expected."
5755
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
    ^ notNilBlockOrValue value
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7705
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7706
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7707
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7708
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7709
isArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7710
    "return true, if the receiver is some kind of array (or weakArray etc);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7711
     false is returned here - the method is only redefined in Array."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7712
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7713
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7714
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7715
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7716
isAssociation
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7717
    "return true, if the receiver is some kind of association;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7718
     false is returned here - the method is only redefined in Association."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7719
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7720
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7721
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7722
    "Created: 14.5.1996 / 17:03:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7723
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7724
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7725
isBehavior
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7726
    "return true, if the receiver is some kind of class (i.e. behavior);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7727
     false is returned here - the method is only redefined in Behavior."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7728
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7729
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7730
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7731
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7732
isBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7733
    "return true, if the receiver is some kind of block;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7734
     false returned here - the method is only redefined in Block."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7735
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7736
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7737
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7738
5824
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  7739
isBoolean
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  7740
    "return true, if the receiver is a boolean;
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  7741
     false is returned here - the method is only redefined in Boolean."
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  7742
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  7743
    ^ false
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  7744
!
fdf9cd50a141 Added method isBoolean; need this!
martin
parents: 5821
diff changeset
  7745
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7746
isByteArray
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7747
    "return true, if the receiver is some kind of bytearray;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7748
     false is returned here - the method is only redefined in ByteArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7749
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7750
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7751
!
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
isCharacter
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7754
    "return true, if the receiver is some kind of character;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7755
     false is returned here - the method is only redefined in Character."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7756
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7757
    ^ false
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7760
isClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7761
    "return true, if the receiver is some kind of class (real class, 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7762
     not just behavior);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7763
     false is returned here - the method is only redefined in Class."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7764
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7765
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7766
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7767
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7768
isCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7769
    "return true, if the receiver is some kind of collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7770
     false is returned here - the method is only redefined in Collection."
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
    ^ false
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
isColor
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7776
    "return true, if the receiver is some kind of color;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7777
     false is returned here - the method is only redefined in Color."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7778
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7779
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7780
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7781
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7782
isContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7783
    "return true, if the receiver is some kind of context;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7784
     false returned here - the method is only redefined in Context."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7785
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7786
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7787
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7788
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  7789
isEmptyOrNil
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  7790
    "Squeak compatibility:
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  7791
     return true if I am nil or an empty collection - return false here.
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  7792
     Sigh: the same as ST/X isNilOrEmptyCollection - which one should be kept in the long run ?"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  7793
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  7794
    ^ false
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  7795
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  7796
    "Created: / 13.11.2001 / 13:17:04 / cg"
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  7797
    "Modified: / 13.11.2001 / 13:28:40 / cg"
6181
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  7798
!
5876cc789e41 + isEmptyOrNil
Claus Gittinger <cg@exept.de>
parents: 6175
diff changeset
  7799
6221
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  7800
isException
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  7801
    ^ false
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  7802
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  7803
    "Created: / 17.11.2001 / 18:37:44 / cg"
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  7804
!
404495587300 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6203
diff changeset
  7805
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7806
isExternalStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7807
    "return true, if the receiver is some kind of externalStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7808
     false is returned here - the method is only redefined in ExternalStream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7809
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7810
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7811
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7812
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7813
isFileStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7814
    "return true, if the receiver is some kind of fileStream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7815
     false is returned here - the method is only redefined in FileStream."
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
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7818
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7819
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7820
isFilename
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7821
    "return true, if the receiver is some kind of filename;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7822
     false is returned here - the method is only redefined in Filename."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7823
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7824
    ^false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7825
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7826
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7827
isFixedPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7828
    "return true, if the receiver is some kind of fixedPoint number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7829
     false is returned here - the method is only redefined in FixedPoint."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7830
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7831
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7832
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7833
    "Created: 5.11.1996 / 19:23:04 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7834
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7835
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7836
isFixedSize
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7837
    "return true if the receiver cannot grow easily 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7838
     (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
  7839
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7840
    ^ true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7841
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7842
6185
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7843
isFloat
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7844
    "return true, if the receiver is some kind of floating point number;
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7845
     false is returned here.
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7846
     Same as #isLimitedPrecisionReal, but a better name ;-)"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7847
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7848
    ^ false
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7849
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7850
    "Modified: / 14.11.2001 / 14:57:46 / cg"
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7851
!
2029fdbadfde +isFloat
Claus Gittinger <cg@exept.de>
parents: 6182
diff changeset
  7852
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7853
isForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7854
    "return true, if the receiver is some kind of form;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7855
     false is returned here - the method is only redefined in Form."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7856
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7857
    ^ false
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7860
isFraction
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7861
    "return true, if the receiver is some kind of fraction;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7862
     false is returned here - the method is only redefined in Fraction."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7865
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7866
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7867
isImage
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7868
    "return true, if the receiver is some kind of image;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7869
     false is returned here - the method is only redefined in Image."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7872
!
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
isImageOrForm
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7875
    "return true, if the receiver is some kind of image or form;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7876
     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
  7877
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7878
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7879
!
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
isImmediate
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7882
    "return true if I am an immediate object
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7883
     i.e. I am represented in the pointer itself and
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7884
     no real object header/storage is used me.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7885
     (currently, only SmallIntegers, some characters and nil return true)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7886
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7887
    ^ self class hasImmediateInstances
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
    "Created: 3.6.1997 / 12:00:18 / cg"
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
isInteger
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7893
    "return true, if the receiver is some kind of integer number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7894
     false is returned here - the method is only redefined in Integer."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7897
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7898
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7899
isJavaClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7900
    "return true, if this is a javaClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7901
     false is returned here - the method is only redefined in JavaClass."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7904
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7905
    "Created: / 26.3.1997 / 13:34:54 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7906
    "Modified: / 8.5.1998 / 21:25:21 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7909
isJavaClassRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7910
    "return true, if this is a JavaClassRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7911
     false is returned here - the method is only redefined in JavaClassRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7912
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7913
    ^ false
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
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7916
    "Created: / 24.12.1999 / 01:46:28 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7917
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7918
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7919
isJavaContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7920
    "return true, if this is a javaContext.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7921
     false is returned here - the method is only redefined in JavaContext."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7922
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7923
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7924
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7925
    "Created: / 8.5.1998 / 21:24:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7926
    "Modified: / 8.5.1998 / 21:25:35 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7927
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7928
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7929
isJavaMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7930
    "return true, if this is a JavaMethod.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7931
     false is returned here - the method is only redefined in JavaMethod."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7932
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7933
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7934
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7935
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7936
    "Created: / 25.9.1999 / 23:26:12 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7937
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7938
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7939
isJavaMethodRef
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7940
    "return true, if this is a JavaMethodRef.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7941
     false is returned here - the method is only redefined in JavaMethodRef."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7942
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7943
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7944
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7945
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7946
    "Created: / 23.12.1999 / 19:44:51 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7949
isJavaObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7950
    "return true, if this is a javaObject.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7951
     false is returned here - the method is only redefined in JavaObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7952
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7953
    ^ false
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
    "Created: / 26.3.1997 / 13:34:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7956
    "Modified: / 8.5.1998 / 21:25:46 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7957
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7958
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7959
isJavaScriptClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7960
    "return true, if this is a javaScriptClass.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7961
     false is returned here - the method is only redefined in JavaScriptClass."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7962
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7963
    ^ false
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7966
isKindOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7967
    "return true, if the receiver is an instance of aClass or one of its
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7968
     subclasses, false otherwise.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7969
     Advice: 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7970
	use of this to check objects for certain attributes/protocoll should
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7971
	be avoided; it limits the reusability of your classes by limiting use
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7972
	to instances of certain classes and fences you into a specific inheritance 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7973
	hierarchy.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7974
	Use check-methods to check an object for a certain attributes/protocol
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7975
	(such as #isXXXX, #respondsTo: or #isNumber).
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7976
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7977
	Using #isKindOf: is considered BAD STYLE.
5755
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
     Advice2:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7980
	Be aware, that using an #isXXX method is usually much faster than 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7981
	using #isKindOf:; because isKindOf: has to walk up all the superclass 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7982
	hierarchy, comparing every class on the way. 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7983
	Due to caching in the VM, a call to #isXXX is normally reached via
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7984
	a single function call.
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7987
%{  /* NOCONTEXT */
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7988
    register OBJ thisClass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7989
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7990
    thisClass = __Class(self);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7991
    while (thisClass != nil) {
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7992
	if (thisClass == aClass) {
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7993
	    RETURN ( true );
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7994
	}
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  7995
	thisClass = __ClassInstPtr(thisClass)->c_superclass;
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7996
    }
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7997
    RETURN ( false );
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7998
%}
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  7999
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8000
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8001
"/  the above code is equivalent to:
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
"/  thisClass := self class.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8004
"/  [thisClass notNil] whileTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8005
"/      thisClass == aClass ifTrue:[^ true].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8006
"/      thisClass := thisClass superclass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8007
"/  ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8008
"/  ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8009
"/
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8010
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8011
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8012
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8013
isLayout
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8014
    "return true, if the receiver is some kind of layout;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8015
     false is returned here - the method is only redefined in Layout."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8016
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8017
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8018
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8019
6086
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8020
isLimitedPrecisionReal
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8021
    "return true, if the receiver is some kind of floating point number;
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8022
     false is returned here - the method is only redefined in LimitedPrecisionReal."
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8023
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8024
    ^ false
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8025
!
0bd476397581 added isLimitedPrecisionReal
Claus Gittinger <cg@exept.de>
parents: 6074
diff changeset
  8026
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8027
isList
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8028
    "return true, if the receiver is some kind of list collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8029
     false is returned here - the method is only redefined in List."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8030
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8031
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8032
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8033
    "Created: / 11.2.2000 / 01:37:05 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8036
isLiteral
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8037
    "return true, if the receiver can be represented as a literal constant in ST syntax;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8038
     false is returned here - the method is redefined in some classes."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8039
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8040
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8041
!
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
isMemberOf:aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8044
    "return true, if the receiver is an instance of aClass, false otherwise.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8045
     Advice: 
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8046
	use of this to check objects for certain attributes/protocoll should
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8047
	be avoided; it limits the reusability of your classes by limiting use
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8048
	to instances of a certain class.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8049
	Use check-methods to check an object for a certain attributes/protocol
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8050
	(such as #isXXX, #respondsTo: or #isNumber);
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8051
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8052
	Using #isMemberOf: is considered BAD STYLE.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8053
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8054
	This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8055
	- redefining it may not work as expected."
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8056
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8057
    ^ (self class) == aClass
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8058
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8059
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8060
isMeta
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8061
    "return true, if the receiver is some kind of metaclass;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8062
     false is returned here - the method is only redefined in Metaclass."
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
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8065
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8066
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8067
isMethod
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8068
    "return true, if the receiver is some kind of method;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8069
     false returned here - the method is only redefined in Method."
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
    ^ false
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
isMorph
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8075
    "return true, if the receiver is some kind of morph;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8076
     false is returned here - the method is only redefined in Morph."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8077
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8078
    ^ false
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
isNameSpace
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8082
    "return true, if this is a nameSpace.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8083
     false is returned here - the method is only redefined in Namespace."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8084
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8085
    ^ false
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
    "Created: / 11.10.1996 / 18:08:56 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8088
    "Modified: / 8.5.1998 / 21:26:05 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8089
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8090
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8091
isNamespace
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8092
    "return true, if this is a nameSpace.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8093
     false is returned here - the method is only redefined in Namespace."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8094
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8095
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8096
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8097
    self obsoleteMethodWarning:'use #isNameSpace'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8098
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8099
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8100
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8101
isNil
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8102
    "return true, if the receiver is nil.
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8103
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8104
	This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8105
	- redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8106
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8107
    ^ false
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8108
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8109
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8110
isNilOrEmptyCollection
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8111
    "return true if I am nil or an empty collection - false here.
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8112
     Sigh: the same as Squeaks isEmptyOrNil - which one should be kept in the long run ?"
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8113
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8114
    ^ false
6182
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8115
2b992cf865bc comment
Claus Gittinger <cg@exept.de>
parents: 6181
diff changeset
  8116
    "Modified: / 13.11.2001 / 13:28:06 / cg"
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8117
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8118
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8119
isNumber
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8120
    "return true, if the receiver is some kind of number;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8121
     false is returned here - the method is only redefined in Number."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8122
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8123
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8124
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8125
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8126
isOrderedCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8127
    "return true, if the receiver is some kind of ordered collection (or list etc);
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8128
     false is returned here - the method is only redefined in OrderedCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8129
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8130
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8131
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8132
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8133
isPoint
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8134
    "return true, if the receiver is some kind of point;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8135
     false is returned here - the method is only redefined in Point."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8136
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8137
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8138
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8139
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8140
isRectangle
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8141
    "return true, if the receiver is some kind of rectangle;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8142
     false is returned here - the method is only redefined in Rectangle."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8143
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8144
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8145
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8146
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8147
isRemoteObject
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8148
    "return true, if the receiver is some kind of remoteObject,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8149
     false if its local - the method is only redefined in RemoteObject."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8150
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8151
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8152
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8153
    "Created: 28.10.1996 / 15:18:45 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8154
    "Modified: 28.10.1996 / 15:20:57 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8155
!
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
isSequenceable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8158
    "return true, if the receiver is some kind of sequenceable collection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8159
     false is returned here - the method is only redefined in SequenceableCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8160
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8161
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8162
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8163
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8164
isSequenceableCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8165
    "OBSOLETE: use isSequenceable for ST-80 compatibility.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8166
     This method is a historic leftover and will be removed soon ...
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8167
     (although its name is much better than #isSequenceable - sigh)"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8168
5869
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8169
    <resource:#obsolete>
362be80efcb9 Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 5856
diff changeset
  8170
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8171
    self obsoleteMethodWarning:'use #isSequenceable'.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8172
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8173
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8174
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8175
isSignal
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8176
    "return true, if the receiver is some kind of signal;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8177
     false returned here - the method is only redefined in Signal."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8178
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8179
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8180
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8181
6517
c249c09b841b isSignalOrSignalSet
Claus Gittinger <cg@exept.de>
parents: 6496
diff changeset
  8182
isSignalOrSignalSet
c249c09b841b isSignalOrSignalSet
Claus Gittinger <cg@exept.de>
parents: 6496
diff changeset
  8183
    "return true, if the receiver is either some kind of signal or a signalSet;
c249c09b841b isSignalOrSignalSet
Claus Gittinger <cg@exept.de>
parents: 6496
diff changeset
  8184
     false returned here - the method is only redefined in Signal and SignalSet."
c249c09b841b isSignalOrSignalSet
Claus Gittinger <cg@exept.de>
parents: 6496
diff changeset
  8185
c249c09b841b isSignalOrSignalSet
Claus Gittinger <cg@exept.de>
parents: 6496
diff changeset
  8186
    ^ false
c249c09b841b isSignalOrSignalSet
Claus Gittinger <cg@exept.de>
parents: 6496
diff changeset
  8187
!
c249c09b841b isSignalOrSignalSet
Claus Gittinger <cg@exept.de>
parents: 6496
diff changeset
  8188
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8189
isStream
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8190
    "return true, if the receiver is some kind of stream;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8191
     false is returned here - the method is only redefined in Stream."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8192
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8193
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8194
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8195
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8196
isString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8197
    "return true, if the receiver is some kind of string;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8198
     false is returned here - the method is only redefined in CharacterArray."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8199
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8200
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8201
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8202
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8203
isStringCollection
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8204
    "return true, if the receiver is some kind of stringCollection;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8205
     false is returned here - the method is only redefined in StringCollection."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8206
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8207
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8208
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8209
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8210
isSymbol
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8211
    "return true, if the receiver is some kind of symbol;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8212
     false is returned here - the method is only redefined in Symbol."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8213
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8214
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8215
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8216
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8217
isText
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8218
    "return true, if the receiver is some kind of text object;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8219
     false is returned here - the method is only redefined in Text."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8220
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8221
    ^ false
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8222
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8223
    "Created: 12.5.1996 / 10:56:50 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8224
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8225
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8226
isValueModel
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8227
    "return true, if the receiver is some kind of valueModel;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8228
     false is returned here - the method is only redefined in ValueModel."
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
    ^ false
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
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8233
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8234
isVariable
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8235
    "return true if the receiver has indexed instance variables,
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8236
     false otherwise."
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
    ^ self class isVariable
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8241
isVariableBinding
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8242
    "return true, if this is a binding for a variable.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8243
     false is returned here - the method is only redefined in Binding."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8244
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8245
    ^ false
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
    "Created: / 19.6.1997 / 17:38:44 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8248
    "Modified: / 8.5.1998 / 21:26:55 / cg"
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8251
isView
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8252
    "return true, if the receiver is some kind of view;
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8253
     false is returned here - the method is only redefined in View."
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
    ^ false
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8256
!
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8257
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8258
notNil
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8259
    "return true, if the receiver is not nil.
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8260
     Notice:
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8261
	This method is open coded (inlined) by the compiler(s)
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8262
	- redefining it may not work as expected."
6068
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8263
1d5ca1175f3f added #isNilOrEmptyCollection
Claus Gittinger <cg@exept.de>
parents: 6033
diff changeset
  8264
    ^ true
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
!Object methodsFor:'tracing'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8268
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8269
traceInto:aRequestor level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8270
    "double dispatch into tracer, passing my type implicitely in the selector"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8271
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8272
    ^ aRequestor traceObject:self level:level from:referrer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8273
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8274
    "Created: / 2.9.1999 / 09:05:17 / stefan"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8275
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8276
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8277
!Object methodsFor:'user interaction & notifications'!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8278
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8279
activityNotification:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8280
    "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
  8281
     some long-time activity.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8282
     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
  8283
     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
  8284
     and proceed. If there is no handler, this is simply ignored.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8285
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8286
     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
  8287
     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
  8288
     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
  8289
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8290
    ActivityNotificationSignal isHandled ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8291
	^ ActivityNotificationSignal raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8292
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8293
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8294
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8295
     nil activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8296
     self activityNotification:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8297
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8298
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8299
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8300
     ActivityNotificationSignal handle:[:ex |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8301
	ex errorString printNL.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8302
	ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8303
     ] do:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8304
	'hello' printNL.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8305
	self activityNotification:'doing some long time computation'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8306
	'world' printNL.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8307
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8308
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8309
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8310
    "Modified: 16.12.1995 / 18:23:42 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8311
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8312
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8313
confirm:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8314
    "launch a confirmer, which allows user to enter yes or no.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8315
     return true for yes, false for no.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8316
     If no GUI is present (headless applications), true is returned."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8317
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8318
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8319
     on systems without GUI, or during startup, output a message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8320
     and return true (as if yes was answered)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8321
     Q: should we ask user by reading Stdin ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8322
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8323
    Smalltalk isInitialized ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8324
	'*** confirmation requested during initialization:' errorPrintCR. 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8325
	aString errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8326
	'*** I''ll continue, assuming <yes> ...' errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8327
	^ true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8328
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8329
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8330
    (Dialog isNil 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8331
    or:[Screen isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8332
    or:[Screen current isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8333
    or:[Screen current isOpen not]]]) ifTrue:[       
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8334
	'confirm: ' infoPrint.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8335
	aString infoPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8336
	'continue, assuming <yes>' infoPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8337
	^ true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8338
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8339
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8340
    Dialog autoload.        "in case its autoloaded"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8341
    ^ Dialog confirm:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8342
        
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8343
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8344
     nil confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8345
     self confirm:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8346
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8347
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8348
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8349
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8350
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8351
confirm:aString orCancel:cancelBlock
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8352
    "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
  8353
     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
  8354
     If no GUI is present (headless applications), cancelBlock is returned."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8355
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8356
    |answer|
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8357
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8358
    answer := self confirmWithCancel:aString.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8359
    answer isNil ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8360
	^ cancelBlock value
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8361
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8362
    ^ answer
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8363
        
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8364
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8365
     self confirm:'hello' orCancel:[self halt]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8366
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8367
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8368
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8369
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8370
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8371
confirmWithCancel:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8372
    "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
  8373
     return true for yes, false for no, nil for cancel.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8374
     If no GUI is present (headless applications), nil is returned."
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
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8377
     on systems without GUI, or during startup, output a message
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8378
     and return true (as if yes was answered)
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8379
     Q: should we ask user by reading Stdin ?
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8380
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8381
    Smalltalk isInitialized ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8382
	'*** confirmation requested during initialization:' errorPrintCR. 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8383
	aString errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8384
	'*** I''ll continue, assuming <cancel> ...' errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8385
	^ nil
5755
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8388
    (Dialog isNil 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8389
    or:[Screen isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8390
    or:[Screen current isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8391
    or:[Screen current isOpen not]]]) ifTrue:[       
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8392
	'confirm: ' infoPrint.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8393
	aString infoPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8394
	'continue, assuming <cancel>' infoPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8395
	^ nil
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8396
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8397
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8398
    Dialog autoload.        "in case its autoloaded"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8399
    ^ Dialog confirmWithCancel:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8400
        
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8401
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8402
     nil confirmWithCancel:'hello' 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8403
     self confirmWithCancel:'hello'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8404
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8405
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8406
    "Modified: 20.5.1996 / 10:28:40 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8407
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8408
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8409
errorNotify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8410
    "launch a Notifier, showing top stack, telling user something
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8411
     and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8412
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8413
    ^ self
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8414
	errorNotify:aString 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8415
	from:thisContext sender
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8416
	allowDebug:true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8417
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8418
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8419
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8420
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8421
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8422
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
  8423
    "Modified: / 16.11.2001 / 15:36:49 / cg"
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8424
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8425
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8426
errorNotify:aString from:aContext
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8427
    "launch a Notifier, showing top stack (above aContext), 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8428
     telling user something and give user a chance to enter debugger."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8429
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8430
    ^ self errorNotify:aString from:aContext allowDebug:true
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8431
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8432
    "Modified: / 17.8.1998 / 10:09:27 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8433
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8434
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8435
errorNotify:aString from:aContext allowDebug:allowDebug
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8436
    "launch a Notifier, showing top stack (above aContext), 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8437
     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
  8438
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
  8439
    |currentScreen info con sender action boxLabels boxValues default|
5755
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
    Smalltalk isInitialized ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8442
	'errorNotification: ' print. aString printCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8443
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8444
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8445
    (Dialog isNil 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8446
    or:[Screen isNil
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
  8447
    or:[(currentScreen := Screen current) isNil
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
  8448
    or:[currentScreen isOpen not]]]) ifTrue:[       
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8449
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8450
	 on systems without GUI, simply show
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8451
	 the message on the Transcript and abort.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8452
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8453
	Transcript showCR:aString.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8454
	AbortSignal raise.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8455
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8456
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8457
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8458
    Processor activeProcessIsSystemProcess ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8459
	action := #debug.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8460
	sender := aContext.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8461
	Debugger isNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8462
	    '****************** Cought Error while in SystemProcess ****************' errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8463
	    thisContext fullPrintAll.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8464
	    action := #abort.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8465
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8466
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8467
	Dialog autoload.        "in case its autoloaded"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8468
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8469
	ErrorSignal handle:[:ex |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8470
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8471
	    "/ a recursive error - quickly enter debugger
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8472
	    "/ this happened, when I corrupted the Dialog class ...
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8473
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8474
	    ('Object [error]: ' , ex errorString , ' caught in errorNotification') errorPrintCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8475
	    action := #debug.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8476
	    ex return.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8477
	] do:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8478
	    sender := aContext.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8479
	    sender isNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8480
		sender := thisContext sender.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8481
		"/
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8482
		"/ for your convenience: skip the emergencyHandler block
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8483
"/                sender isBlockContext ifTrue:[
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8484
"/                    sender := sender sender
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8485
"/                ].
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8486
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8487
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8488
	    "/ skip intermediate (signal & exception) contexts
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8489
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8490
	    DebugView notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8491
		sender := DebugView interestingContextFrom:sender
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8492
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8493
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8494
	    "/ show the first few contexts
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8495
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8496
	    con := sender.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8497
	    info := aString , Character cr asString , Character cr asString.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8498
	    1 to:15 do:[:n |
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8499
		con notNil ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8500
		    info := info , con printString , Character cr asString.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8501
		    con := con sender
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8502
		]
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8503
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8504
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8505
	    (allowDebug and:[Debugger notNil]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8506
		boxLabels   := #('Proceed' 'Abort' 'Debug').
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8507
		boxValues  := #(#proceed #abort #debug).
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8508
		default := #debug.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8509
	    ] ifFalse:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8510
		boxLabels   := #('Proceed' 'Abort').
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8511
		boxValues  := #(#proceed #abort).
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8512
		default := #abort.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8513
	    ].
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8514
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8515
	    action := Dialog 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8516
		    choose:info 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8517
		    label:('Exception [' , Processor activeProcess nameOrId , ']')
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8518
		    image:WarningBox errorIconBitmap
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8519
		    labels:boxLabels
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8520
		    values:boxValues
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8521
		    default:default
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8522
		    onCancel:nil.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8523
	].
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8524
    ].
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
    action == #debug ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8527
	Debugger enter:sender withMessage:aString mayProceed:true
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8528
    ] ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8529
	(action isNil 
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8530
	or:[action == #abort]) ifTrue:[
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8531
	    AbortSignal raise
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8532
	]
5755
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
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
     nil errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8537
     self errorNotify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8538
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8539
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8540
    "Created: / 17.8.1998 / 10:09:26 / cg"
6199
5fcf06f17cee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6196
diff changeset
  8541
    "Modified: / 16.11.2001 / 15:40:12 / cg"
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
information:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8545
    "launch an InfoBox, telling user something. 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8546
     These info-boxes can be suppressed by handling the 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8547
     UserNotification- or InformationSignal and proceeding in the handler."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8548
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8549
    InformationSignal isHandled ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8550
	^ InformationSignal raiseRequestWith:self errorString:aString
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8551
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8552
    self notify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8553
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
     nil information:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8556
     self information:'hello there'
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8559
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8560
     InformationSignal handle:[:ex |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8561
	'no box popped' printNL.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8562
	ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8563
     ] do:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8564
	'hello' printNL.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8565
	self information:'some info'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8566
	'world' printNL.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8567
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8568
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8569
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8570
    "Modified: 24.11.1995 / 22:29:49 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8571
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8572
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8573
notify:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8574
    "launch a Notifier, telling user something.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8575
     Use #information: for ignorable messages."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8576
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8577
    Smalltalk isInitialized ifFalse:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8578
	'information: ' print. aString printCR.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8579
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8580
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8581
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8582
    (Smalltalk isInitialized not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8583
    or:[Dialog isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8584
    or:[Screen isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8585
    or:[Screen current isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8586
    or:[Screen current isOpen not]]]]) ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8587
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8588
	 on systems without GUI, simply show
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8589
	 the message on the Transcript and abort.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8590
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8591
	Transcript show:'notification: '; showCR:aString.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8592
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8593
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8594
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8595
    Dialog autoload.        "in case its autoloaded"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8596
    Dialog information:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8597
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8598
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8599
     nil notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8600
     self notify:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8601
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8602
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8603
    "Modified: 20.5.1996 / 10:28:48 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8604
!
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8605
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8606
warn:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8607
    "launch a WarningBox, telling user something.
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8608
     These warn-boxes can be suppressed by handling the 
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8609
     UserNotification- or WarningSignal and proceeding in the handler."
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8610
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8611
    WarningSignal isHandled ifTrue:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8612
	^ WarningSignal raiseRequestWith:self errorString:aString
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
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8615
    (Smalltalk isInitialized not
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8616
    or:[Dialog isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8617
    or:[Screen isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8618
    or:[Screen current isNil
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8619
    or:[Screen current isOpen not]]]]) ifTrue:[       
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8620
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8621
	 on systems without GUI, simply show
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8622
	 the message on the Transcript and abort.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8623
	"
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8624
	Transcript show:'warning: '; showCR:aString.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8625
	^ self
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8626
    ].
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8627
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8628
    Dialog autoload.        "in case its autoloaded"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8629
    Dialog warn:aString
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8630
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8631
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8632
     nil warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8633
     self warn:'hello there'
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8634
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8635
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8636
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8637
     WarningSignal handle:[:ex |
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8638
	ex proceed.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8639
     ] do:[
6496
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8640
	'hello' printNL.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8641
	self warn:'some info'.
639f2b748424 use arrayVal macros
Claus Gittinger <cg@exept.de>
parents: 6478
diff changeset
  8642
	'world' printNL.
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8643
     ]
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8644
    "
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8645
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8646
    "Modified: 20.5.1996 / 10:28:53 / cg"
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8647
! !
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8648
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8649
!Object class methodsFor:'documentation'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8650
5754
333aba8041c2 checkin from browser
tm
parents: 5706
diff changeset
  8651
version
6537
7906825ad5c3 Do not allow to proceed in debugger on SIGSEGV
Stefan Vogel <sv@exept.de>
parents: 6533
diff changeset
  8652
    ^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.404 2002-05-07 16:57:28 stefan Exp $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  8653
! !
5755
72551e427a2d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5754
diff changeset
  8654
Object initialize!